clang
8.0.0
|
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.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/RecursiveASTVisitor.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/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaInternal.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MathExtras.h"
Go to the source code of this file.
Namespaces | |
AttributeLangSupport | |
Enumerations | |
enum | AttributeLangSupport::LANG { AttributeLangSupport::C, AttributeLangSupport::Cpp, AttributeLangSupport::ObjC } |
Functions | |
static bool | isFunctionOrMethod (const Decl *D) |
isFunctionOrMethod - Return true if the given decl has function type (function or function-typed variable) or an Objective-C method. More... | |
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) |
Return true if the given decl has a declarator that should have been processed by Sema::GetTypeForDeclarator. More... | |
static bool | hasFunctionProto (const Decl *D) |
hasFunctionProto - Return true if the given decl has a argument information. More... | |
static unsigned | getFunctionOrMethodNumParams (const Decl *D) |
getFunctionOrMethodNumParams - Return number of function or method parameters. More... | |
static const ParmVarDecl * | getFunctionOrMethodParam (const Decl *D, unsigned Idx) |
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 ParsedAttr &AL) |
template<typename Compare > | |
static bool | checkAttributeNumArgsImpl (Sema &S, const ParsedAttr &AL, unsigned Num, unsigned Diag, Compare Comp) |
static bool | checkAttributeNumArgs (Sema &S, const ParsedAttr &AL, unsigned Num) |
Check if the attribute has exactly as many args as Num. More... | |
static bool | checkAttributeAtLeastNumArgs (Sema &S, const ParsedAttr &AL, unsigned Num) |
Check if the attribute has at least as many args as Num. More... | |
static bool | checkAttributeAtMostNumArgs (Sema &S, const ParsedAttr &AL, unsigned Num) |
Check if the attribute has at most as many args as Num. More... | |
template<typename AttrInfo > | |
static std::enable_if< std::is_base_of< Attr, AttrInfo >::value, SourceLocation >::type | getAttrLoc (const AttrInfo &AL) |
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr. More... | |
static SourceLocation | getAttrLoc (const ParsedAttr &AL) |
template<typename AttrInfo > | |
static bool | checkUInt32Argument (Sema &S, const AttrInfo &AI, const Expr *Expr, uint32_t &Val, unsigned Idx=UINT_MAX, bool StrictlyUnsigned=false) |
If Expr is a valid integer constant, get the value of the integer expression and return success or failure. More... | |
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. More... | |
template<typename AttrTy > | |
static bool | checkAttrMutualExclusion (Sema &S, Decl *D, const ParsedAttr &AL) |
Diagnose mutually exclusive attributes when present on a given declaration. More... | |
template<typename AttrTy > | |
static bool | checkAttrMutualExclusion (Sema &S, Decl *D, const Attr &AL) |
template<typename AttrInfo > | |
static bool | checkFunctionOrMethodParameterIndex (Sema &S, const Decl *D, const AttrInfo &AI, unsigned AttrArgNum, const Expr *IdxExpr, ParamIdx &Idx, bool CanIndexImplicitThis=false) |
Check if IdxExpr is a valid parameter index for a function or instance method D. More... | |
template<typename AttrType > | |
static void | handleSimpleAttribute (Sema &S, Decl *D, SourceRange SR, unsigned SpellingIndex) |
Applies the given attribute to the Decl without performing any additional semantic checking. More... | |
template<typename AttrType > | |
static void | handleSimpleAttribute (Sema &S, Decl *D, const ParsedAttr &AL) |
template<typename... DiagnosticArgs> | |
static const Sema::SemaDiagnosticBuilder & | appendDiagnostics (const Sema::SemaDiagnosticBuilder &Bldr) |
template<typename T , typename... DiagnosticArgs> | |
static const Sema::SemaDiagnosticBuilder & | appendDiagnostics (const Sema::SemaDiagnosticBuilder &Bldr, T &&ExtraArg, DiagnosticArgs &&... ExtraArgs) |
|
static |
Definition at line 416 of file SemaDeclAttr.cpp.
Referenced by appendDiagnostics().
|
static |
Definition at line 422 of file SemaDeclAttr.cpp.
References appendDiagnostics().
|
static |
Check if the attribute has at least as many args as Num.
May output an error.
Definition at line 209 of file SemaDeclAttr.cpp.
|
static |
Check if the attribute has at most as many args as Num.
May output an error.
Definition at line 218 of file SemaDeclAttr.cpp.
|
static |
Check if the attribute has exactly as many args as Num.
May output an error.
Definition at line 201 of file SemaDeclAttr.cpp.
|
static |
Definition at line 188 of file SemaDeclAttr.cpp.
|
static |
Diagnose mutually exclusive attributes when present on a given declaration.
Returns true if diagnosed.
Definition at line 298 of file SemaDeclAttr.cpp.
|
static |
Definition at line 308 of file SemaDeclAttr.cpp.
|
static |
Check if IdxExpr is a valid parameter index for a function or instance method D.
May output an error.
Definition at line 323 of file SemaDeclAttr.cpp.
|
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 277 of file SemaDeclAttr.cpp.
|
static |
If Expr is a valid integer constant, get the value of the integer expression and return success or failure.
May output an error.
Negative argument is implicitly converted to unsigned, unless StrictlyUnsigned
is true.
Definition at line 241 of file SemaDeclAttr.cpp.
|
static |
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
Definition at line 230 of file SemaDeclAttr.cpp.
Referenced by clang::AttributedStmt::getBeginLoc().
|
static |
Definition at line 233 of file SemaDeclAttr.cpp.
References clang::ParsedAttr::getLoc().
|
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 88 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
static |
Definition at line 96 of file SemaDeclAttr.cpp.
Referenced by getFunctionOrMethodParamRange().
|
static |
Definition at line 116 of file SemaDeclAttr.cpp.
References getFunctionOrMethodParam().
Definition at line 107 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
static |
Definition at line 128 of file SemaDeclAttr.cpp.
Definition at line 122 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
static |
Definition at line 182 of file SemaDeclAttr.cpp.
References clang::ParsedAttr::getNumArgs(), and clang::ParsedAttr::hasParsedType().
|
static |
Applies the given attribute to the Decl without performing any additional semantic checking.
Definition at line 402 of file SemaDeclAttr.cpp.
|
static |
Definition at line 408 of file SemaDeclAttr.cpp.
Return true if the given decl has a declarator that should have been processed by Sema::GetTypeForDeclarator.
Definition at line 70 of file SemaDeclAttr.cpp.
hasFunctionProto - Return true if the given decl has a argument information.
This decl should have already passed isFunctionOrMethod or isFunctionOrMethodOrBlock.
Definition at line 79 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
inlinestatic |
Definition at line 166 of file SemaDeclAttr.cpp.
References clang::IdentifierTable::get(), clang::Type::getAs(), clang::NamedDecl::getIdentifier(), clang::PointerType::getPointeeType(), clang::TagDecl::getTagKind(), clang::ASTContext::Idents, and clang::TTK_Struct.
isFunctionOrMethod - Return true if the given decl has function type (function or function-typed variable) or an Objective-C method.
Definition at line 58 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
Referenced by isFunctionOrMethodOrBlock(), clang::DeclContext::isLookupContext(), and LookupVisibleDecls().
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 64 of file SemaDeclAttr.cpp.
References isFunctionOrMethod().
Definition at line 136 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
Definition at line 144 of file SemaDeclAttr.cpp.
Referenced by clang::ObjCMethodDecl::getCanonicalDecl(), clang::getCursorKindForDecl(), clang::ObjCMethodDecl::getMethodFamily(), clang::ObjCMethodDecl::isClassMethod(), and clang::ObjCMethodDecl::setMethodParams().
|
inlinestatic |
Definition at line 150 of file SemaDeclAttr.cpp.
References clang::IdentifierTable::get(), clang::Type::getAs(), clang::NamedDecl::getIdentifier(), and clang::ASTContext::Idents.