clang
9.0.0svn
|
#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 415 of file SemaDeclAttr.cpp.
Referenced by appendDiagnostics().
|
static |
Definition at line 421 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 208 of file SemaDeclAttr.cpp.
|
static |
Check if the attribute has at most as many args as Num.
May output an error.
Definition at line 217 of file SemaDeclAttr.cpp.
|
static |
Check if the attribute has exactly as many args as Num.
May output an error.
Definition at line 200 of file SemaDeclAttr.cpp.
|
static |
Definition at line 187 of file SemaDeclAttr.cpp.
|
static |
Diagnose mutually exclusive attributes when present on a given declaration.
Returns true if diagnosed.
Definition at line 297 of file SemaDeclAttr.cpp.
|
static |
Definition at line 307 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 322 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 276 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 240 of file SemaDeclAttr.cpp.
|
static |
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
Definition at line 229 of file SemaDeclAttr.cpp.
Referenced by clang::AttributedStmt::getBeginLoc().
|
static |
Definition at line 232 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 87 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
static |
Definition at line 95 of file SemaDeclAttr.cpp.
Referenced by getFunctionOrMethodParamRange().
|
static |
Definition at line 115 of file SemaDeclAttr.cpp.
References getFunctionOrMethodParam().
Definition at line 106 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
static |
Definition at line 127 of file SemaDeclAttr.cpp.
Definition at line 121 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
static |
Definition at line 181 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 401 of file SemaDeclAttr.cpp.
|
static |
Definition at line 407 of file SemaDeclAttr.cpp.
Return true if the given decl has a declarator that should have been processed by Sema::GetTypeForDeclarator.
Definition at line 69 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 78 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
|
inlinestatic |
Definition at line 165 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 57 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 63 of file SemaDeclAttr.cpp.
References isFunctionOrMethod().
Definition at line 135 of file SemaDeclAttr.cpp.
References clang::Decl::getFunctionType().
Definition at line 143 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 149 of file SemaDeclAttr.cpp.
References clang::IdentifierTable::get(), clang::Type::getAs(), clang::NamedDecl::getIdentifier(), and clang::ASTContext::Idents.