clang 22.0.0git
SemaDeclAttr.cpp File Reference
#include "clang/AST/APValue.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DynamicRecursiveASTVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/Type.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/Cuda.h"
#include "clang/Basic/DarwinSDKInfo.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Attr.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedAttr.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaAMDGPU.h"
#include "clang/Sema/SemaARM.h"
#include "clang/Sema/SemaAVR.h"
#include "clang/Sema/SemaBPF.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaHLSL.h"
#include "clang/Sema/SemaM68k.h"
#include "clang/Sema/SemaMIPS.h"
#include "clang/Sema/SemaMSP430.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaOpenCL.h"
#include "clang/Sema/SemaOpenMP.h"
#include "clang/Sema/SemaRISCV.h"
#include "clang/Sema/SemaSYCL.h"
#include "clang/Sema/SemaSwift.h"
#include "clang/Sema/SemaWasm.h"
#include "clang/Sema/SemaX86.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <optional>

Go to the source code of this file.

Classes

struct  FormatAttrCommon

Namespaces

namespace  AttributeLangSupport

Enumerations

enum  AttributeLangSupport::LANG { AttributeLangSupport::C , AttributeLangSupport::Cpp , AttributeLangSupport::ObjC }
enum  FormatAttrKind {
  CFStringFormat , NSStringFormat , StrftimeFormat , SupportedFormat ,
  IgnoredFormat , InvalidFormat
}

Functions

static unsigned getNumAttributeArgs (const ParsedAttr &AL)
template<typename AttrInfo>
static bool checkPositiveIntArgument (Sema &S, const AttrInfo &AI, const Expr *Expr, int &Val, unsigned Idx=UINT_MAX)
 Wrapper around checkUInt32Argument, with an extra check to be sure that the result will fit into a regular (signed) int.
static bool isIntOrBool (Expr *Exp)
 Check if the passed-in expression is of type int or bool.
static bool threadSafetyCheckIsSmartPointer (Sema &S, const RecordDecl *Record)
static bool threadSafetyCheckIsPointer (Sema &S, const Decl *D, const ParsedAttr &AL)
 Check if passed in Decl is a pointer type.
static const RecordDeclgetRecordDecl (QualType QT)
 Checks that the passed in QualType either is of RecordType or points to RecordType.
template<typename AttrType>
static bool checkRecordDeclForAttr (const RecordDecl *RD)
static bool checkRecordTypeForCapability (Sema &S, QualType Ty)
static bool checkRecordTypeForScopedCapability (Sema &S, QualType Ty)
static bool checkTypedefTypeForCapability (QualType Ty)
static bool typeHasCapability (Sema &S, QualType Ty)
static bool isCapabilityExpr (Sema &S, const Expr *Ex)
static void checkAttrArgsAreCapabilityObjs (Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args, unsigned Sidx=0, bool ParamIdxOk=false)
 Checks that all attribute arguments, starting from Sidx, resolve to a capability object.
static bool checkFunParamsAreScopedLockable (Sema &S, const ParmVarDecl *ParamDecl, const ParsedAttr &AL)
static void handlePtGuardedVarAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkGuardedByAttrCommon (Sema &S, Decl *D, const ParsedAttr &AL, Expr *&Arg)
static void handleGuardedByAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePtGuardedByAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkAcquireOrderAttrCommon (Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args)
static void handleAcquiredAfterAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAcquiredBeforeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkLockFunAttrCommon (Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args)
template<typename AttrInfo>
static bool checkParamIsIntegerType (Sema &S, const Decl *D, const AttrInfo &AI, unsigned AttrArgNo)
 Checks to be sure that the given parameter number is in bounds, and is an integral type.
