clang  3.7.0
Namespaces | Enumerations | Functions
SemaDeclAttr.cpp File Reference
#include "clang/Sema/SemaInternal.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Scope.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MathExtras.h"
Include dependency graph for SemaDeclAttr.cpp:

Go to the source code of this file.

Namespaces

 AttributeLangSupport
 

Enumerations

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

Functions

static bool isFunctionOrMethod (const Decl *D)
 
static bool isFunctionOrMethodOrBlock (const Decl *D)
 Return true if the given decl has function type (function or function-typed variable) or an Objective-C method or a block. More...
 
static bool hasDeclarator (const Decl *D)
 
static bool hasFunctionProto (const Decl *D)
 
static unsigned getFunctionOrMethodNumParams (const Decl *D)
 
static QualType getFunctionOrMethodParamType (const Decl *D, unsigned Idx)
 
static SourceRange getFunctionOrMethodParamRange (const Decl *D, unsigned Idx)
 
static QualType getFunctionOrMethodResultType (const Decl *D)
 
static SourceRange getFunctionOrMethodResultSourceRange (const Decl *D)
 
static bool isFunctionOrMethodVariadic (const Decl *D)
 
static bool isInstanceMethod (const Decl *D)
 
static bool isNSStringType (QualType T, ASTContext &Ctx)
 
static bool isCFStringType (QualType T, ASTContext &Ctx)
 
static unsigned getNumAttributeArgs (const AttributeList &Attr)
 
template<typename Compare >
static bool checkAttributeNumArgsImpl (Sema &S, const AttributeList &Attr, unsigned Num, unsigned Diag, Compare Comp)
 
static bool checkAttributeNumArgs (Sema &S, const AttributeList &Attr, unsigned Num)
 Check if the attribute has exactly as many args as Num. May output an error. More...
 
static bool checkAttributeAtLeastNumArgs (Sema &S, const AttributeList &Attr, unsigned Num)
 Check if the attribute has at least as many args as Num. May output an error. More...
 
static bool checkAttributeAtMostNumArgs (Sema &S, const AttributeList &Attr, unsigned Num)
 Check if the attribute has at most as many args as Num. May output an error. More...
 
static bool checkUInt32Argument (Sema &S, const AttributeList &Attr, const Expr *Expr, uint32_t &Val, unsigned Idx=UINT_MAX)
 If Expr is a valid integer constant, get the value of the integer expression and return success or failure. May output an error. More...
 
template<typename AttrTy >
static bool checkAttrMutualExclusion (Sema &S, Decl *D, const AttributeList &Attr)
 Diagnose mutually exclusive attributes when present on a given declaration. Returns true if diagnosed. More...
 
static bool checkFunctionOrMethodParameterIndex (Sema &S, const Decl *D, const AttributeList &Attr, unsigned AttrArgNum, const Expr *IdxExpr, uint64_t &Idx)
 Check if IdxExpr is a valid parameter index for a function or instance method D. May output an error. More...
 
template<typename AttrType >
static void handleSimpleAttribute (Sema &S, Decl *D, const AttributeList &Attr)
 Applies the given attribute to the Decl without performing any additional semantic checking. More...
 
static bool isIntOrBool (Expr *Exp)
 Check if the passed-in expression is of type int or bool. More...
 
static bool threadSafetyCheckIsSmartPointer (Sema &S, const RecordType *RT)
 
static bool threadSafetyCheckIsPointer (Sema &S, const Decl *D, const AttributeList &Attr)
 Check if passed in Decl is a pointer type. Note that this function may produce an error message. More...
 
static const RecordTypegetRecordType (QualType QT)
 Checks that the passed in QualType either is of RecordType or points to RecordType. Returns the relevant RecordType, null if it does not exit. More...
 
static bool checkRecordTypeForCapability (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 AttributeList &Attr, SmallVectorImpl< Expr * > &Args, int Sidx=0, bool ParamIdxOk=false)
 Checks that all attribute arguments, starting from Sidx, resolve to a capability object. More...
 
static void handlePtGuardedVarAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool checkGuardedByAttrCommon (Sema &S, Decl *D, const AttributeList &Attr, Expr *&Arg)
 