static void handleAllocSizeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkTryLockFunAttrCommon (Sema &S, Decl *D, const ParsedAttr &AL, SmallVectorImpl< Expr * > &Args)
static void handleLockReturnedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleLocksExcludedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkFunctionConditionAttr (Sema &S, Decl *D, const ParsedAttr &AL, Expr *&Cond, StringRef &Msg)
static void handleEnableIfAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleErrorAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleExcludeFromExplicitInstantiationAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDiagnoseAsBuiltinAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDiagnoseIfAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCFIUncheckedCalleeAttr (Sema &S, Decl *D, const ParsedAttr &Attrs)
static void handleNoBuiltinAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePassObjectSizeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleConsumableAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkForConsumableClass (Sema &S, const CXXMethodDecl *MD, const ParsedAttr &AL)
static void handleCallableWhenAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleParamTypestateAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleReturnTypestateAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSetTypestateAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTestTypestateAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleExtVectorTypeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePackedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePreferredName (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoSpecializations (Sema &S, Decl *D, const ParsedAttr &AL)
static bool attrNonNullArgCheck (Sema &S, QualType T, const ParsedAttr &AL, SourceRange AttrParmRange, SourceRange TypeRange, bool isReturnValue=false)
static void handleNonNullAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNonNullAttrParameter (Sema &S, ParmVarDecl *D, const ParsedAttr &AL)
static void handleReturnsNonNullAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoEscapeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAssumeAlignedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAllocAlignAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool normalizeName (StringRef &AttrName)
 Normalize the attribute, foo becomes foo.
static void handleOwnershipAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleWeakRefAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void markUsedForAliasOrIfunc (Sema &S, Decl *D, const ParsedAttr &AL, StringRef Str)
static void handleIFuncAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAliasAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTLSModelAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleRestrictAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCPUSpecificAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCommonAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNakedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool isKnownToAlwaysThrow (const FunctionDecl *FD)
static void handleNoReturnAttr (Sema &S, Decl *D, const ParsedAttr &Attrs)
static void handleStandardNoReturnAttr (Sema &S, Decl *D, const ParsedAttr &A)
static void handleNoCfCheckAttr (Sema &S, Decl *D, const ParsedAttr &Attrs)
static void handleAnalyzerNoReturnAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleVecReturnAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDependencyAttr (Sema &S, Scope *Scope, Decl *D, const ParsedAttr &AL)
static void handleUnusedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static ExprResult sharedGetConstructorDestructorAttrExpr (Sema &S, const ParsedAttr &AL)
static void handleConstructorAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDestructorAttr (Sema &S, Decl *D, const ParsedAttr &AL)
template<typename AttrTy>
static void handleAttrWithMessage (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkAvailabilityAttr (Sema &S, SourceRange Range, IdentifierInfo *Platform, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted)
static bool versionsMatch (const VersionTuple &X, const VersionTuple &Y, bool BeforeIsOkay)
 Check whether the two versions match.
static void handleAvailabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleExternalSourceSymbolAttr (Sema &S, Decl *D, const ParsedAttr &AL)
template<class T>
static T * mergeVisibilityAttr (Sema &S, Decl *D, const AttributeCommonInfo &CI, typename T::VisibilityType value)
static void handleVisibilityAttr (Sema &S, Decl *D, const ParsedAttr &AL, bool isTypeVisibility)
static void handleSentinelAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleWarnUnusedResult (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleWeakImportAttr (Sema &S, Decl *D, const ParsedAttr &AL)
template<class Attribute>
static ExprmakeAttributeArgExpr (Sema &S, Expr *E, const Attribute &Attr, const unsigned Idx)
template<typename WorkGroupAttr>
static void handleWorkGroupSize (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleVecTypeHint (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSectionAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool isValidCodeModelAttr (llvm::Triple &Triple, StringRef Str)
static void handleCodeModelAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool checkCodeSegName (Sema &S, SourceLocation LiteralLoc, StringRef CodeSegName)
static void handleCodeSegAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTargetVersionAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTargetAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTargetClonesAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMinVectorWidthAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCleanupAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleEnumExtensibilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleFormatArgAttr (Sema &S, Decl *D, const ParsedAttr &AL)
 Handle attribute((format_arg((idx)))) attribute based on http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html.
static FormatAttrKind getFormatAttrKind (StringRef Format)
 getFormatAttrKind - Map from format attribute names to supported format types.
static void handleInitPriorityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
 Handle attribute((init_priority(priority))) attributes based on http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html.
static bool handleFormatAttrCommon (Sema &S, Decl *D, const ParsedAttr &AL, FormatAttrCommon *Info)
 Handle attribute((format(type,idx,firstarg))) attributes based on http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html.
static void handleFormatAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleFormatMatchesAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCallbackAttr (Sema &S, Decl *D, const ParsedAttr &AL)
 Handle attribute((callback(CalleeIdx, PayloadIdx0, ...))) attributes.
static void handleLifetimeCaptureByAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool isFunctionLike (const Type &T)
static void handleCalledOnceAttr (Sema &S, Decl *D, const ParsedAttr &AL)
 Handle 'called_once' attribute.
static void handleTransparentUnionAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAnnotateAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAlignValueAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAlignedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool validateAlignasAppliedType (Sema &S, Decl *D, const AlignedAttr &Attr, SourceLocation AttrLoc)
 Perform checking of type validity.
static void parseModeAttrArg (Sema &S, StringRef Str, unsigned &DestWidth, bool &IntegerMode, bool &ComplexMode, FloatModeKind &ExplicitType)
 parseModeAttrArg - Parses attribute mode string and returns parsed type attribute.
static void handleModeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
 handleModeAttr - This attribute modifies the width of a decl with primitive type.
static void handleNonStringAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoDebugAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAlwaysInlineAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMinSizeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleOptimizeNoneAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleConstantAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSharedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleGlobalAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDeviceAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleManagedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleGridConstantAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleGNUInlineAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCallConvAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDeviceKernelAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleSuppressAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleLifetimeCategoryAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleRandomizeLayoutAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoRandomizeLayoutAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static OffloadArch getOffloadArch (const TargetInfo &TI)
static ExprmakeLaunchBoundsArgExpr (Sema &S, Expr *E, const CUDALaunchBoundsAttr &AL, const unsigned Idx)
static void handleLaunchBoundsAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleArgumentWithTypeTagAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTypeTagForDatatypeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleXRayLogArgsAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePatchableFunctionEntryAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleBuiltinAliasAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNullableTypeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handlePreferredTypeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleUuidAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMSInheritanceAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDeclspecThreadAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMSConstexprAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAbiTagAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool hasBTFDeclTagAttr (Decl *D, StringRef Tag)
static void handleBTFDeclTagAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleInterruptAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleLayoutVersion (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDLLAttr (Sema &S, Decl *D, const ParsedAttr &A)
static void handleCapabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleReentrantCapabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAssertCapabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAcquireCapabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleTryAcquireCapabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleReleaseCapabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleRequiresCapabilityAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDeprecatedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static bool isGlobalVar (const Decl *D)
static bool isSanitizerAttributeAllowedOnGlobals (StringRef Sanitizer)
static void handleNoSanitizeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoSanitizeSpecificAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleInternalLinkageAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleZeroCallUsedRegsAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCountedByAttrField (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleFunctionReturnThunksAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAvailableOnlyInDefaultEvalMethod (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoMergeAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleNoUniqueAddressAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleDestroyAttr (Sema &S, Decl *D, const ParsedAttr &A)
static void handleUninitializedAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMIGServerRoutineAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleMSAllocatorAttr (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleAcquireHandleAttr (Sema &S, Decl *D, const ParsedAttr &AL)
template<typename Attr>
static void handleHandleAttr (Sema &S, Decl *D, const ParsedAttr &AL)
template<typename Attr>
static void handleUnsafeBufferUsage (Sema &S, Decl *D, const ParsedAttr &AL)
static void handleCFGuardAttr (Sema &S, Decl *D, const ParsedAttr &AL)
template<typename AttrTy>
static const AttrTy * findEnforceTCBAttrByName (Decl *D, StringRef Name)
template<typename AttrTy, typename ConflictingAttrTy>
static void handleEnforceTCBAttr (Sema &S, Decl *D, const ParsedAttr &AL)
template<typename AttrTy, typename ConflictingAttrTy>
static AttrTy * mergeEnforceTCBAttrImpl (Sema &S, Decl *D, const AttrTy &AL)
static void handleVTablePointerAuthentication (Sema &S, Decl *D, const ParsedAttr &AL)
static bool MustDelayAttributeArguments (const ParsedAttr &AL)
static void ProcessDeclAttribute (Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL, const Sema::ProcessDeclAttributeOptions &Options)
 ProcessDeclAttribute - Apply the specific attribute to the specified decl if the attribute applies to decls.
static bool isKernelDecl (Decl *D)
static void checkUnusedDeclAttributes (Sema &S, const ParsedAttributesView &A)
 checkUnusedDeclAttributes - Check a list of attributes to see if it contains any decl attributes that we should warn about.
static bool isForbiddenTypeAllowed (Sema &S, Decl *D, const DelayedDiagnostic &diag, UnavailableAttr::ImplicitReason &reason)
 Is the given declaration allowed to use a forbidden type?
static void handleDelayedForbiddenType (Sema &S, DelayedDiagnostic &DD, Decl *D)
 Handle a delayed forbidden-type diagnostic.

Enumeration Type Documentation

◆ FormatAttrKind

Enumerator
CFStringFormat 
NSStringFormat 
StrftimeFormat 
SupportedFormat 
IgnoredFormat 
InvalidFormat 

Definition at line 3612 of file SemaDeclAttr.cpp.

Function Documentation

◆ attrNonNullArgCheck()

bool attrNonNullArgCheck ( Sema & S,
QualType T,
const ParsedAttr & AL,
SourceRange AttrParmRange,
SourceRange TypeRange,
bool isReturnValue = false )
static

◆ checkAcquireOrderAttrCommon()

◆ checkAttrArgsAreCapabilityObjs()

void checkAttrArgsAreCapabilityObjs ( Sema & S,
Decl * D,
const ParsedAttr & AL,
SmallVectorImpl< Expr * > & Args,
unsigned Sidx = 0,
bool ParamIdxOk = false )
static

◆ checkAvailabilityAttr()

bool checkAvailabilityAttr ( Sema & S,
SourceRange Range,
IdentifierInfo * Platform,
VersionTuple Introduced,
VersionTuple Deprecated,
VersionTuple Obsoleted )
static

◆ checkCodeSegName()

bool checkCodeSegName ( Sema & S,
SourceLocation LiteralLoc,
StringRef CodeSegName )
static

◆ checkForConsumableClass()

◆ checkFunctionConditionAttr()

◆ checkFunParamsAreScopedLockable()

◆ checkGuardedByAttrCommon()

bool checkGuardedByAttrCommon ( Sema & S,
Decl * D,
const ParsedAttr & AL,
Expr *& Arg )
static

Definition at line 460 of file SemaDeclAttr.cpp.

References checkAttrArgsAreCapabilityObjs().

Referenced by handleGuardedByAttr(), and handlePtGuardedByAttr().

◆ checkLockFunAttrCommon()

bool checkLockFunAttrCommon ( Sema & S,
Decl * D,
const ParsedAttr & AL,
SmallVectorImpl< Expr * > & Args )
static

◆ checkParamIsIntegerType()

template<typename AttrInfo>
bool checkParamIsIntegerType ( Sema & S,
const Decl * D,
const AttrInfo & AI,
unsigned AttrArgNo )
static

Checks to be sure that the given parameter number is in bounds, and is an integral type.

Will emit appropriate diagnostics if this returns false.

AttrArgNo is used to actually retrieve the argument, so it's base-0.

Definition at line 548 of file SemaDeclAttr.cpp.

References clang::Sema::checkFunctionOrMethodParameterIndex(), clang::SemaBase::Diag(), clang::ParamIdx::getASTIndex(), clang::Stmt::getBeginLoc(), clang::getFunctionOrMethodParamRange(), clang::getFunctionOrMethodParamType(), clang::Type::isCharType(), and clang::Type::isIntegerType().

Referenced by handleAllocSizeAttr().

◆ checkPositiveIntArgument()

template<typename AttrInfo>
bool checkPositiveIntArgument ( Sema & S,
const AttrInfo & AI,
const Expr * Expr,
int & Val,
unsigned Idx = UINT_MAX )
static

Wrapper around checkUInt32Argument, with an extra check to be sure that the result will fit into a regular (signed) int.

All args have the same purpose as they do in checkUInt32Argument.

Definition at line 99 of file SemaDeclAttr.cpp.

References clang::Sema::checkUInt32Argument(), clang::SemaBase::Diag(), clang::Expr::getExprLoc(), toString(), and UINT_MAX.

Referenced by handleAllocSizeAttr().

◆ checkRecordDeclForAttr()

template<typename AttrType>
bool checkRecordDeclForAttr ( const RecordDecl * RD)
static

◆ checkRecordTypeForCapability()

bool checkRecordTypeForCapability ( Sema & S,
QualType Ty )
static

◆ checkRecordTypeForScopedCapability()

bool checkRecordTypeForScopedCapability ( Sema & S,
QualType Ty )
static

Definition at line 278 of file SemaDeclAttr.cpp.

References checkRecordDeclForAttr(), and getRecordDecl().

Referenced by checkFunParamsAreScopedLockable().

◆ checkTryLockFunAttrCommon()

◆ checkTypedefTypeForCapability()

bool checkTypedefTypeForCapability ( QualType Ty)
static

Definition at line 291 of file SemaDeclAttr.cpp.

References clang::Type::getAs(), and clang::Decl::hasAttr().

Referenced by typeHasCapability().

◆ checkUnusedDeclAttributes()

void checkUnusedDeclAttributes ( Sema & S,
const ParsedAttributesView & A )
static

checkUnusedDeclAttributes - Check a list of attributes to see if it contains any decl attributes that we should warn about.

Definition at line 7821 of file SemaDeclAttr.cpp.

References clang::SemaBase::Diag(), clang::Sema::DiagnoseUnknownAttribute(), clang::AttributeCommonInfo::IgnoredAttribute, and clang::AttributeCommonInfo::UnknownAttribute.

◆ findEnforceTCBAttrByName()

template<typename AttrTy>
const AttrTy * findEnforceTCBAttrByName ( Decl * D,
StringRef Name )
static

◆ getFormatAttrKind()

FormatAttrKind getFormatAttrKind ( StringRef Format)
static

getFormatAttrKind - Map from format attribute names to supported format types.

Definition at line 3623 of file SemaDeclAttr.cpp.

References CFStringFormat, IgnoredFormat, InvalidFormat, NSStringFormat, StrftimeFormat, and SupportedFormat.

Referenced by handleFormatAttrCommon().

◆ getNumAttributeArgs()

unsigned getNumAttributeArgs ( const ParsedAttr & AL)
static

◆ getOffloadArch()

OffloadArch getOffloadArch ( const TargetInfo & TI)
static

◆ getRecordDecl()

const RecordDecl * getRecordDecl ( QualType QT)
static

Checks that the passed in QualType either is of RecordType or points to RecordType.

Returns the relevant RecordType, null if it does not exit.

Definition at line 233 of file SemaDeclAttr.cpp.

References clang::Type::getAsCanonical(), and clang::Type::getAsRecordDecl().

Referenced by checkAttrArgsAreCapabilityObjs(), checkRecordTypeForCapability(), and checkRecordTypeForScopedCapability().

◆ handleAbiTagAttr()

◆ handleAcquireCapabilityAttr()

void handleAcquireCapabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAcquiredAfterAttr()

void handleAcquiredAfterAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAcquiredBeforeAttr()

void handleAcquiredBeforeAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAcquireHandleAttr()

◆ handleAliasAttr()

◆ handleAlignedAttr()

◆ handleAlignValueAttr()

void handleAlignValueAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAllocAlignAttr()

void handleAllocAlignAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAllocSizeAttr()

◆ handleAlwaysInlineAttr()

void handleAlwaysInlineAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAnalyzerNoReturnAttr()

◆ handleAnnotateAttr()

void handleAnnotateAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

Definition at line 4253 of file SemaDeclAttr.cpp.

References clang::Decl::addAttr(), and clang::Sema::CreateAnnotationAttr().

Referenced by ProcessDeclAttribute().

◆ handleArgumentWithTypeTagAttr()

◆ handleAssertCapabilityAttr()

void handleAssertCapabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAssumeAlignedAttr()

void handleAssumeAlignedAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAttrWithMessage()

template<typename AttrTy>
void handleAttrWithMessage ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleAvailabilityAttr()

void handleAvailabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

Definition at line 2446 of file SemaDeclAttr.cpp.

References clang::Decl::addAttr(), clang::Sema::AP_Explicit, clang::Sema::AP_InferredFromOtherPlatform, clang::Sema::AP_PragmaClangAttribute, clang::ParsedAttr::checkExactlyNumArgs(), clang::Sema::Context, clang::SemaBase::Diag(), clang::IdentifierTable::get(), clang::ParsedAttr::getArgAsIdent(), clang::ParsedAttr::getAvailabilityDeprecated(), clang::ParsedAttr::getAvailabilityIntroduced(), clang::ParsedAttr::getAvailabilityObsoleted(), clang::SourceRange::getBegin(), clang::Sema::getDarwinSDKInfoForAvailabilityChecking(), clang::ParsedAttr::getEnvironment(), clang::IdentifierLoc::getIdentifierInfo(), clang::Sema::getLangOpts(), clang::AttributeCommonInfo::getLoc(), clang::IdentifierLoc::getLoc(), clang::ParsedAttr::getMessageExpr(), clang::IdentifierInfo::getName(), clang::AttributeCommonInfo::getRange(), clang::ParsedAttr::getReplacementExpr(), clang::ParsedAttr::getStrictLoc(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::ParsedAttr::getUnavailableLoc(), clang::DarwinSDKInfo::getVersionMapping(), clang::ASTContext::Idents, clang::DarwinSDKInfo::OSEnvPair::iOStoTvOSPair(), clang::DarwinSDKInfo::OSEnvPair::iOStoWatchOSPair(), clang::isa(), clang::ParsedAttr::isPragmaClangAttribute(), clang::IdentifierInfo::isStr(), clang::AvailabilityChange::isValid(), clang::SourceLocation::isValid(), clang::DarwinSDKInfo::OSEnvPair::macOStoMacCatalystPair(), clang::Sema::mergeAvailabilityAttr(), clang::Min, clang::None, V, and clang::AvailabilityChange::Version.

Referenced by ProcessDeclAttribute().

◆ handleAvailableOnlyInDefaultEvalMethod()

void handleAvailableOnlyInDefaultEvalMethod ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

Definition at line 6472 of file SemaDeclAttr.cpp.

References clang::handleSimpleAttribute(), and clang::isa().

Referenced by ProcessDeclAttribute().

◆ handleBTFDeclTagAttr()

void handleBTFDeclTagAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleBuiltinAliasAttr()

◆ handleCallableWhenAttr()

◆ handleCallbackAttr()

◆ handleCallConvAttr()

◆ handleCalledOnceAttr()

void handleCalledOnceAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleCapabilityAttr()

void handleCapabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleCFGuardAttr()

◆ handleCFIUncheckedCalleeAttr()

◆ handleCleanupAttr()

◆ handleCodeModelAttr()

◆ handleCodeSegAttr()

◆ handleCommonAttr()

◆ handleConstantAttr()

◆ handleConstructorAttr()

◆ handleConsumableAttr()

◆ handleCountedByAttrField()

◆ handleCPUSpecificAttr()

◆ handleDeclspecThreadAttr()

◆ handleDelayedForbiddenType()

◆ handleDependencyAttr()

◆ handleDeprecatedAttr()

◆ handleDestroyAttr()

void handleDestroyAttr ( Sema & S,
Decl * D,
const ParsedAttr & A )
static

◆ handleDestructorAttr()

◆ handleDeviceAttr()

◆ handleDeviceKernelAttr()

◆ handleDiagnoseAsBuiltinAttr()

◆ handleDiagnoseIfAttr()

◆ handleDLLAttr()

◆ handleEnableIfAttr()

void handleEnableIfAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleEnforceTCBAttr()

◆ handleEnumExtensibilityAttr()

◆ handleErrorAttr()

void handleErrorAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleExcludeFromExplicitInstantiationAttr()

◆ handleExternalSourceSymbolAttr()

◆ handleExtVectorTypeAttr()

void handleExtVectorTypeAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleFormatArgAttr()

◆ handleFormatAttr()

◆ handleFormatAttrCommon()

◆ handleFormatMatchesAttr()

◆ handleFunctionReturnThunksAttr()

void handleFunctionReturnThunksAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleGlobalAttr()

◆ handleGNUInlineAttr()

◆ handleGridConstantAttr()

void handleGridConstantAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleGuardedByAttr()

void handleGuardedByAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleHandleAttr()

template<typename Attr>
void handleHandleAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleIFuncAttr()

◆ handleInitPriorityAttr()

◆ handleInternalLinkageAttr()

void handleInternalLinkageAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleInterruptAttr()

◆ handleLaunchBoundsAttr()

◆ handleLayoutVersion()

◆ handleLifetimeCaptureByAttr()

◆ handleLifetimeCategoryAttr()

◆ handleLockReturnedAttr()

void handleLockReturnedAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleLocksExcludedAttr()

◆ handleManagedAttr()

void handleManagedAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleMIGServerRoutineAttr()

◆ handleMinSizeAttr()

void handleMinSizeAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

Definition at line 4950 of file SemaDeclAttr.cpp.

References clang::Decl::addAttr(), and clang::Sema::mergeMinSizeAttr().

Referenced by ProcessDeclAttribute().

◆ handleMinVectorWidthAttr()

◆ handleModeAttr()

void handleModeAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

handleModeAttr - This attribute modifies the width of a decl with primitive type.

Despite what would be logical, the mode attribute is a decl attribute, not a type attribute: 'int ** __attribute((mode(HI))) *G;' tries to make 'G' be HImode, not an intermediate pointer.

Definition at line 4676 of file SemaDeclAttr.cpp.

References clang::AANT_ArgumentIdentifier, clang::Sema::AddModeAttr(), clang::SemaBase::Diag(), clang::ParsedAttr::getArgAsIdent(), clang::IdentifierLoc::getIdentifierInfo(), clang::AttributeCommonInfo::getLoc(), and clang::ParsedAttr::isArgIdent().

Referenced by ProcessDeclAttribute().

◆ handleMSAllocatorAttr()

◆ handleMSConstexprAttr()

◆ handleMSInheritanceAttr()

◆ handleNakedAttr()

◆ handleNoBuiltinAttr()

◆ handleNoCfCheckAttr()

void handleNoCfCheckAttr ( Sema & S,
Decl * D,
const ParsedAttr & Attrs )
static

◆ handleNoDebugAttr()

void handleNoDebugAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

Definition at line 4850 of file SemaDeclAttr.cpp.

References clang::Decl::addAttr(), and clang::Sema::Context.

Referenced by ProcessDeclAttribute().

◆ handleNoEscapeAttr()

◆ handleNoMergeAttr()

void handleNoMergeAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleNonNullAttr()

◆ handleNonNullAttrParameter()

◆ handleNonStringAttr()

◆ handleNoRandomizeLayoutAttr()

void handleNoRandomizeLayoutAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleNoReturnAttr()

◆ handleNoSanitizeAttr()

◆ handleNoSanitizeSpecificAttr()

◆ handleNoSpecializations()

◆ handleNoUniqueAddressAttr()

void handleNoUniqueAddressAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

Definition at line 6488 of file SemaDeclAttr.cpp.

References clang::Decl::addAttr(), and clang::Sema::Context.

Referenced by ProcessDeclAttribute().

◆ handleNullableTypeAttr()

◆ handleOptimizeNoneAttr()

void handleOptimizeNoneAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleOwnershipAttr()

◆ handlePackedAttr()

◆ handleParamTypestateAttr()

◆ handlePassObjectSizeAttr()

◆ handlePatchableFunctionEntryAttr()

◆ handlePreferredName()

◆ handlePreferredTypeAttr()

◆ handlePtGuardedByAttr()

void handlePtGuardedByAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handlePtGuardedVarAttr()

void handlePtGuardedVarAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleRandomizeLayoutAttr()

void handleRandomizeLayoutAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleReentrantCapabilityAttr()

void handleReentrantCapabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleReleaseCapabilityAttr()

void handleReleaseCapabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleRequiresCapabilityAttr()

void handleRequiresCapabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleRestrictAttr()

◆ handleReturnsNonNullAttr()

void handleReturnsNonNullAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleReturnTypestateAttr()

◆ handleSectionAttr()

◆ handleSentinelAttr()

◆ handleSetTypestateAttr()

◆ handleSharedAttr()

◆ handleStandardNoReturnAttr()

◆ handleSuppressAttr()

◆ handleTargetAttr()

void handleTargetAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleTargetClonesAttr()

◆ handleTargetVersionAttr()

◆ handleTestTypestateAttr()

◆ handleTLSModelAttr()

void handleTLSModelAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleTransparentUnionAttr()

◆ handleTryAcquireCapabilityAttr()

void handleTryAcquireCapabilityAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleTypeTagForDatatypeAttr()

◆ handleUninitializedAttr()

void handleUninitializedAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ handleUnsafeBufferUsage()

template<typename Attr>
void handleUnsafeBufferUsage ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

Definition at line 6573 of file SemaDeclAttr.cpp.

References clang::Decl::addAttr(), and clang::Sema::Context.

Referenced by ProcessDeclAttribute().

◆ handleUnusedAttr()

◆ handleUuidAttr()

◆ handleVecReturnAttr()

◆ handleVecTypeHint()

◆ handleVisibilityAttr()

◆ handleVTablePointerAuthentication()

◆ handleWarnUnusedResult()

◆ handleWeakImportAttr()

◆ handleWeakRefAttr()

◆ handleWorkGroupSize()

◆ handleXRayLogArgsAttr()

◆ handleZeroCallUsedRegsAttr()

void handleZeroCallUsedRegsAttr ( Sema & S,
Decl * D,
const ParsedAttr & AL )
static

◆ hasBTFDeclTagAttr()

bool hasBTFDeclTagAttr ( Decl * D,
StringRef Tag )
static

◆ isCapabilityExpr()

bool isCapabilityExpr ( Sema & S,
const Expr * Ex )
static

◆ isForbiddenTypeAllowed()

bool isForbiddenTypeAllowed ( Sema & S,
Decl * D,
const DelayedDiagnostic & diag,
UnavailableAttr::ImplicitReason & reason )
static

Is the given declaration allowed to use a forbidden type?

If so, it'll still be annotated with an attribute that makes it illegal to actually use.

Definition at line 8042 of file SemaDeclAttr.cpp.

References clang::Sema::Context, clang::Decl::getLocation(), clang::ASTContext::getSourceManager(), clang::isa(), and clang::SourceManager::isInSystemHeader().

Referenced by handleDelayedForbiddenType().

◆ isFunctionLike()

bool isFunctionLike ( const Type & T)
static

Definition at line 4162 of file SemaDeclAttr.cpp.

References clang::T.

Referenced by handleCalledOnceAttr().

◆ isGlobalVar()

bool isGlobalVar ( const Decl * D)
static

Definition at line 6321 of file SemaDeclAttr.cpp.

Referenced by handleNoSanitizeAttr(), and handleNoSanitizeSpecificAttr().

◆ isIntOrBool()

bool isIntOrBool ( Expr * Exp)
static

Check if the passed-in expression is of type int or bool.

Definition at line 166 of file SemaDeclAttr.cpp.

References clang::Expr::getType(), clang::Type::isBooleanType(), and clang::Type::isIntegerType().

Referenced by checkTryLockFunAttrCommon().

◆ isKernelDecl()

◆ isKnownToAlwaysThrow()

bool isKnownToAlwaysThrow ( const FunctionDecl * FD)
static

◆ isSanitizerAttributeAllowedOnGlobals()

bool isSanitizerAttributeAllowedOnGlobals ( StringRef Sanitizer)
static

Definition at line 6327 of file SemaDeclAttr.cpp.

Referenced by handleNoSanitizeAttr().

◆ isValidCodeModelAttr()

bool isValidCodeModelAttr ( llvm::Triple & Triple,
StringRef Str )
static

Definition at line 3189 of file SemaDeclAttr.cpp.

Referenced by handleCodeModelAttr().

◆ makeAttributeArgExpr()

◆ makeLaunchBoundsArgExpr()

◆ markUsedForAliasOrIfunc()

◆ mergeEnforceTCBAttrImpl()

template<typename AttrTy, typename ConflictingAttrTy>
AttrTy * mergeEnforceTCBAttrImpl ( Sema & S,
Decl * D,
const AttrTy & AL )
static

◆ mergeVisibilityAttr()

template<class T>
T * mergeVisibilityAttr ( Sema & S,
Decl * D,
const AttributeCommonInfo & CI,
typename T::VisibilityType value )
static

◆ MustDelayAttributeArguments()

◆ normalizeName()

bool normalizeName ( StringRef & AttrName)
static

Normalize the attribute, foo becomes foo.

Returns true if normalization was applied.

Definition at line 1462 of file SemaDeclAttr.cpp.

◆ parseModeAttrArg()

void parseModeAttrArg ( Sema & S,
StringRef Str,
unsigned & DestWidth,
bool & IntegerMode,
bool & ComplexMode,
FloatModeKind & ExplicitType )
static

◆ ProcessDeclAttribute()

void ProcessDeclAttribute ( Sema & S,
Scope * scope,
Decl * D,
const ParsedAttr & AL,
const Sema::ProcessDeclAttributeOptions & Options )
static

ProcessDeclAttribute - Apply the specific attribute to the specified decl if the attribute applies to decls.

If the attribute is a type attribute, just silently ignore it if a GNU attribute.

Definition at line 6817 of file SemaDeclAttr.cpp.

References clang::SemaSwift::AddParameterABIAttr(), clang::SemaObjC::AddXConsumedAttr(), clang::Sema::AMDGPU(), clang::Sema::ARM(), clang::Sema::AVR(), clang::Sema::BPF(), clang::Sema::checkCommonAttributeFeatures(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Sema::DiagnoseUnknownAttribute(), clang::ParsedAttr::existsInTarget(), clang::AttributeCommonInfo::getAttrName(), clang::ParsedAttr::getInfo(), clang::ParsedAttr::getKind(), clang::Sema::getLangOpts(), clang::AttributeCommonInfo::getLoc(), clang::Decl::getLocation(), clang::AttributeCommonInfo::getRange(), clang::ASTContext::getTargetInfo(), handleAbiTagAttr(), clang::SemaOpenCL::handleAccessAttr(), handleAcquireCapabilityAttr(), handleAcquiredAfterAttr(), handleAcquiredBeforeAttr(), handleAcquireHandleAttr(), handleAliasAttr(), handleAlignedAttr(), handleAlignValueAttr(), handleAllocAlignAttr(), handleAllocSizeAttr(), handleAlwaysInlineAttr(), clang::SemaAMDGPU::handleAMDGPUFlatWorkGroupSizeAttr(), clang::SemaAMDGPU::handleAMDGPUMaxNumWorkGroupsAttr(), clang::SemaAMDGPU::handleAMDGPUNumSGPRAttr(), clang::SemaAMDGPU::handleAMDGPUNumVGPRAttr(), clang::SemaAMDGPU::handleAMDGPUWavesPerEUAttr(), handleAnalyzerNoReturnAttr(), handleAnnotateAttr(), handleArgumentWithTypeTagAttr(), handleAssertCapabilityAttr(), handleAssumeAlignedAttr(), clang::SemaSwift::handleAsyncAttr(), clang::SemaSwift::handleAsyncError(), clang::SemaSwift::handleAsyncName(), clang::SemaSwift::handleAttrAttr(), clang::ParsedAttr::handleAttrWithDelayedArgs(), handleAttrWithMessage(), handleAvailabilityAttr(), handleAvailableOnlyInDefaultEvalMethod(), clang::SemaObjC::handleBlocksAttr(), clang::SemaObjC::handleBoxable(), clang::SemaSwift::handleBridge(), clang::SemaObjC::handleBridgeAttr(), clang::SemaObjC::handleBridgeMutableAttr(), clang::SemaObjC::handleBridgeRelatedAttr(), handleBTFDeclTagAttr(), clang::SemaARM::handleBuiltinAliasAttr(), handleBuiltinAliasAttr(), handleCallableWhenAttr(), handleCallbackAttr(), handleCallConvAttr(), handleCalledOnceAttr(), handleCapabilityAttr(), handleCFGuardAttr(), handleCFIUncheckedCalleeAttr(), handleCleanupAttr(), clang::SemaARM::handleCmseNSEntryAttr(), handleCodeModelAttr(), handleCodeSegAttr(), handleCommonAttr(), handleConstantAttr(), handleConstructorAttr(), handleConsumableAttr(), handleCountedByAttrField(), handleCPUSpecificAttr(), clang::ParsedAttrInfo::handleDeclAttribute(), handleDeclspecThreadAttr(), handleDependencyAttr(), handleDeprecatedAttr(), clang::SemaObjC::handleDesignatedInitializer(), handleDestroyAttr(), handleDestructorAttr(), handleDeviceAttr(), handleDeviceKernelAttr(), handleDiagnoseAsBuiltinAttr(), handleDiagnoseIfAttr(), clang::SemaObjC::handleDirectAttr(), clang::SemaObjC::handleDirectMembersAttr(), handleDLLAttr(), handleEnableIfAttr(), handleEnforceTCBAttr(), handleEnumExtensibilityAttr(), clang::SemaSwift::handleError(), handleErrorAttr(), handleExcludeFromExplicitInstantiationAttr(), clang::SemaObjC::handleExternallyRetainedAttr(), handleExternalSourceSymbolAttr(), handleExtVectorTypeAttr(), clang::SemaX86::handleForceAlignArgPointerAttr(), handleFormatArgAttr(), handleFormatAttr(), handleFormatMatchesAttr(), handleFunctionReturnThunksAttr(), handleGlobalAttr(), handleGNUInlineAttr(), handleGridConstantAttr(), handleGuardedByAttr(), handleHandleAttr(), clang::SemaObjC::handleIBOutlet(), clang::SemaObjC::handleIBOutletCollection(), handleIFuncAttr(), clang::SemaObjC::handleIndependentClass(), handleInitPriorityAttr(), handleInternalLinkageAttr(), handleInterruptAttr(), clang::SemaARM::handleInterruptSaveFPAttr(), clang::SemaSYCL::handleKernelEntryPointAttr(), handleLaunchBoundsAttr(), handleLayoutVersion(), handleLifetimeCaptureByAttr(), handleLifetimeCategoryAttr(), handleLockReturnedAttr(), handleLocksExcludedAttr(), handleManagedAttr(), clang::SemaObjC::handleMethodFamilyAttr(), handleMIGServerRoutineAttr(), handleMinSizeAttr(), handleMinVectorWidthAttr(), handleModeAttr(), handleMSAllocatorAttr(), handleMSConstexprAttr(), handleMSInheritanceAttr(), handleNakedAttr(), clang::SemaSwift::handleName(), clang::SemaARM::handleNewAttr(), clang::SemaSwift::handleNewType(), handleNoBuiltinAttr(), handleNoCfCheckAttr(), handleNoDebugAttr(), handleNoEscapeAttr(), handleNoMergeAttr(), handleNonNullAttr(), handleNonNullAttrParameter(), handleNonStringAttr(), handleNoRandomizeLayoutAttr(), handleNoReturnAttr(), handleNoSanitizeAttr(), handleNoSanitizeSpecificAttr(), handleNoSpecializations(), clang::SemaOpenCL::handleNoSVMAttr(), handleNoUniqueAddressAttr(), clang::SemaObjC::handleNSErrorDomain(), clang::SemaObjC::handleNSObject(), handleNullableTypeAttr(), clang::SemaHLSL::handleNumThreadsAttr(), clang::SemaOpenMP::handleOMPAssumeAttr(), handleOptimizeNoneAttr(), clang::SemaObjC::handleOwnershipAttr(), handleOwnershipAttr(), handlePackedAttr(), clang::SemaHLSL::handlePackOffsetAttr(), clang::SemaHLSL::handleParamModifierAttr(), handleParamTypestateAttr(), handlePassObjectSizeAttr(), handlePatchableFunctionEntryAttr(), clang::SemaObjC::handlePreciseLifetimeAttr(), handlePreferredName(), handlePreferredTypeAttr(), clang::SemaBPF::handlePreserveAccessIndexAttr(), handlePtGuardedByAttr(), handlePtGuardedVarAttr(), handleRandomizeLayoutAttr(), handleReentrantCapabilityAttr(), handleReleaseCapabilityAttr(), handleRequiresCapabilityAttr(), clang::SemaObjC::handleRequiresSuperAttr(), clang::SemaHLSL::handleResourceBindingAttr(), handleRestrictAttr(), clang::SemaObjC::handleReturnsInnerPointerAttr(), handleReturnsNonNullAttr(), handleReturnTypestateAttr(), clang::SemaHLSL::handleRootSignatureAttr(), clang::SemaObjC::handleRuntimeName(), handleSectionAttr(), clang::SemaHLSL::handleSemanticAttr(), handleSentinelAttr(), handleSetTypestateAttr(), clang::SemaHLSL::handleShaderAttr(), handleSharedAttr(), clang::SemaAVR::handleSignalAttr(), clang::handleSimpleAttribute(), clang::handleSimpleAttributeOrDiagnose(), handleStandardNoReturnAttr(), clang::SemaOpenCL::handleSubGroupSize(), clang::SemaObjC::handleSuppresProtocolAttr(), handleSuppressAttr(), handleTargetAttr(), handleTargetClonesAttr(), handleTargetVersionAttr(), handleTestTypestateAttr(), handleTLSModelAttr(), handleTransparentUnionAttr(), handleTryAcquireCapabilityAttr(), handleTypeTagForDatatypeAttr(), handleUninitializedAttr(), handleUnsafeBufferUsage(), handleUnusedAttr(), handleUuidAttr(), handleVecReturnAttr(), handleVecTypeHint(), handleVisibilityAttr(), clang::SemaHLSL::handleVkBindingAttr(), clang::SemaHLSL::handleVkConstantIdAttr(), clang::SemaHLSL::handleVkExtBuiltinInputAttr(), handleVTablePointerAuthentication(), handleWarnUnusedResult(), clang::SemaHLSL::handleWaveSizeAttr(), handleWeakImportAttr(), handleWeakRefAttr(), clang::SemaWasm::handleWebAssemblyExportNameAttr(), clang::SemaWasm::handleWebAssemblyImportModuleAttr(), clang::SemaWasm::handleWebAssemblyImportNameAttr(), handleWorkGroupSize(), handleXRayLogArgsAttr(), clang::SemaObjC::handleXReturnsXRetainedAttr(), handleZeroCallUsedRegsAttr(), clang::Sema::HLSL(), clang::AttributeCommonInfo::IgnoredAttribute, clang::Sema::ProcessDeclAttributeOptions::IgnoreTypeAttributes, clang::Sema::ProcessDeclAttributeOptions::IncludeCXX11Attributes, clang::isa(), clang::AttributeCommonInfo::isC23Attribute(), clang::AttributeCommonInfo::isClangScope(), clang::AttributeCommonInfo::isCXX11Attribute(), clang::AttributeCommonInfo::isDeclspecAttribute(), clang::ParsedAttr::isInvalid(), clang::AttributeCommonInfo::isRegularKeywordAttribute(), clang::AttributeCommonInfo::isStandardAttributeSyntax(), clang::ParsedAttr::isStmtAttr(), clang::ParsedAttr::isTypeAttr(), clang::ParsedAttr::isUsedAsTypeAttr(), clang::SemaObjC::isValidOSObjectOutParameter(), MustDelayAttributeArguments(), clang::ParsedAttrInfo::NotHandled, clang::Sema::ObjC(), clang::Sema::OpenCL(), clang::Sema::OpenMP(), clang::SemaObjC::parsedAttrToRetainOwnershipKind(), clang::ParsedAttr::slidesFromDeclToDeclSpecLegacyBehavior(), clang::Sema::Swift(), clang::SwiftAsyncContext, clang::SwiftContext, clang::SwiftErrorResult, clang::SwiftIndirectResult, clang::Sema::SYCL(), clang::AttributeCommonInfo::UnknownAttribute, clang::Sema::Wasm(), and clang::Sema::X86().

Referenced by clang::Sema::ProcessAccessDeclAttributeList(), and clang::Sema::ProcessDeclAttributeList().

◆ sharedGetConstructorDestructorAttrExpr()

◆ threadSafetyCheckIsPointer()

bool threadSafetyCheckIsPointer ( Sema & S,
const Decl * D,
const ParsedAttr & AL )
static

Check if passed in Decl is a pointer type.

Note that this function may produce an error message.

Returns
true if the Decl is a pointer type; false otherwise

Definition at line 209 of file SemaDeclAttr.cpp.

References clang::cast(), clang::SemaBase::Diag(), clang::Type::getAsRecordDecl(), clang::AttributeCommonInfo::getLoc(), clang::Type::isAnyPointerType(), and threadSafetyCheckIsSmartPointer().

Referenced by handlePtGuardedByAttr(), and handlePtGuardedVarAttr().

◆ threadSafetyCheckIsSmartPointer()

bool threadSafetyCheckIsSmartPointer ( Sema & S,
const RecordDecl * Record )
static

◆ typeHasCapability()

◆ validateAlignasAppliedType()

bool validateAlignasAppliedType ( Sema & S,
Decl * D,
const AlignedAttr & Attr,
SourceLocation AttrLoc )
static

Perform checking of type validity.

C++11 [dcl.align]p1: An alignment-specifier may be applied to a variable or to a class data member, but it shall not be applied to a bit-field, a function parameter, the formal parameter of a catch clause, or a variable declared with the register storage class specifier. An alignment-specifier may also be applied to the declaration of a class or enumeration type. CWG 2354: CWG agreed to remove permission for alignas to be applied to enumerations. C11 6.7.5/2: An alignment attribute shall not be specified in a declaration of a typedef, or a bit-field, or a function, or a parameter, or an object declared with the register storage-class specifier.

Definition at line 4365 of file SemaDeclAttr.cpp.

References clang::SemaBase::Diag(), clang::ExpectedVariableFieldOrTag, clang::ExpectedVariableOrField, clang::isa(), clang::AttributeCommonInfo::isRegularKeywordAttribute(), and clang::SC_Register.

Referenced by clang::Sema::AddAlignedAttr(), and clang::Sema::AddAlignedAttr().

◆ versionsMatch()

bool versionsMatch ( const VersionTuple & X,
const VersionTuple & Y,
bool BeforeIsOkay )
static

Check whether the two versions match.

If either version tuple is empty, then they are assumed to match. If BeforeIsOkay is true, then X can be less than or equal to Y.

Definition at line 2261 of file SemaDeclAttr.cpp.

References X.

Referenced by clang::Sema::mergeAvailabilityAttr().