static void handleGuardedByAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handlePtGuardedByAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool checkAcquireOrderAttrCommon (Sema &S, Decl *D, const AttributeList &Attr, SmallVectorImpl< Expr * > &Args)
 
static void handleAcquiredAfterAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAcquiredBeforeAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool checkLockFunAttrCommon (Sema &S, Decl *D, const AttributeList &Attr, SmallVectorImpl< Expr * > &Args)
 
static void handleAssertSharedLockAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAssertExclusiveLockAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool checkTryLockFunAttrCommon (Sema &S, Decl *D, const AttributeList &Attr, SmallVectorImpl< Expr * > &Args)
 
static void handleSharedTrylockFunctionAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleExclusiveTrylockFunctionAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleLockReturnedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleLocksExcludedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleEnableIfAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleConsumableAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool checkForConsumableClass (Sema &S, const CXXMethodDecl *MD, const AttributeList &Attr)
 
static void handleCallableWhenAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleParamTypestateAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleReturnTypestateAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleSetTypestateAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleTestTypestateAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleExtVectorTypeAttr (Sema &S, Scope *scope, Decl *D, const AttributeList &Attr)
 
static void handlePackedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool checkIBOutletCommon (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleIBOutlet (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleIBOutletCollection (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool attrNonNullArgCheck (Sema &S, QualType T, const AttributeList &Attr, SourceRange AttrParmRange, SourceRange TypeRange, bool isReturnValue=false)
 
static void handleNonNullAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleNonNullAttrParameter (Sema &S, ParmVarDecl *D, const AttributeList &Attr)
 
static void handleReturnsNonNullAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAssumeAlignedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleOwnershipAttr (Sema &S, Decl *D, const AttributeList &AL)
 
static void handleWeakRefAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAliasAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleColdAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleHotAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleTLSModelAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleRestrictAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleCommonAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleNoReturnAttr (Sema &S, Decl *D, const AttributeList &attr)
 
static void handleAnalyzerNoReturnAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleVecReturnAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleDependencyAttr (Sema &S, Scope *Scope, Decl *D, const AttributeList &Attr)
 
static void handleUsedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleConstructorAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleDestructorAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
template<typename AttrTy >
static void handleAttrWithMessage (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCSuppresProtocolAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
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. More...
 
static void handleAvailabilityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
template<class T >
static T * mergeVisibilityAttr (Sema &S, Decl *D, SourceRange range, typename T::VisibilityType value, unsigned attrSpellingListIndex)
 
static void handleVisibilityAttr (Sema &S, Decl *D, const AttributeList &Attr, bool isTypeVisibility)
 
static void handleObjCMethodFamilyAttr (Sema &S, Decl *decl, const AttributeList &Attr)
 
static void handleObjCNSObject (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCIndependentClass (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleBlocksAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleSentinelAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleWarnUnusedResult (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleWeakImportAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
template<typename WorkGroupAttr >
static void handleWorkGroupSize (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleVecTypeHint (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleSectionAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleTargetAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleCleanupAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleFormatArgAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static FormatAttrKind getFormatAttrKind (StringRef Format)
 
static void handleInitPriorityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleFormatAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleTransparentUnionAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAnnotateAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAlignValueAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAlignedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleModeAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleNoDebugAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAlwaysInlineAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleMinSizeAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleOptimizeNoneAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleGlobalAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleGNUInlineAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleCallConvAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool checkLaunchBoundsArgument (Sema &S, Expr *E, const CUDALaunchBoundsAttr &Attr, const unsigned Idx)
 
static void handleLaunchBoundsAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleArgumentWithTypeTagAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleTypeTagForDatatypeAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool isValidSubjectOfNSReturnsRetainedAttribute (QualType type)
 
static bool isValidSubjectOfNSAttribute (Sema &S, QualType type)
 
static bool isValidSubjectOfCFAttribute (Sema &S, QualType type)
 
static void handleNSConsumedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleNSReturnsRetainedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCReturnsInnerPointerAttr (Sema &S, Decl *D, const AttributeList &attr)
 
static void handleObjCRequiresSuperAttr (Sema &S, Decl *D, const AttributeList &attr)
 
static void handleCFAuditedTransferAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleCFUnknownTransferAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCBridgeAttr (Sema &S, Scope *Sc, Decl *D, const AttributeList &Attr)
 
static void handleObjCBridgeMutableAttr (Sema &S, Scope *Sc, Decl *D, const AttributeList &Attr)
 
static void handleObjCBridgeRelatedAttr (Sema &S, Scope *Sc, Decl *D, const AttributeList &Attr)
 
static void handleObjCDesignatedInitializer (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCRuntimeName (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCBoxable (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCOwnershipAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleObjCPreciseLifetimeAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleUuidAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleMSInheritanceAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleDeclspecThreadAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleARMInterruptAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleMSP430InterruptAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleInterruptAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAMDGPUNumVGPRAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAMDGPUNumSGPRAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleX86ForceAlignArgPointerAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleDLLAttr (Sema &S, Decl *D, const AttributeList &A)
 
static void handleCapabilityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAssertCapabilityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleAcquireCapabilityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleTryAcquireCapabilityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleReleaseCapabilityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleRequiresCapabilityAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleDeprecatedAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleNoSanitizeAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static void handleNoSanitizeSpecificAttr (Sema &S, Decl *D, const AttributeList &Attr)
 
static bool handleCommonAttributeFeatures (Sema &S, Scope *scope, Decl *D, const AttributeList &Attr)
 
static void ProcessDeclAttribute (Sema &S, Scope *scope, Decl *D, const AttributeList &Attr, bool IncludeCXX11Attributes)
 
static void checkUnusedDeclAttributes (Sema &S, const AttributeList *A)
 
static bool isForbiddenTypeAllowed (Sema &S, Decl *decl)
 Is the given declaration allowed to use a forbidden type? More...
 
static void handleDelayedForbiddenType (Sema &S, DelayedDiagnostic &diag, Decl *decl)
 Handle a delayed forbidden-type diagnostic. More...
 
static bool isDeclDeprecated (Decl *D)
 
static bool isDeclUnavailable (Decl *D)
 
static void DoEmitAvailabilityWarning (Sema &S, Sema::AvailabilityDiagnostic K, Decl *Ctx, const NamedDecl *D, StringRef Message, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass, const ObjCPropertyDecl *ObjCProperty, bool ObjCPropertyAccess)
 
static void handleDelayedAvailabilityCheck (Sema &S, DelayedDiagnostic &DD, Decl *Ctx)
 

Enumeration Type Documentation

Enumerator
CFStringFormat 
NSStringFormat 
StrftimeFormat 
SupportedFormat 
IgnoredFormat 
InvalidFormat 

Definition at line 2530 of file SemaDeclAttr.cpp.

Function Documentation

static bool attrNonNullArgCheck ( Sema S,
QualType  T,
const AttributeList Attr,
SourceRange  AttrParmRange,
SourceRange  TypeRange,
bool  isReturnValue = false 
)
static
static bool checkAcquireOrderAttrCommon ( Sema S,
Decl D,
const AttributeList Attr,
SmallVectorImpl< Expr * > &  Args 
)
static
static void checkAttrArgsAreCapabilityObjs ( Sema S,
Decl D,
const AttributeList Attr,
SmallVectorImpl< Expr * > &  Args,
int  Sidx = 0,
bool  ParamIdxOk = false 
)
static
static bool checkAttributeAtLeastNumArgs ( Sema S,
const AttributeList Attr,
unsigned  Num 
)
static
static bool checkAttributeAtMostNumArgs ( Sema S,
const AttributeList Attr,
unsigned  Num 
)
static

Check if the attribute has at most as many args as Num. May output an error.

Definition at line 208 of file SemaDeclAttr.cpp.

References checkAttributeNumArgsImpl().

Referenced by handleCommonAttributeFeatures(), and handleLaunchBoundsAttr().

static bool checkAttributeNumArgs ( Sema S,
const AttributeList Attr,
unsigned  Num 
)
static
template<typename Compare >
static bool checkAttributeNumArgsImpl ( Sema S,
const AttributeList Attr,
unsigned  Num,
unsigned  Diag,
Compare  Comp 
)
static
template<typename AttrTy >
static bool checkAttrMutualExclusion ( Sema S,
Decl D,
const AttributeList Attr 
)
static

Diagnose mutually exclusive attributes when present on a given declaration. Returns true if diagnosed.

Definition at line 247 of file SemaDeclAttr.cpp.

References clang::Sema::Diag(), clang::Decl::getAttr(), clang::AttributeList::getLoc(), and clang::AttributeList::getName().

static bool checkAvailabilityAttr ( Sema S,
SourceRange  Range,
IdentifierInfo Platform,
VersionTuple  Introduced,
VersionTuple  Deprecated,
VersionTuple  Obsoleted 
)
static
static bool checkForConsumableClass ( Sema S,
const CXXMethodDecl MD,
const AttributeList Attr 
)
static
static bool checkFunctionOrMethodParameterIndex ( Sema S,
const Decl D,
const AttributeList Attr,
unsigned  AttrArgNum,
const Expr IdxExpr,
uint64_t &  Idx 
)
static
static bool checkGuardedByAttrCommon ( Sema S,
Decl D,
const AttributeList Attr,
Expr *&  Arg 
)
static

Definition at line 586 of file SemaDeclAttr.cpp.

References checkAttrArgsAreCapabilityObjs().

Referenced by handleGuardedByAttr(), and handlePtGuardedByAttr().

static bool checkIBOutletCommon ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static bool checkLaunchBoundsArgument ( Sema S,
Expr E,
const CUDALaunchBoundsAttr &  Attr,
const unsigned  Idx 
)
static
static bool checkLockFunAttrCommon ( Sema S,
Decl D,
const AttributeList Attr,
SmallVectorImpl< Expr * > &  Args 
)
static
static bool checkRecordTypeForCapability ( Sema S,
QualType  Ty 
)
static
static bool checkTryLockFunAttrCommon ( Sema S,
Decl D,
const AttributeList Attr,
SmallVectorImpl< Expr * > &  Args 
)
static
static bool checkTypedefTypeForCapability ( QualType  Ty)
static

Definition at line 445 of file SemaDeclAttr.cpp.

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

Referenced by typeHasCapability().

static bool checkUInt32Argument ( Sema S,
const AttributeList Attr,
const Expr Expr,
uint32_t &  Val,
unsigned  Idx = UINT_MAX 
)
static
static void checkUnusedDeclAttributes ( Sema S,
const AttributeList A 
)
static
static void DoEmitAvailabilityWarning ( Sema S,
Sema::AvailabilityDiagnostic  K,
Decl Ctx,
const NamedDecl D,
StringRef  Message,
SourceLocation  Loc,
const ObjCInterfaceDecl UnknownObjCClass,
const ObjCPropertyDecl ObjCProperty,
bool  ObjCPropertyAccess 
)
static
static FormatAttrKind getFormatAttrKind ( StringRef  Format)
static

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

Definition at line 2541 of file SemaDeclAttr.cpp.

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

Referenced by handleFormatAttr().

static unsigned getFunctionOrMethodNumParams ( const Decl D)
static

getFunctionOrMethodNumParams - Return number of function or method parameters. It is an error to call this on a K&R function (use hasFunctionProto first).

Definition at line 81 of file SemaDeclAttr.cpp.

References clang::Decl::getFunctionType().

Referenced by checkFunctionOrMethodParameterIndex(), handleFormatAttr(), and handleNonNullAttr().

static SourceRange getFunctionOrMethodParamRange ( const Decl D,
unsigned  Idx 
)
static

Definition at line 98 of file SemaDeclAttr.cpp.

Referenced by handleFormatArgAttr(), handleFormatAttr(), and handleNonNullAttr().

static QualType getFunctionOrMethodParamType ( const Decl D,
unsigned  Idx 
)
static
static SourceRange getFunctionOrMethodResultSourceRange ( const Decl D)
static
static QualType getFunctionOrMethodResultType ( const Decl D)
static
static unsigned getNumAttributeArgs ( const AttributeList Attr)
static
static const RecordType* getRecordType ( QualType  QT)
static
static void handleAcquireCapabilityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAcquiredAfterAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAcquiredBeforeAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAliasAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAlignedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAlignValueAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAlwaysInlineAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAMDGPUNumSGPRAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAMDGPUNumVGPRAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAnalyzerNoReturnAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAnnotateAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleArgumentWithTypeTagAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleARMInterruptAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAssertCapabilityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAssertExclusiveLockAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAssertSharedLockAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAssumeAlignedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
template<typename AttrTy >
static void handleAttrWithMessage ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleAvailabilityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleBlocksAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleCallableWhenAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleCallConvAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleCapabilityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleCFAuditedTransferAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleCFUnknownTransferAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleCleanupAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleColdAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleCommonAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static bool handleCommonAttributeFeatures ( Sema S,
Scope scope,
Decl D,
const AttributeList Attr 
)
static
static void handleConstructorAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleConsumableAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleDeclspecThreadAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleDelayedAvailabilityCheck ( Sema S,
DelayedDiagnostic DD,
Decl Ctx 
)
static
static void handleDelayedForbiddenType ( Sema S,
DelayedDiagnostic diag,
Decl decl 
)
static
static void handleDependencyAttr ( Sema S,
Scope Scope,
Decl D,
const AttributeList Attr 
)
static
static void handleDeprecatedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleDestructorAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleDLLAttr ( Sema S,
Decl D,
const AttributeList A 
)
static
static void handleEnableIfAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleExclusiveTrylockFunctionAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleExtVectorTypeAttr ( Sema S,
Scope scope,
Decl D,
const AttributeList Attr 
)
static
static void handleFormatArgAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleFormatAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleGlobalAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleGNUInlineAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleGuardedByAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleHotAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleIBOutlet ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleIBOutletCollection ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleInitPriorityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleInterruptAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleLaunchBoundsAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleLockReturnedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleLocksExcludedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleMinSizeAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleModeAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleMSInheritanceAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleMSP430InterruptAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleNoDebugAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleNonNullAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleNonNullAttrParameter ( Sema S,
ParmVarDecl D,
const AttributeList Attr 
)
static
static void handleNoReturnAttr ( Sema S,
Decl D,
const AttributeList attr 
)
static
static void handleNoSanitizeAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleNoSanitizeSpecificAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleNSConsumedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleNSReturnsRetainedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCBoxable ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCBridgeAttr ( Sema S,
Scope Sc,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCBridgeMutableAttr ( Sema S,
Scope Sc,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCBridgeRelatedAttr ( Sema S,
Scope Sc,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCDesignatedInitializer ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCIndependentClass ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCMethodFamilyAttr ( Sema S,
Decl decl,
const AttributeList Attr 
)
static
static void handleObjCNSObject ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCOwnershipAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCPreciseLifetimeAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCRequiresSuperAttr ( Sema S,
Decl D,
const AttributeList attr 
)
static
static void handleObjCReturnsInnerPointerAttr ( Sema S,
Decl D,
const AttributeList attr 
)
static
static void handleObjCRuntimeName ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleObjCSuppresProtocolAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleOptimizeNoneAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleOwnershipAttr ( Sema S,
Decl D,
const AttributeList AL 
)
static
static void handlePackedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleParamTypestateAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handlePtGuardedByAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handlePtGuardedVarAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleReleaseCapabilityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleRequiresCapabilityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleRestrictAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleReturnsNonNullAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleReturnTypestateAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleSectionAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleSentinelAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleSetTypestateAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleSharedTrylockFunctionAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
template<typename AttrType >
static void handleSimpleAttribute ( Sema S,
Decl D,
const AttributeList Attr 
)
static

Applies the given attribute to the Decl without performing any additional semantic checking.

Definition at line 344 of file SemaDeclAttr.cpp.

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

static void handleTargetAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleTestTypestateAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleTLSModelAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleTransparentUnionAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleTryAcquireCapabilityAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleTypeTagForDatatypeAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleUsedAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleUuidAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleVecReturnAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleVecTypeHint ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleVisibilityAttr ( Sema S,
Decl D,
const AttributeList Attr,
bool  isTypeVisibility 
)
static
static void handleWarnUnusedResult ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleWeakImportAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleWeakRefAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
template<typename WorkGroupAttr >
static void handleWorkGroupSize ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static void handleX86ForceAlignArgPointerAttr ( Sema S,
Decl D,
const AttributeList Attr 
)
static
static bool hasDeclarator ( const Decl D)
static

Return true if the given decl has a declarator that should have been processed by Sema::GetTypeForDeclarator.

Definition at line 63 of file SemaDeclAttr.cpp.

Referenced by handleCallConvAttr(), handleNoReturnAttr(), handleNSReturnsRetainedAttr(), and handleObjCOwnershipAttr().

static bool hasFunctionProto ( const Decl D)
static

hasFunctionProto - Return true if the given decl has a argument information. This decl should have already passed isFunctionOrMethod or isFunctionOrMethodOrBlock.

Definition at line 72 of file SemaDeclAttr.cpp.

References clang::Decl::getFunctionType().

Referenced by checkFunctionOrMethodParameterIndex(), and handleArgumentWithTypeTagAttr().

static bool isCapabilityExpr ( Sema S,
const Expr Ex 
)
static
static bool isCFStringType ( QualType  T,
ASTContext Ctx 
)
inlinestatic
static bool isDeclDeprecated ( Decl D)
static
static bool isDeclUnavailable ( Decl D)
static
static bool isForbiddenTypeAllowed ( Sema S,
Decl decl 
)
static

Is the given declaration allowed to use a forbidden type?

Definition at line 5302 of file SemaDeclAttr.cpp.

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

Referenced by handleDelayedForbiddenType().

static bool isFunctionOrMethod ( const Decl D)
static

isFunctionOrMethod - Return true if the given decl has function type (function or function-typed variable) or an Objective-C method.

Definition at line 52 of file SemaDeclAttr.cpp.

References clang::Decl::getFunctionType().

Referenced by GetFullTypeForDeclarator(), handleArgumentWithTypeTagAttr(), handleNoDebugAttr(), handleUsedAttr(), isFunctionOrMethodOrBlock(), and LookupVisibleDecls().

static bool isFunctionOrMethodOrBlock ( const Decl D)
static

Return true if the given decl has function type (function or function-typed variable) or an Objective-C method or a block.

Definition at line 57 of file SemaDeclAttr.cpp.

References isFunctionOrMethod().

Referenced by checkFunctionOrMethodParameterIndex(), and handleAnalyzerNoReturnAttr().

static bool isFunctionOrMethodVariadic ( const Decl D)
static
static bool isInstanceMethod ( const Decl D)
static
static bool isIntOrBool ( Expr Exp)
static

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

Definition at line 351 of file SemaDeclAttr.cpp.

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

Referenced by checkTryLockFunAttrCommon().

static bool isNSStringType ( QualType  T,
ASTContext Ctx 
)
inlinestatic
static bool isValidSubjectOfCFAttribute ( Sema S,
QualType  type 
)
static
static bool isValidSubjectOfNSAttribute ( Sema S,
QualType  type 
)
static
static bool isValidSubjectOfNSReturnsRetainedAttribute ( QualType  type)
static
template<class T >
static T* mergeVisibilityAttr ( Sema S,
Decl D,
SourceRange  range,
typename T::VisibilityType  value,
unsigned  attrSpellingListIndex 
)
static
static void ProcessDeclAttribute ( Sema S,
Scope scope,
Decl D,
const AttributeList Attr,
bool  IncludeCXX11Attributes 
)
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 4571 of file SemaDeclAttr.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::AttributeList::existsInTarget(), clang::AttributeList::getKind(), clang::AttributeList::getLoc(), clang::AttributeList::getName(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), handleAcquireCapabilityAttr(), handleAcquiredAfterAttr(), handleAcquiredBeforeAttr(), handleAliasAttr(), handleAlignedAttr(), handleAlignValueAttr(), handleAlwaysInlineAttr(), handleAMDGPUNumSGPRAttr(), handleAMDGPUNumVGPRAttr(), handleAnalyzerNoReturnAttr(), handleAnnotateAttr(), handleArgumentWithTypeTagAttr(), handleAssertCapabilityAttr(), handleAssertExclusiveLockAttr(), handleAssertSharedLockAttr(), handleAssumeAlignedAttr(), handleAvailabilityAttr(), handleBlocksAttr(), handleCallableWhenAttr(), handleCallConvAttr(), handleCapabilityAttr(), handleCFAuditedTransferAttr(), handleCFUnknownTransferAttr(), handleCleanupAttr(), handleColdAttr(), handleCommonAttr(), handleCommonAttributeFeatures(), handleConstructorAttr(), handleConsumableAttr(), handleDeclspecThreadAttr(), handleDependencyAttr(), handleDeprecatedAttr(), handleDestructorAttr(), handleDLLAttr(), handleEnableIfAttr(), handleExclusiveTrylockFunctionAttr(), handleExtVectorTypeAttr(), handleFormatArgAttr(), handleFormatAttr(), handleGlobalAttr(), handleGNUInlineAttr(), handleGuardedByAttr(), handleHotAttr(), handleIBOutlet(), handleIBOutletCollection(), handleInitPriorityAttr(), handleInterruptAttr(), handleLaunchBoundsAttr(), handleLockReturnedAttr(), handleLocksExcludedAttr(), handleMinSizeAttr(), handleModeAttr(), handleMSInheritanceAttr(), handleNoDebugAttr(), handleNonNullAttr(), handleNonNullAttrParameter(), handleNoReturnAttr(), handleNoSanitizeAttr(), handleNoSanitizeSpecificAttr(), handleNSConsumedAttr(), handleNSReturnsRetainedAttr(), handleObjCBoxable(), handleObjCBridgeAttr(), handleObjCBridgeMutableAttr(), handleObjCBridgeRelatedAttr(), handleObjCDesignatedInitializer(), handleObjCIndependentClass(), handleObjCMethodFamilyAttr(), handleObjCNSObject(), handleObjCOwnershipAttr(), handleObjCPreciseLifetimeAttr(), handleObjCRequiresSuperAttr(), handleObjCReturnsInnerPointerAttr(), handleObjCRuntimeName(), handleObjCSuppresProtocolAttr(), handleOptimizeNoneAttr(), handleOwnershipAttr(), handlePackedAttr(), handleParamTypestateAttr(), handlePtGuardedByAttr(), handlePtGuardedVarAttr(), handleReleaseCapabilityAttr(), handleRequiresCapabilityAttr(), handleRestrictAttr(), handleReturnsNonNullAttr(), handleReturnTypestateAttr(), handleSectionAttr(), handleSentinelAttr(), handleSetTypestateAttr(), handleSharedTrylockFunctionAttr(), handleTargetAttr(), handleTestTypestateAttr(), handleTLSModelAttr(), handleTransparentUnionAttr(), handleTryAcquireCapabilityAttr(), handleTypeTagForDatatypeAttr(), handleUsedAttr(), handleUuidAttr(), handleVecReturnAttr(), handleVecTypeHint(), handleVisibilityAttr(), handleWarnUnusedResult(), handleWeakImportAttr(), handleWeakRefAttr(), handleX86ForceAlignArgPointerAttr(), clang::AttributeList::IgnoredAttribute, clang::AttributeList::isCXX11Attribute(), clang::AttributeList::isDeclspecAttribute(), clang::AttributeList::isInvalid(), clang::AttributeList::isTypeAttr(), S, and clang::AttributeList::UnknownAttribute.

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

static bool threadSafetyCheckIsPointer ( Sema S,
const Decl D,
const AttributeList Attr 
)
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 376 of file SemaDeclAttr.cpp.

References clang::Sema::Diag(), clang::Type::getAs(), clang::AttributeList::getLoc(), clang::AttributeList::getName(), clang::ValueDecl::getType(), and threadSafetyCheckIsSmartPointer().

Referenced by handlePtGuardedByAttr(), and handlePtGuardedVarAttr().

static bool threadSafetyCheckIsSmartPointer ( Sema S,
const RecordType RT 
)
static
static bool typeHasCapability ( Sema S,
QualType  Ty 
)
static
static 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 1807 of file SemaDeclAttr.cpp.

References clang::VersionTuple::empty().

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