clang  5.0.0svn
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
clang::Decl Class Reference

Decl - This represents one declaration (or definition), e.g. More...

#include <DeclBase.h>

Inheritance diagram for clang::Decl:
Inheritance graph
[legend]
Collaboration diagram for clang::Decl:
Collaboration graph
[legend]

Classes

struct  EmptyShell
 A placeholder type used to construct an empty shell of a decl-derived type that will be filled in later (e.g., by some deserialization method). More...
 
class  redecl_iterator
 Iterates through all the redeclarations of the same decl. More...
 

Public Types

enum  Kind
 Lists the kind of concrete classes of Decl. More...
 
enum  IdentifierNamespace {
  IDNS_Label = 0x0001, IDNS_Tag = 0x0002, IDNS_Type = 0x0004, IDNS_Member = 0x0008,
  IDNS_Namespace = 0x0010, IDNS_Ordinary = 0x0020, IDNS_ObjCProtocol = 0x0040, IDNS_OrdinaryFriend = 0x0080,
  IDNS_TagFriend = 0x0100, IDNS_Using = 0x0200, IDNS_NonMemberOperator = 0x0400, IDNS_LocalExtern = 0x0800,
  IDNS_OMPReduction = 0x1000
}
 IdentifierNamespace - The different namespaces in which declarations may appear. More...
 
enum  ObjCDeclQualifier {
  OBJC_TQ_None = 0x0, OBJC_TQ_In = 0x1, OBJC_TQ_Inout = 0x2, OBJC_TQ_Out = 0x4,
  OBJC_TQ_Bycopy = 0x8, OBJC_TQ_Byref = 0x10, OBJC_TQ_Oneway = 0x20, OBJC_TQ_CSNullability = 0x40
}
 ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declarations. More...
 
enum  FriendObjectKind { FOK_None, FOK_Declared, FOK_Undeclared }
 
typedef AttrVec::const_iterator attr_iterator
 
typedef llvm::iterator_range< attr_iteratorattr_range
 
typedef llvm::iterator_range< redecl_iteratorredecl_range
 

Public Member Functions

virtual SourceRange getSourceRange () const LLVM_READONLY
 Source range that this declaration covers. More...
 
SourceLocation getLocStart () const LLVM_READONLY
 
SourceLocation getLocEnd () const LLVM_READONLY
 
SourceLocation getLocation () const
 
void setLocation (SourceLocation L)
 
Kind getKind () const
 
const char * getDeclKindName () const
 
DeclgetNextDeclInContext ()
 
const DeclgetNextDeclInContext () const
 
DeclContextgetDeclContext ()
 
const DeclContextgetDeclContext () const
 
DeclgetNonClosureContext ()
 Find the innermost non-closure ancestor of this declaration, walking up through blocks, lambdas, etc. More...
 
const DeclgetNonClosureContext () const
 
TranslationUnitDeclgetTranslationUnitDecl ()
 
const TranslationUnitDeclgetTranslationUnitDecl () const
 
bool isInAnonymousNamespace () const
 
bool isInStdNamespace () const
 
ASTContextgetASTContext () const LLVM_READONLY
 
void setAccess (AccessSpecifier AS)
 
AccessSpecifier getAccess () const
 
AccessSpecifier getAccessUnsafe () const
 Retrieve the access specifier for this declaration, even though it may not yet have been properly set. More...
 
bool hasAttrs () const
 
void setAttrs (const AttrVec &Attrs)
 
AttrVecgetAttrs ()
 
const AttrVecgetAttrs () const
 
void dropAttrs ()
 
void addAttr (Attr *A)
 
attr_range attrs () const
 
attr_iterator attr_begin () const
 
attr_iterator attr_end () const
 
template<typename T >
void dropAttr ()
 
template<typename T >
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs () const
 
template<typename T >
specific_attr_iterator< T > specific_attr_begin () const
 
template<typename T >
specific_attr_iterator< T > specific_attr_end () const
 
template<typename T >
T * getAttr () const
 
template<typename T >
bool hasAttr () const
 
unsigned getMaxAlignment () const
 getMaxAlignment - return the maximum alignment specified by attributes on this decl, 0 if there are none. More...
 
void setInvalidDecl (bool Invalid=true)
 setInvalidDecl - Indicates the Decl had a semantic error. More...
 
bool isInvalidDecl () const
 
bool isImplicit () const
 isImplicit - Indicates whether the declaration was implicitly generated by the implementation. More...
 
void setImplicit (bool I=true)
 
bool isUsed (bool CheckUsedAttr=true) const
 Whether any (re-)declaration of the entity was used, meaning that a definition is required. More...
 
void setIsUsed ()
 Set whether the declaration is used, in the sense of odr-use. More...
 
void markUsed (ASTContext &C)
 Mark the declaration used, in the sense of odr-use. More...
 
bool isReferenced () const
 Whether any declaration of this entity was referenced. More...
 
bool isThisDeclarationReferenced () const
 Whether this declaration was referenced. More...
 
void setReferenced (bool R=true)
 
bool isTopLevelDeclInObjCContainer () const
 Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition. More...
 
void setTopLevelDeclInObjCContainer (bool V=true)
 
bool isModulePrivate () const
 Whether this declaration was marked as being private to the module in which it was defined. More...
 
bool isExported () const
 Whether this declaration is exported (by virtue of being lexically within an ExportDecl or by being a NamespaceDecl). More...
 
bool hasDefiningAttr () const
 Return true if this declaration has an attribute which acts as definition of the entity, such as 'alias' or 'ifunc'. More...
 
const AttrgetDefiningAttr () const
 Return this declaration's defining attribute if it has one. More...
 
AvailabilityResult getAvailability (std::string *Message=nullptr, VersionTuple EnclosingVersion=VersionTuple()) const
 Determine the availability of the given declaration. More...
 
bool isDeprecated (std::string *Message=nullptr) const
 Determine whether this declaration is marked 'deprecated'. More...
 
bool isUnavailable (std::string *Message=nullptr) const
 Determine whether this declaration is marked 'unavailable'. More...
 
bool isWeakImported () const
 Determine whether this is a weak-imported symbol. More...
 
bool canBeWeakImported (bool &IsDefinition) const
 Determines whether this symbol can be weak-imported, e.g., whether it would be well-formed to add the weak_import attribute. More...
 
bool isFromASTFile () const
 Determine whether this declaration came from an AST file (such as a precompiled header or module) rather than having been parsed. More...
 
unsigned getGlobalID () const
 Retrieve the global declaration ID associated with this declaration, which specifies where this Decl was loaded from. More...
 
unsigned getOwningModuleID () const
 Retrieve the global ID of the module that owns this particular declaration. More...
 
ModulegetImportedOwningModule () const
 Get the imported owning module, if this decl is from an imported (non-local) module. More...
 
ModulegetLocalOwningModule () const
 Get the local owning module, if known. More...
 
void setLocalOwningModule (Module *M)
 
unsigned getIdentifierNamespace () const
 
bool isInIdentifierNamespace (unsigned NS) const
 
bool hasTagIdentifierNamespace () const
 
DeclContextgetLexicalDeclContext ()
 getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC). More...
 
const DeclContextgetLexicalDeclContext () const
 
virtual bool isOutOfLine () const
 Determine whether this declaration is declared out of line (outside its semantic context). More...
 
void setDeclContext (DeclContext *DC)
 setDeclContext - Set both the semantic and lexical DeclContext to DC. More...
 
void setLexicalDeclContext (DeclContext *DC)
 
bool isDefinedOutsideFunctionOrMethod () const
 isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside the current function or method. More...
 
bool isLexicallyWithinFunctionOrMethod () const
 Returns true if this declaration lexically is inside a function. More...
 
const DeclContextgetParentFunctionOrMethod () const
 If this decl is defined inside a function/method/block it returns the corresponding DeclContext, otherwise it returns null. More...
 
DeclContextgetParentFunctionOrMethod ()
 
virtual DeclgetCanonicalDecl ()
 Retrieves the "canonical" declaration of the given declaration. More...
 
const DeclgetCanonicalDecl () const
 
bool isCanonicalDecl () const
 Whether this particular Decl is a canonical one. More...
 
redecl_range redecls () const
 Returns an iterator range for all the redeclarations of the same decl. More...
 
redecl_iterator redecls_begin () const
 
redecl_iterator redecls_end () const
 
DeclgetPreviousDecl ()
 Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration. More...
 
const DeclgetPreviousDecl () const
 Retrieve the most recent declaration that declares the same entity as this declaration, or NULL if there is no previous declaration. More...
 
bool isFirstDecl () const
 True if this is the first declaration in its redeclaration chain. More...
 
DeclgetMostRecentDecl ()
 Retrieve the most recent declaration that declares the same entity as this declaration (which may be this declaration). More...
 
const DeclgetMostRecentDecl () const
 Retrieve the most recent declaration that declares the same entity as this declaration (which may be this declaration). More...
 
virtual StmtgetBody () const
 getBody - If this Decl represents a declaration for a body of code, such as a function or method definition, this method returns the top-level Stmt* of that body. More...
 
virtual bool hasBody () const
 Returns true if this Decl represents a declaration for a body of code, such as a function or method definition. More...
 
SourceLocation getBodyRBrace () const
 getBodyRBrace - Gets the right brace of the body, if a body exists. More...
 
bool isTemplateParameter () const
 isTemplateParameter - Determines whether this declaration is a template parameter. More...
 
bool isTemplateParameterPack () const
 isTemplateParameter - Determines whether this declaration is a template parameter pack. More...
 
bool isParameterPack () const
 Whether this declaration is a parameter pack. More...
 
bool isTemplateDecl () const
 returns true if this declaration is a template More...
 
bool isFunctionOrFunctionTemplate () const
 Whether this declaration is a function or function template. More...
 
TemplateDeclgetDescribedTemplate () const
 If this is a declaration that describes some template, this method returns that template declaration. More...
 
FunctionDeclgetAsFunction () LLVM_READONLY
 Returns the function itself, or the templated function if this is a function template. More...
 
const FunctionDeclgetAsFunction () const
 
void setLocalExternDecl ()
 Changes the namespace of this declaration to reflect that it's a function-local extern declaration. More...
 
bool isLocalExternDecl ()
 Determine whether this is a block-scope declaration with linkage. More...
 
void setObjectOfFriendDecl (bool PerformFriendInjection=false)
 Changes the namespace of this declaration to reflect that it's the object of a friend declaration. More...
 
FriendObjectKind getFriendObjectKind () const
 Determines whether this declaration is the object of a friend declaration and, if so, what kind. More...
 
void setNonMemberOperator ()
 Specifies that this declaration is a C++ overloaded non-member. More...
 
void print (raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
 
void print (raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0, bool PrintInstantiation=false) const
 
void dump () const
 
void dumpColor () const
 
void dump (raw_ostream &Out, bool Deserialize=false) const
 
const FunctionTypegetFunctionType (bool BlocksToo=true) const
 Looks through the Decl's underlying type to extract a FunctionType when possible. More...
 

Static Public Member Functions

static unsigned getIdentifierNamespaceForKind (Kind DK)
 
static bool isTagIdentifierNamespace (unsigned NS)
 
static void add (Kind k)
 
static void EnableStatistics ()
 
static void PrintStats ()
 
static bool classofKind (Kind K)
 
static DeclContextcastToDeclContext (const Decl *)
 
static DeclcastFromDeclContext (const DeclContext *)
 
static void printGroup (Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
 

Protected Types

enum  { TopLevelDeclInObjCContainerFlag = 0x01, ModulePrivateFlag = 0x02 }
 

Protected Member Functions

void * operator new (std::size_t Size, const ASTContext &Ctx, unsigned ID, std::size_t Extra=0)
 Allocate memory for a deserialized declaration. More...
 
void * operator new (std::size_t Size, const ASTContext &Ctx, DeclContext *Parent, std::size_t Extra=0)
 Allocate memory for a non-deserialized declaration. More...
 
 Decl (Kind DK, DeclContext *DC, SourceLocation L)
 
 Decl (Kind DK, EmptyShell Empty)
 
virtual ~Decl ()
 
void updateOutOfDate (IdentifierInfo &II) const
 Update a potentially out-of-date declaration. More...
 
Linkage getCachedLinkage () const
 
void setCachedLinkage (Linkage L) const
 
bool hasCachedLinkage () const
 
void setModulePrivate (bool MP=true)
 Specify whether this declaration was marked as being private to the module in which it was defined. More...
 
void setOwningModuleID (unsigned ID)
 Set the owning module ID. More...
 
bool hasLocalOwningModuleStorage () const
 
virtual DeclgetNextRedeclarationImpl ()
 Returns the next redeclaration or itself if this is the only decl. More...
 
virtual DeclgetPreviousDeclImpl ()
 Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain. More...
 
virtual DeclgetMostRecentDeclImpl ()
 Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain. More...
 
ASTMutationListenergetASTMutationListener () const
 

Protected Attributes

llvm::PointerIntPair< Decl *, 2, unsignedNextInContextAndBits
 The next declaration within the same lexical DeclContext. More...
 
unsigned Access: 2
 Access - Used by C++ decls for the access specifier. More...
 
unsigned FromASTFile: 1
 Whether this declaration was loaded from an AST file. More...
 
unsigned Hidden: 1
 Whether this declaration is hidden from normal name lookup, e.g., because it is was loaded from an AST file is either module-private or because its submodule has not been made visible. More...
 
unsigned IdentifierNamespace: 13
 IdentifierNamespace - This specifies what IDNS_* namespace this lives in. More...
 
unsigned CacheValidAndLinkage: 3
 If 0, we have not computed the linkage of this declaration. More...
 

Friends

class DeclContext
 
class CXXClassMemberWrapper
 
class ASTDeclWriter
 
class ASTDeclReader
 
class ASTReader
 
class LinkageComputer
 
template<typename decl_type >
class Redeclarable
 

Detailed Description

Decl - This represents one declaration (or definition), e.g.

a variable, typedef, function, struct, etc.

Note: There are objects tacked on before the beginning of Decl (and its subclasses) in its Decl::operator new(). Proper alignment of all subclasses (not requiring more than the alignment of Decl) is asserted in DeclBase.cpp.

Definition at line 80 of file DeclBase.h.

Member Typedef Documentation

◆ attr_iterator

typedef AttrVec::const_iterator clang::Decl::attr_iterator

Definition at line 459 of file DeclBase.h.

◆ attr_range

typedef llvm::iterator_range<attr_iterator> clang::Decl::attr_range

Definition at line 460 of file DeclBase.h.

◆ redecl_range

typedef llvm::iterator_range<redecl_iterator> clang::Decl::redecl_range

Definition at line 838 of file DeclBase.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
TopLevelDeclInObjCContainerFlag 

Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition.

ModulePrivateFlag 

Whether this declaration is private to the module in which it was defined.

Definition at line 206 of file DeclBase.h.

◆ FriendObjectKind

Enumerator
FOK_None 

Not a friend object.

FOK_Declared 

A friend of a previously-declared entity.

FOK_Undeclared 

A friend of a previously-undeclared entity.

Definition at line 991 of file DeclBase.h.

◆ IdentifierNamespace

IdentifierNamespace - The different namespaces in which declarations may appear.

According to C99 6.2.3, there are four namespaces, labels, tags, members and ordinary identifiers. C++ describes lookup completely differently: certain lookups merely "ignore" certain kinds of declarations, usually based on whether the declaration is of a type, etc.

These are meant as bitmasks, so that searches in C++ can look into the "tag" namespace during ordinary lookup.

Decl currently provides 15 bits of IDNS bits.

Enumerator
IDNS_Label 

Labels, declared with 'x:' and referenced with 'goto x'.

IDNS_Tag 

Tags, declared with 'struct foo;' and referenced with 'struct foo'.

All tags are also types. This is what elaborated-type-specifiers look for in C. This also contains names that conflict with tags in the same scope but that are otherwise ordinary names (non-type template parameters and indirect field declarations).

IDNS_Type 

Types, declared with 'struct foo', typedefs, etc.

This is what elaborated-type-specifiers look for in C++, but note that it's ill-formed to find a non-tag.

IDNS_Member 

Members, declared with object declarations within tag definitions.

In C, these can only be found by "qualified" lookup in member expressions. In C++, they're found by normal lookup.

IDNS_Namespace 

Namespaces, declared with 'namespace foo {}'.

Lookup for nested-name-specifiers find these.

IDNS_Ordinary 

Ordinary names.

In C, everything that's not a label, tag, member, or function-local extern ends up here.

IDNS_ObjCProtocol 

Objective C @protocol.

IDNS_OrdinaryFriend 

This declaration is a friend function.

A friend function declaration is always in this namespace but may also be in IDNS_Ordinary if it was previously declared.

IDNS_TagFriend 

This declaration is a friend class.

A friend class declaration is always in this namespace but may also be in IDNS_Tag|IDNS_Type if it was previously declared.

IDNS_Using 

This declaration is a using declaration.

A using declaration introduces a number of other declarations into the current scope, and those declarations use the IDNS of their targets, but the actual using declarations go in this namespace.

IDNS_NonMemberOperator 

This declaration is a C++ operator declared in a non-class context.

All such operators are also in IDNS_Ordinary. C++ lexical operator lookup looks for these.

IDNS_LocalExtern 

This declaration is a function-local extern declaration of a variable or function.

This may also be IDNS_Ordinary if it has been declared outside any function. These act mostly like invisible friend declarations, but are also visible to unqualified lookup within the scope of the declaring function.

IDNS_OMPReduction 

This declaration is an OpenMP user defined reduction construction.

Definition at line 109 of file DeclBase.h.

◆ Kind

Lists the kind of concrete classes of Decl.

Definition at line 83 of file DeclBase.h.

◆ ObjCDeclQualifier

ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declarations.

Other than remembering them and mangling them into the method's signature string, these are ignored by the compiler; they are consumed by certain remote-messaging frameworks.

in, inout, and out are mutually exclusive and apply only to method parameters. bycopy and byref are mutually exclusive and apply only to method parameters (?). oneway applies only to results. All of these expect their corresponding parameter to have a particular type. None of this is currently enforced by clang.

This should be kept in sync with ObjCDeclSpec::ObjCDeclQualifier.

Enumerator
OBJC_TQ_None 
OBJC_TQ_In 
OBJC_TQ_Inout 
OBJC_TQ_Out 
OBJC_TQ_Bycopy 
OBJC_TQ_Byref 
OBJC_TQ_Oneway 
OBJC_TQ_CSNullability 

The nullability qualifier is set when the nullability of the result or parameter was expressed via a context-sensitive keyword.

Definition at line 189 of file DeclBase.h.

Constructor & Destructor Documentation

◆ Decl() [1/2]

clang::Decl::Decl ( Kind  DK,
DeclContext DC,
SourceLocation  L 
)
inlineprotected

◆ Decl() [2/2]

clang::Decl::Decl ( Kind  DK,
EmptyShell  Empty 
)
inlineprotected

Definition at line 347 of file DeclBase.h.

◆ ~Decl()

Decl::~Decl ( )
protectedvirtual

Definition at line 260 of file DeclBase.cpp.

Member Function Documentation

◆ add()

void Decl::add ( Kind  k)
static

Definition at line 170 of file DeclBase.cpp.

Referenced by hasMRCWeakIvars().

◆ addAttr()

void clang::Decl::addAttr ( Attr A)
inline

◆ attr_begin()

attr_iterator clang::Decl::attr_begin ( ) const
inline

Definition at line 466 of file DeclBase.h.

◆ attr_end()

attr_iterator clang::Decl::attr_end ( ) const
inline

Definition at line 469 of file DeclBase.h.

◆ attrs()

attr_range clang::Decl::attrs ( ) const
inline

◆ canBeWeakImported()

bool Decl::canBeWeakImported ( bool IsDefinition) const

Determines whether this symbol can be weak-imported, e.g., whether it would be well-formed to add the weak_import attribute.

Parameters
IsDefinitionSet to true to indicate that this declaration cannot be weak-imported because it has a definition.

Definition at line 570 of file DeclBase.cpp.

References getASTContext(), clang::ASTContext::getLangOpts(), clang::ObjCRuntime::hasWeakClassImport(), and clang::LangOptions::ObjCRuntime.

Referenced by isWeakImported().

◆ castFromDeclContext()

Decl * Decl::castFromDeclContext ( const DeclContext D)
static

◆ castToDeclContext()

DeclContext * Decl::castToDeclContext ( const Decl D)
static

Definition at line 779 of file DeclBase.cpp.

References getKind().

Referenced by clang::BackendConsumer::StackSizeDiagHandler().

◆ classofKind()

static bool clang::Decl::classofKind ( Kind  K)
inlinestatic

Definition at line 1017 of file DeclBase.h.

References dump().

◆ dropAttr()

template<typename T >
void clang::Decl::dropAttr ( )
inline

◆ dropAttrs()

void Decl::dropAttrs ( )

Definition at line 748 of file DeclBase.cpp.

References clang::ASTContext::eraseDeclAttrs(), and getASTContext().

◆ dump() [1/2]

LLVM_DUMP_METHOD void Decl::dump ( ) const

◆ dump() [2/2]

LLVM_DUMP_METHOD void Decl::dump ( raw_ostream &  Out,
bool  Deserialize = false 
) const

Definition at line 2516 of file ASTDumper.cpp.

References P.

◆ dumpColor()

LLVM_DUMP_METHOD void Decl::dumpColor ( ) const

Definition at line 2523 of file ASTDumper.cpp.

References P.

◆ EnableStatistics()

void Decl::EnableStatistics ( )
static

Definition at line 142 of file DeclBase.cpp.

◆ getAccess()

AccessSpecifier clang::Decl::getAccess ( ) const
inline

◆ getAccessUnsafe()

AccessSpecifier clang::Decl::getAccessUnsafe ( ) const
inline

Retrieve the access specifier for this declaration, even though it may not yet have been properly set.

Definition at line 438 of file DeclBase.h.

◆ getAsFunction() [1/2]

FunctionDecl * Decl::getAsFunction ( )

◆ getAsFunction() [2/2]

const FunctionDecl* clang::Decl::getAsFunction ( ) const
inline

Definition at line 925 of file DeclBase.h.

◆ getASTContext()

ASTContext & Decl::getASTContext ( ) const

Definition at line 332 of file DeclBase.cpp.

References clang::TranslationUnitDecl::getASTContext(), and getTranslationUnitDecl().

Referenced by clang::DeclContext::addHiddenDecl(), clang::CXXMethodDecl::addOverriddenMethod(), clang::CloneDetector::analyzeCodeBody(), clang::CXXMethodDecl::begin_overridden_methods(), canBeWeakImported(), clang::VarDecl::checkInitIsICE(), computeLVForDecl(), clang::ObjCObjectType::computeSuperClassTypeSlow(), clang::DeclRefExpr::DeclRefExpr(), dropAttrs(), clang::CXXMethodDecl::end_overridden_methods(), clang::VarDecl::ensureEvaluatedStmt(), evaluateCDTSize(), clang::VarDecl::evaluateValue(), findDirectBaseWithType(), findUntaggedStructOrUnionIndex(), formatBlockPlaceholder(), FormatFunctionParameter(), clang::index::CodegenNameGenerator::Implementation::getAllManglings(), clang::TypedefNameDecl::getAnonDeclWithTypedefName(), clang::AnalysisDeclContext::getASTContext(), getASTMutationListener(), getAttrs(), getAvailability(), clang::FunctionDecl::getBody(), clang::FunctionDecl::getClassScopeSpecializationPattern(), clang::VarDecl::getDescribedVarTemplate(), clang::CXXRecordDecl::getLambdaCallOperator(), clang::CXXRecordDecl::getLambdaStaticInvoker(), clang::LinkageComputer::getLVForDecl(), getMaxAlignment(), clang::VarDecl::getMemberSpecializationInfo(), clang::FunctionDecl::getMinRequiredArguments(), clang::getParameterABISpelling(), clang::OMPDeclareReductionDecl::getPrevDeclInScope(), clang::getPrimaryMergedDecl(), clang::NamedDecl::getQualifiedNameAsString(), clang::FunctionDecl::getReturnTypeSourceRange(), getSelfInitExpr(), clang::VarDecl::getTLSKind(), getTypeInfoVTable(), getVisibilityOf(), clang::CXXRecordDecl::getVisibleConversionFunctions(), hasLocalOwningModuleStorage(), clang::ASTImporter::Imported(), clang::ento::CheckerContext::isCLibraryFunction(), isImportedDeclContext(), clang::Type::isIncompleteType(), clang::RecordDecl::isMsStruct(), clang::ParmVarDecl::isParameterPack(), clang::Expr::isPotentialConstantExpr(), clang::Expr::isPotentialConstantExprUnevaluated(), clang::FunctionDecl::isReplaceableGlobalAllocationFunction(), isSameEntity(), clang::ASTNodeImporter::IsStructuralMatch(), clang::CXXRecordDecl::isTriviallyCopyable(), isWeakImported(), isZeroSized(), clang::VarTemplateDecl::LoadLazySpecializations(), clang::CXXMethodDecl::overridden_methods(), clang::NamedDecl::printQualifiedName(), clang::FunctionTemplateSpecializationInfo::Profile(), clang::CXXRecordDecl::removeConversion(), clang::CXXRecordDecl::setBases(), clang::RecordDecl::setCapturedRecord(), clang::VarDecl::setDescribedVarTemplate(), clang::MaterializeTemporaryExpr::setExtendingDecl(), clang::CXXRecordDecl::setInstantiationOfMemberClass(), clang::VarDecl::setInstantiationOfStaticDataMember(), setLexicalDeclContext(), SetNestedNameSpecifier(), clang::BlockDecl::setParams(), clang::DeclaratorDecl::setQualifierInfo(), clang::TagDecl::setQualifierInfo(), shouldRunOnFunctionOrMethod(), clang::CXXMethodDecl::size_overridden_methods(), clang::TagDecl::startDefinition(), updateOutOfDate(), and useInlineVisibilityHidden().

◆ getASTMutationListener()

ASTMutationListener * Decl::getASTMutationListener ( ) const
protected

◆ getAttr()

template<typename T >
T* clang::Decl::getAttr ( ) const
inline

Definition at line 498 of file DeclBase.h.

Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnStartOfFunctionDef(), clang::Sema::AddParameterABIAttr(), AddVariableConstraints(), clang::consumed::ConsumedStmtVisitor::checkCallability(), clang::Sema::CheckIfOverriddenFunctionIsMarkedFinal(), clang::Sema::CheckOverrideControl(), clang::consumed::ConsumedStateMap::checkParamsForReturnTypestate(), classifyPointerDeclarator(), clang::CodeGen::CodeGenModule::ConstructAttributeList(), copyAttrIfPresent(), clang::Sema::DiagnoseSentinelCalls(), clang::CodeGen::CodeGenFunction::EmitAutoVarCleanups(), clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit(), EmitGlobalNamedRegister(), clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(), extractRegisterName(), getCallingConventionForDecl(), clang::getDLLAttr(), clang::CodeGen::CodeGenModule::getFunctionFeatureMap(), getNonNullAttr(), getOpenCLArgAccess(), clang::index::getSymbolInfo(), clang::FunctionDecl::getUnusedResultAttr(), getVisibilityOf(), clang::CodeGen::CodeGenModule::GetWeakRefReference(), clang::consumed::ConsumedStmtVisitor::handleCall(), clang::CodeGen::CodeGenModule::HandleCXXStaticMemberVarInstantiation(), hasIdenticalPassObjectSizeAttrs(), clang::MangleContext::mangleName(), mapConsumableAttrState(), MaybeAddSentinel(), clang::CodeGen::CodeGenModule::maybeSetTrivialComdat(), clang::Sema::mergeAlwaysInlineAttr(), clang::Sema::mergeDeclAttributes(), clang::Sema::mergeDLLExportAttr(), clang::Sema::mergeMinSizeAttr(), clang::Sema::mergeMSInheritanceAttr(), clang::Sema::mergeOptimizeNoneAttr(), clang::Sema::mergeSectionAttr(), clang::Sema::mergeUuidAttr(), clang::consumed::ConsumedStateMap::operator!=(), clang::Sema::ProcessPropertyDecl(), recordUsesEBO(), clang::CodeGen::CodeGenModule::setAliasAttributes(), clang::CodeGen::CodeGenModule::setTLSMode(), clang::Sema::ShouldDiagnoseAvailabilityOfDecl(), clang::CodeGen::CodeGenFunction::StartFunction(), testsFor(), clang::Sema::UnifySection(), clang::consumed::ConsumedStmtVisitor::VisitCXXConstructExpr(), and clang::consumed::ConsumedStmtVisitor::VisitParmVarDecl().

◆ getAttrs() [1/2]

AttrVec& clang::Decl::getAttrs ( )
inline

◆ getAttrs() [2/2]

const AttrVec & Decl::getAttrs ( ) const

Definition at line 755 of file DeclBase.cpp.

References getASTContext(), and clang::ASTContext::getDeclAttrs().

◆ getAvailability()

AvailabilityResult Decl::getAvailability ( std::string *  Message = nullptr,
VersionTuple  EnclosingVersion = VersionTuple() 
) const

Determine the availability of the given declaration.

This routine will determine the most restrictive availability of the given declaration (e.g., preferring 'unavailable' to 'deprecated').

Parameters
MessageIf non-NULL and the result is not AR_Available, will be set to a (possibly empty) message describing why the declaration has not been introduced, is deprecated, or is unavailable.
EnclosingVersionThe version to compare with. If empty, assume the deployment target version.

Definition at line 523 of file DeclBase.cpp.

References clang::AR_Available, clang::AR_Deprecated, clang::AR_Unavailable, attrs(), CheckAvailability(), getASTContext(), and clang::Result.

Referenced by clang::Sema::addMethodToGlobalList(), clang::Sema::CanUseDecl(), getDeclAvailability(), clang::Sema::getDeletedOrUnavailableSuffix(), and clang::Sema::ShouldDiagnoseAvailabilityOfDecl().

◆ getBody()

virtual Stmt* clang::Decl::getBody ( ) const
inlinevirtual

◆ getBodyRBrace()

SourceLocation Decl::getBodyRBrace ( ) const

getBodyRBrace - Gets the right brace of the body, if a body exists.

This works whether the body is a CompoundStmt or a CXXTryStmt.

Definition at line 798 of file DeclBase.cpp.

References Access, clang::AS_none, getBody(), getDeclContext(), clang::SourceRange::getEnd(), clang::FunctionDecl::getSourceRange(), and isInvalidDecl().

Referenced by clang::ento::PathDiagnosticLocation::createDeclEnd(), and clang::CodeGen::CodeGenFunction::GenerateObjCMethod().

◆ getCachedLinkage()

Linkage clang::Decl::getCachedLinkage ( ) const
inlineprotected

◆ getCanonicalDecl() [1/2]

virtual Decl* clang::Decl::getCanonicalDecl ( )
inlinevirtual

Retrieves the "canonical" declaration of the given declaration.

Reimplemented in clang::UnresolvedUsingTypenameDecl, clang::UnresolvedUsingValueDecl, clang::UsingPackDecl, clang::UsingDecl, clang::EnumDecl, clang::VarTemplateDecl, clang::UsingShadowDecl, clang::TagDecl, clang::NamespaceAliasDecl, clang::TypedefNameDecl, clang::IndirectFieldDecl, clang::EnumConstantDecl, clang::CXXConversionDecl, clang::FieldDecl, clang::CXXDestructorDecl, clang::CXXConstructorDecl, clang::TypeAliasTemplateDecl, clang::ObjCProtocolDecl, clang::ClassTemplateDecl, clang::FunctionDecl, clang::CXXMethodDecl, clang::ObjCInterfaceDecl, clang::VarDecl, clang::FunctionTemplateDecl, clang::RedeclarableTemplateDecl, clang::CXXRecordDecl, clang::NamespaceDecl, and clang::ObjCMethodDecl.

Definition at line 772 of file DeclBase.h.

Referenced by clang::Sema::ActOnOpenMPDeclareSimdDirective(), clang::Sema::ActOnOpenMPDeclareTargetName(), CheckTemplateArgumentPointerToMember(), compareDeclarations(), clang::declaresSameEntity(), DeduceNonTypeTemplateArgument(), DiagnoseSelfAssignment(), clang::Sema::DiagnoseSelfMove(), clang::Sema::DiagnoseUseOfDecl(), clang::CodeGen::CGDebugInfo::EmitGlobalVariable(), clang::ADLResult::erase(), clang::ASTReader::forEachImportedKeyDecl(), getCanonicalDecl(), getCanonicalParmVarDecl(), clang::ASTContext::getCanonicalTemplateArgument(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getCommentForDecl(), clang::DeclarationNameTable::getCXXDeductionGuideName(), getDeclForLocalLookup(), getDeclForMerging(), clang::ASTWriter::getFirstLocalDecl(), clang::CXXInstanceCall::getInitialStackFrameContents(), clang::ASTReader::getKeyDeclaration(), clang::ASTDeclReader::getMostRecentDecl(), clang::CallGraph::getOrInsertNode(), clang::VTableContextBase::getThunkInfo(), hasRecursiveCallInPath(), HasSameBase(), clang::ADLResult::insert(), clang::Sema::CodeSynthesisContext::isInstantiationRecord(), clang::OverloadCandidateSet::isNewCandidate(), isSameDeclaration(), isSameTemplate(), IsStructurallyEquivalent(), isUsed(), clang::ASTDeclWriter::RegisterTemplateSpecialization(), clang::ASTDeclReader::UpdateDecl(), clang::ASTDeclReader::Visit(), and wasDifferentDeclUsedForInlining().

◆ getCanonicalDecl() [2/2]

const Decl* clang::Decl::getCanonicalDecl ( ) const
inline

Definition at line 773 of file DeclBase.h.

References getCanonicalDecl().

◆ getDeclContext() [1/2]

DeclContext* clang::Decl::getDeclContext ( )
inline

Definition at line 396 of file DeclBase.h.

Referenced by clang::Sema::ActOnConversionDeclarator(), clang::Sema::ActOnCXXEnterDeclInitializer(), clang::Sema::ActOnFinishObjCImplementation(), clang::Sema::ActOnStartOfObjCMethodDef(), addAssociatedClassesAndNamespaces(), clang::Sema::AddMethodCandidate(), clang::Sema::addMethodToGlobalList(), addOrSubLValueAsInteger(), clang::CodeGen::CodeGenTypes::addRecordTypeName(), addRedeclaredMethods(), adjustParent(), clang::Sema::BuildVariableInstantiation(), clang::Sema::BuildVarTemplateInstantiation(), clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::CheckConstructor(), clang::Sema::CheckCXXDefaultArgExpr(), checkDeclInTargetContext(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckDependentFunctionTemplateSpecialization(), CheckExplicitInstantiationScope(), clang::Sema::CheckFunctionTemplateSpecialization(), clang::Sema::checkInitMethod(), clang::Sema::CheckLiteralOperatorDeclaration(), clang::Sema::CheckObjCMethodOverride(), clang::Sema::CheckObjCMethodOverrides(), CheckOperatorNewDeleteDeclarationScope(), clang::Sema::CheckShadow(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplatePartialSpecializationArgs(), CheckTemplateSpecializationScope(), clang::Sema::CheckUsingShadowDecl(), clang::Sema::checkVarDeclRedefinition(), collectOverriddenMethodsSlow(), clang::ASTReader::CompleteRedeclChain(), computeCachedProperties(), computeDeclRefDependence(), computeLVForDecl(), clang::CodeCompletionResult::CreateCodeCompletionString(), clang::TypeName::createNestedNameSpecifier(), clang::TypeName::createNestedNameSpecifierForScopeOf(), clang::TypeName::createOuterNNS(), clang::NamedDecl::declarationReplaces(), clang::Sema::DeclareImplicitDeductionGuides(), clang::ASTContext::DeclMustBeEmitted(), DiagnoseBaseOrMemInitializerOrder(), diagnoseInstanceReference(), clang::Sema::DiagnoseOwningPropertyGetterSynthesis(), clang::Sema::DiagnoseShadowingLambdaDecls(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(), clang::CodeGen::CGDebugInfo::EmitGlobalVariable(), clang::CodeGen::CGDebugInfo::EmitImportDecl(), clang::CodeGen::CGDebugInfo::EmitNamespaceAlias(), clang::CodeGen::CodeGenModule::EmitTopLevelDecl(), clang::CodeGen::CGDebugInfo::EmitUsingDirective(), evaluateVarDeclInit(), FilterMethodsByTypeBound(), findBackingIvar(), FindDeclaringClass(), findDirectBaseWithType(), findExplicitInstancetypeDeclarer(), clang::Sema::FindInstantiatedDecl(), findUntaggedStructOrUnionIndex(), FormatFunctionParameter(), getAsDeclContextOrEnclosing(), getAssignmentAction(), getBodyRBrace(), getContextForScopeMatching(), getDeclAvailability(), getDeclForLocalLookup(), getDeclForMerging(), clang::getDeclUsageType(), getFieldIndex(), getLVForClassMember(), getLVForClosure(), getLVForNamespaceScopeDecl(), clang::CodeGen::CGCXXABI::getMemberPointerPathAdjustment(), getMethodReceiverIfKnownImmutable(), clang::ASTContext::getObjContainingInterface(), getOutermostFuncOrBlockContext(), clang::ObjCMethodDecl::getOverriddenMethods(), clang::Sema::getOwningModule(), clang::getParameterABISpelling(), getParentFunctionOrMethod(), getReturnTypeForMethod(), clang::ParmVarDecl::getSourceRange(), getStackIndexOfNearestEnclosingCaptureReadyLambda(), getStaticDeclName(), clang::MaterializeTemporaryExpr::getStorageDuration(), clang::index::getSymbolInfo(), clang::Sema::getTemplateInstantiationArgs(), getTranslationUnitDecl(), clang::ento::MemRegionManager::getVarRegion(), clang::index::IndexingContext::handleDecl(), clang::Sema::HandleDelayedAccessCheck(), hasCopyOrMoveCtorParam(), clang::Sema::hasVisibleMemberSpecialization(), hasWrittenStorageAttribute(), clang::Sema::HideUsingShadowDecl(), clang::ASTNodeImporter::ImportDeclParts(), InNamespace(), clang::Sema::InstantiateAttrs(), clang::TemplateDeclInstantiator::InstantiateEnumDefinition(), clang::Sema::InstantiateFunctionDefinition(), clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl(), clang::Sema::InstantiateVariableDefinition(), clang::Sema::InstantiateVariableInitializer(), clang::ento::CheckerContext::isCLibraryFunction(), isConsumerInterestedIn(), isDebuggingContext(), isDeclWithinFunction(), clang::TemplateArgument::isDependent(), IsDisallowedCopyOrAssign(), clang::Sema::isFunctionConsideredUnavailable(), isFunctionLocalClass(), clang::FunctionDecl::isGlobal(), isInAnonymousNamespace(), clang::LambdaExpr::isInitCapture(), clang::RecordDecl::isInjectedClassName(), clang::TemplateArgument::isInstantiationDependent(), clang::AnalysisDeclContext::isInStdNamespace(), isInStdNamespace(), clang::FunctionDecl::isMain(), isMethodContextSameForKindofLookup(), isMethodDeclaredInRootProtocol(), clang::FunctionDecl::isMSVCRTEntryPoint(), clang::CodeGen::CodeGenFunction::isObjCMethodWithTypeParams(), isOutOfLine(), clang::FunctionDecl::isReplaceableGlobalAllocationFunction(), clang::FunctionDecl::isReservedGlobalPlacementOperator(), isSameEntity(), isSingleLineLanguageLinkage(), clang::Sema::isStdInitializerList(), IsStructurallyEquivalent(), IsTailPaddedMemberArray(), isTemplate(), isTrackedVar(), clang::ODRHash::isWhitelistedDecl(), IsWithinTemplateSpecialization(), LookupMemberExpr(), clang::DeclContext::makeDeclVisibleInContext(), clang::MangleContext::mangleObjCMethodNameWithoutSize(), clang::Sema::MarkFunctionReferenced(), clang::Sema::mergeObjCMethodDecls(), MightInstantiateTo(), clang::Sema::PerformObjectMemberConversion(), clang::Sema::PrintInstantiationStack(), clang::NamedDecl::printQualifiedName(), RecordModifiableNonNullParam(), clang::tooling::replaceNestedName(), setLexicalDeclContext(), clang::CodeGen::CGDebugInfo::setLocation(), clang::ObjCMethodDecl::setMethodParams(), clang::FunctionDecl::setPure(), shouldConsiderLinkage(), ShouldDiagnoseUnusedDecl(), shouldIgnoreDueToReservedName(), clang::Sema::shouldLinkDependentDeclWithPrevious(), clang::Sema::ShouldWarnIfUnusedFileScopedDecl(), SubstDefaultTemplateArgument(), clang::Sema::SubstParmVarDecl(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), clang::IdentifierResolver::tryAddTopLevelDecl(), clang::Sema::tryCaptureVariable(), clang::Sema::updateOutOfDateSelector(), ValidDuplicateEnum(), clang::ASTNodeImporter::VisitAccessSpecDecl(), clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(), clang::ASTDeclWriter::VisitDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTNodeImporter::VisitFriendDecl(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), clang::ASTNodeImporter::VisitLinkageSpecDecl(), clang::ASTNodeImporter::VisitObjCCategoryImplDecl(), clang::ASTNodeImporter::VisitObjCImplementationDecl(), clang::ASTDeclWriter::VisitObjCIvarDecl(), clang::ASTNodeImporter::VisitObjCPropertyImplDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTNodeImporter::VisitStaticAssertDecl(), clang::ASTDeclWriter::VisitTypedefDecl(), clang::ASTDeclWriter::VisitVarDecl(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().

◆ getDeclContext() [2/2]

const DeclContext* clang::Decl::getDeclContext ( ) const
inline

Definition at line 401 of file DeclBase.h.

References getNonClosureContext().

◆ getDeclKindName()

const char * Decl::getDeclKindName ( ) const

◆ getDefiningAttr()

const Attr * Decl::getDefiningAttr ( ) const

Return this declaration's defining attribute if it has one.

Definition at line 410 of file DeclBase.cpp.

◆ getDescribedTemplate()

TemplateDecl * Decl::getDescribedTemplate ( ) const

If this is a declaration that describes some template, this method returns that template declaration.

Definition at line 209 of file DeclBase.cpp.

Referenced by getDescribedTemplate().

◆ getFriendObjectKind()

FriendObjectKind clang::Decl::getFriendObjectKind ( ) const
inline

◆ getFunctionType()

const FunctionType * Decl::getFunctionType ( bool  BlocksToo = true) const

◆ getGlobalID()

unsigned clang::Decl::getGlobalID ( ) const
inline

Retrieve the global declaration ID associated with this declaration, which specifies where this Decl was loaded from.

Definition at line 659 of file DeclBase.h.

Referenced by clang::ASTWriter::getDeclID(), and clang::ASTWriter::GetDeclRef().

◆ getIdentifierNamespace()

unsigned clang::Decl::getIdentifierNamespace ( ) const
inline

◆ getIdentifierNamespaceForKind()

unsigned Decl::getIdentifierNamespaceForKind ( Kind  DK)
static

◆ getImportedOwningModule()

Module* clang::Decl::getImportedOwningModule ( ) const
inline

Get the imported owning module, if this decl is from an imported (non-local) module.

Definition at line 681 of file DeclBase.h.

Referenced by clang::Sema::getOwningModule(), clang::ASTReader::getOwningModuleNameForDiagnostic(), isConsumerInterestedIn(), and clang::ASTReader::mergeDefinitionVisibility().

◆ getKind()

Kind clang::Decl::getKind ( ) const
inline

Definition at line 390 of file DeclBase.h.

Referenced by clang::ODRHash::AddDecl(), clang::CodeGen::CodeGenModule::AddDeferredUnusedCoverageMapping(), clang::ASTDeclReader::attachLatestDecl(), clang::ASTDeclReader::attachPreviousDecl(), clang::Sema::BuildDeclarationNameExpr(), castToDeclContext(), clang::comments::Sema::checkReturnsCommand(), clang::OMPThreadPrivateDecl::classof(), clang::TranslationUnitDecl::classof(), clang::PragmaCommentDecl::classof(), clang::AccessSpecDecl::classof(), clang::OMPDeclareReductionDecl::classof(), clang::FriendDecl::classof(), clang::PragmaDetectMismatchDecl::classof(), clang::ExternCContextDecl::classof(), clang::NamedDecl::classof(), clang::TemplateDecl::classof(), clang::LabelDecl::classof(), clang::ObjCMethodDecl::classof(), clang::NamespaceDecl::classof(), clang::ObjCTypeParamDecl::classof(), clang::ValueDecl::classof(), clang::DeclaratorDecl::classof(), clang::ObjCPropertyDecl::classof(), clang::RedeclarableTemplateDecl::classof(), clang::ObjCContainerDecl::classof(), clang::FunctionTemplateDecl::classof(), clang::TemplateTypeParmDecl::classof(), clang::VarDecl::classof(), clang::ImplicitParamDecl::classof(), clang::NonTypeTemplateParmDecl::classof(), clang::ParmVarDecl::classof(), clang::TemplateTemplateParmDecl::classof(), clang::BuiltinTemplateDecl::classof(), clang::CXXRecordDecl::classof(), clang::CXXDeductionGuideDecl::classof(), clang::DeclContext::classof(), clang::ObjCInterfaceDecl::classof(), clang::ClassTemplateSpecializationDecl::classof(), clang::ObjCIvarDecl::classof(), clang::ObjCAtDefsFieldDecl::classof(), clang::CXXMethodDecl::classof(), clang::ClassTemplatePartialSpecializationDecl::classof(), clang::ObjCProtocolDecl::classof(), clang::ClassTemplateDecl::classof(), clang::FunctionDecl::classof(), clang::ObjCCategoryDecl::classof(), clang::FriendTemplateDecl::classof(), clang::ObjCImplDecl::classof(), clang::TypeAliasTemplateDecl::classof(), clang::ObjCCategoryImplDecl::classof(), clang::CXXConstructorDecl::classof(), clang::ClassScopeFunctionSpecializationDecl::classof(), clang::CXXDestructorDecl::classof(), clang::FieldDecl::classof(), clang::EnumConstantDecl::classof(), clang::CXXConversionDecl::classof(), clang::IndirectFieldDecl::classof(), clang::ObjCImplementationDecl::classof(), clang::LinkageSpecDecl::classof(), clang::TypeDecl::classof(), clang::ObjCCompatibleAliasDecl::classof(), clang::VarTemplateSpecializationDecl::classof(), clang::TypedefNameDecl::classof(), clang::UsingDirectiveDecl::classof(), clang::TypedefDecl::classof(), clang::ObjCPropertyImplDecl::classof(), clang::TypeAliasDecl::classof(), clang::VarTemplatePartialSpecializationDecl::classof(), clang::NamespaceAliasDecl::classof(), clang::UsingShadowDecl::classof(), clang::VarTemplateDecl::classof(), clang::TagDecl::classof(), clang::ConstructorUsingShadowDecl::classof(), clang::UsingDecl::classof(), clang::UsingPackDecl::classof(), clang::EnumDecl::classof(), clang::UnresolvedUsingValueDecl::classof(), clang::RecordDecl::classof(), clang::UnresolvedUsingTypenameDecl::classof(), clang::StaticAssertDecl::classof(), clang::FileScopeAsmDecl::classof(), clang::BindingDecl::classof(), clang::DecompositionDecl::classof(), clang::MSPropertyDecl::classof(), clang::BlockDecl::classof(), clang::CapturedDecl::classof(), clang::ImportDecl::classof(), clang::ExportDecl::classof(), clang::EmptyDecl::classof(), compareDeclarations(), clang::ASTReader::CompleteRedeclChain(), computeLVForDecl(), clang::NamedDecl::declarationReplaces(), diagnoseRedundantPropertyNullability(), dumpPreviousDecl(), clang::CodeGen::CodeGenFunction::EmitDecl(), clang::CodeGen::CodeGenModule::EmitTopLevelDecl(), getAsPointeeSymbol(), clang::ObjCIvarDecl::getContainingInterface(), clang::getCursorKindForDecl(), clang::ast_type_traits::ASTNodeKind::getFromNode(), getKind(), clang::ASTDeclReader::getMostRecentDecl(), getNonClosureContext(), clang::index::getSymbolInfo(), isInstantiationOf(), clang::comments::Sema::isObjCPropertyDecl(), isSameEntity(), isSameTemplateParameter(), clang::ODRHash::isWhitelistedDecl(), clang::ASTDeclReader::markIncompleteDeclChainImpl(), MatchTemplateParameterKind(), clang::ento::CheckerManager::runCheckersOnASTDecl(), clang::RecursiveASTVisitor< CallGraph >::TraverseDecl(), clang::declvisitor::Base< declvisitor::make_ptr, ASTNodeImporter, Decl * >::Visit(), ODRDeclVisitor::Visit(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclReader::VisitRedeclarableTemplateDecl(), and clang::ASTDeclWriter::VisitVarDecl().

◆ getLexicalDeclContext() [1/2]

DeclContext* clang::Decl::getLexicalDeclContext ( )
inline

getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).

May be different from getDeclContext() (SemanticDC). e.g.:

namespace A { void f(); // SemanticDC == LexicalDC == 'namespace A' } void A::f(); // SemanticDC == namespace 'A' // LexicalDC == global namespace

Definition at line 727 of file DeclBase.h.

Referenced by clang::ASTUnit::addFileLevelDecl(), clang::DeclContext::addHiddenDecl(), clang::Sema::BuildVariableInstantiation(), clang::ASTReader::CompleteRedeclChain(), clang::DeclContext::containsDecl(), DiagUninitUse(), FindDeclaringClass(), clang::ASTWriter::getAnonymousDeclarationNumber(), getContextForScopeMatching(), getDeclForMerging(), clang::ASTWriter::getDeclID(), clang::getDeclUsageType(), clang::Sema::HandleDelayedAccessCheck(), clang::ASTNodeImporter::ImportDeclParts(), clang::index::IndexingContext::indexBody(), clang::index::IndexingContext::indexNestedNameSpecifierLoc(), clang::index::IndexingContext::indexTypeLoc(), clang::TemplateDeclInstantiator::InstantiateEnumDefinition(), clang::Sema::InstantiateVariableDefinition(), isExported(), clang::VarDecl::isInExternCContext(), clang::FunctionDecl::isInExternCContext(), clang::VarDecl::isInExternCXXContext(), clang::FunctionDecl::isInExternCXXContext(), isLexicallyWithinFunctionOrMethod(), isOutOfLine(), clang::DeclContext::makeDeclVisibleInContext(), clang::Sema::MergeVarDecl(), clang::serialization::needsAnonymousDeclarationNumber(), RedeclForcesDefC99(), clang::DeclContext::removeDecl(), setLexicalDeclContext(), clang::Sema::shouldLinkDependentDeclWithPrevious(), clang::Sema::ShouldWarnIfUnusedFileScopedDecl(), clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(), clang::ASTDeclWriter::VisitDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTNodeImporter::VisitFriendDecl(), clang::ASTNodeImporter::VisitLinkageSpecDecl(), clang::ASTNodeImporter::VisitObjCCategoryImplDecl(), clang::ASTNodeImporter::VisitObjCImplementationDecl(), clang::ASTDeclWriter::VisitObjCIvarDecl(), clang::ASTNodeImporter::VisitObjCPropertyImplDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclWriter::VisitTypedefDecl(), clang::ASTDeclWriter::VisitVarDecl(), clang::ASTDeclReader::VisitVarDeclImpl(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().

◆ getLexicalDeclContext() [2/2]

const DeclContext* clang::Decl::getLexicalDeclContext ( ) const
inline

Definition at line 732 of file DeclBase.h.

◆ getLocalOwningModule()

Module* clang::Decl::getLocalOwningModule ( ) const
inline

Get the local owning module, if known.

Returns nullptr if owner is not yet known or declaration is not from a module.

Definition at line 690 of file DeclBase.h.

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

◆ getLocation()

SourceLocation clang::Decl::getLocation ( ) const
inline

Definition at line 387 of file DeclBase.h.

Referenced by clang::Sema::ActOnCapturedRegionError(), clang::Sema::ActOnCompatibilityAlias(), clang::Sema::ActOnCompoundStmt(), clang::Sema::ActOnCXXDelete(), clang::Sema::ActOnCXXForRangeDecl(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnFinishFunctionBody(), clang::Sema::ActOnForEachDeclStmt(), clang::Sema::ActOnForwardClassDeclaration(), clang::Sema::ActOnInitializerError(), clang::Sema::ActOnLabelStmt(), clang::Sema::ActOnLambdaError(), clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnObjCForCollectionStmt(), clang::Sema::ActOnOpenMPDeclareReductionCombinerStart(), clang::Sema::ActOnOpenMPDeclareReductionDirectiveStart(), clang::Sema::ActOnOpenMPDeclareReductionInitializerStart(), clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnPureSpecifier(), clang::Sema::ActOnStartCategoryImplementation(), clang::Sema::ActOnStartCategoryInterface(), clang::Sema::ActOnStartClassImplementation(), clang::Sema::ActOnStartOfObjCMethodDef(), clang::Sema::ActOnStartProtocolInterface(), addConstexprToLambdaDeclSpecifier(), clang::ASTUnit::addFileLevelDecl(), clang::Sema::AddInitializerToDecl(), clang::CodeGen::CodeGenPGO::assignRegionCounters(), AuditedType(), clang::Sema::BuildCXXNew(), clang::Sema::BuildDeclarationNameExpr(), BuildImplicitBaseInitializer(), BuildImplicitMemberInitializer(), BuildNonArrayForRange(), clang::CodeGen::CGCXXABI::buildThisParam(), clang::Sema::BuildUnaryTransformType(), clang::Sema::BuildVariableInstantiation(), clang::ObjCMethodCall::canBeOverridenInSubclass(), clang::Sema::CheckARCMethodDecl(), clang::Sema::CheckBaseSpecifier(), clang::Sema::CheckCompletedCXXClass(), clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::CheckConditionVariable(), clang::Sema::CheckConflictingOverridingMethod(), CheckConstexprCtorInitializer(), CheckConstexprFunction(), clang::Sema::CheckConstexprFunctionBody(), clang::Sema::CheckConstexprFunctionDecl(), CheckConstexprParameterTypes(), clang::Sema::CheckCUDACall(), clang::Sema::checkCUDATargetOverload(), CheckCXX98CompatAccessibleCopy(), clang::Sema::CheckCXXDefaultArguments(), checkDeclInTargetContext(), clang::Sema::checkDeclIsAllowedInOpenMPTarget(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckDestructor(), checkDirectCallValidity(), clang::Sema::CheckEnumRedeclaration(), clang::Sema::CheckEquivalentExceptionSpec(), CheckExplicitInstantiationScope(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), clang::Sema::CheckExtraCXXDefaultArguments(), CheckForDanglingReferenceOrPointer(), clang::Sema::CheckForFunctionRedefinition(), checkForMultipleExportedDefaultConstructors(), CheckForReference(), clang::Sema::CheckFunctionTemplateSpecialization(), clang::Sema::CheckIfOverriddenFunctionIsMarkedFinal(), clang::Sema::CheckImplementationIvars(), clang::Sema::checkInitMethod(), clang::Sema::CheckLiteralOperatorDeclaration(), checkLiteralOperatorTemplateParameterList(), clang::Sema::CheckMain(), checkMemberDecomposition(), clang::Sema::checkMSInheritanceAttrOnDefinition(), clang::Sema::CheckMSVCRTEntryPoint(), clang::Sema::CheckObjCDeclScope(), clang::Sema::CheckObjCMethodOverride(), CheckOperatorNewDeclaration(), CheckOperatorNewDeleteDeclarationScope(), CheckOperatorNewDeleteTypes(), clang::Sema::CheckOverloadedOperatorDeclaration(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckOverridingFunctionAttributes(), clang::Sema::CheckOverridingFunctionExceptionSpec(), clang::Sema::checkPartialSpecializationVisibility(), clang::Sema::CheckPureMethod(), clang::Sema::checkRetainCycles(), CheckReturnStackAddr(), clang::Sema::CheckSpecializationInstantiationRedecl(), clang::Sema::CheckTemplateArgument(), CheckTemplateArgumentAddressOfObjectOrFunction(), CheckTemplateArgumentIsCompatibleWithParameter(), CheckTemplateArgumentPointerToMember(), CheckTemplateSpecializationScope(), clang::Sema::CheckTemplateTypeArgument(), CheckTrivialDefaultConstructor(), checkTrivialSubobjectCall(), checkTupleLikeDecomposition(), clang::Sema::CheckUsingShadowDecl(), clang::Sema::checkVarDeclRedefinition(), clang::Sema::CheckVariableDeclarationType(), compare(), clang::CodeGen::CGDebugInfo::completeRequiredType(), clang::CodeGen::CGDebugInfo::completeTemplateDefinition(), ConvertDeducedTemplateArgument(), clang::CodeGen::CodeGenFunction::createAtExitStub(), DeduceNullPtrTemplateArgument(), clang::Sema::DeduceReturnType(), clang::Sema::deduceVarTypeFromInitializer(), clang::Sema::DefineImplicitDestructor(), clang::Sema::DefineImplicitLambdaToFunctionPointerConversion(), clang::Sema::DefineInheritingConstructor(), clang::InitializationSequence::Diagnose(), clang::Sema::DiagnoseAbsenceOfOverrideControl(), clang::Sema::DiagnoseAmbiguousLookup(), diagnoseArityMismatch(), clang::Sema::DiagnoseAutoDeductionFailure(), clang::Sema::DiagnoseClassExtensionDupMethods(), clang::Sema::DiagnoseDuplicateIvars(), clang::Sema::diagnoseEquivalentInternalLinkageDeclarations(), DiagnoseForRangeConstVariableCopies(), clang::Sema::DiagnoseHiddenVirtualMethods(), clang::Sema::diagnoseMissingImport(), clang::Sema::DiagnoseOwningPropertyGetterSynthesis(), clang::Sema::DiagnosePropertyAccessorMismatch(), clang::Sema::DiagnosePropertyMismatch(), clang::Sema::DiagnoseSentinelCalls(), clang::Sema::DiagnoseShadowingLambdaDecls(), clang::Sema::DiagnoseTemplateParameterShadow(), DiagnoseUninitializedUse(), clang::Sema::DiagnoseUseOfDecl(), DiagUninitUse(), clang::CodeGen::CodeGenFunction::EmitAutoVarInit(), clang::CodeGen::CodeGenFunction::EmitCfiCheckFail(), emitCombinerOrInitializer(), emitCXXDestructor(), clang::CodeGen::CodeGenFunction::EmitCXXGuardedInit(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), clang::CodeGen::CGDebugInfo::EmitGlobalVariable(), clang::CodeGen::CGDebugInfo::EmitImportDecl(), clang::CodeGen::CGDebugInfo::EmitNamespaceAlias(), clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(), clang::CodeGen::CGDebugInfo::EmitUsingDirective(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::Expr::EvaluateAsInitializer(), evaluateVarDeclInit(), clang::Sema::FinalizeVarWithDestructor(), FindBaseInitializer(), findCompleteObject(), clang::Sema::findInheritingConstructor(), clang::Sema::FindProtocolDeclaration(), clang::CodeGen::CodeGenFunction::GenerateBlockFunction(), clang::CodeGen::CodeGenFunction::GenerateCode(), clang::CodeGen::CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(), clang::CodeGen::CodeGenFunction::generateDestroyHelper(), getAccessFlag(), clang::TypedefNameDecl::getAnonDeclWithTypedefName(), clang::ASTWriter::getDeclID(), GetDeclSpecTypeForDeclarator(), getInitializationLoc(), GetLocationForCandidate(), GetNSSetArgumentIndex(), clang::Sema::getOwningModule(), getPaddingDiagFromTagKind(), clang::getParameterABISpelling(), getPreviousDeclForInstantiation(), clang::ASTContext::getRawCommentForDeclNoCache(), clang::CXXCtorInitializer::getSourceLocation(), clang::FriendDecl::getSourceRange(), clang::DeclaratorDecl::getSourceRange(), clang::VarDecl::getSourceRange(), clang::ParmVarDecl::getSourceRange(), clang::TypedefDecl::getSourceRange(), clang::BlockDecl::getSourceRange(), clang::ImportDecl::getSourceRange(), getTagForRecord(), clang::ento::MemRegionManager::getVarRegion(), getVarTemplateSpecialization(), clang::CodeGen::CodeGenModule::HandleCXXStaticMemberVarInstantiation(), clang::index::IndexingContext::handleDecl(), hasDefaultSetterName(), clang::ASTNodeImporter::ImportDeclParts(), clang::ASTNodeImporter::ImportDefinition(), clang::index::IndexingContext::importedModule(), clang::index::IndexingContext::indexTopLevelDecl(), clang::Sema::inferCUDATargetForImplicitSpecialMember(), clang::Sema::inferObjCARCLifetime(), clang::Sema::InheritedConstructorInfo::InheritedConstructorInfo(), clang::Sema::InstantiateClass(), clang::TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(), clang::TemplateDeclInstantiator::InstantiateEnumDefinition(), clang::Sema::InstantiateFunctionDefinition(), clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl(), clang::TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization(), IsCXXRecordForMappable(), clang::TagTypeLoc::isDefinition(), isFunctionLocalClass(), clang::ento::CallEvent::isInSystemHeader(), clang::Expr::isPotentialConstantExpr(), IsStructurallyEquivalent(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), isTemplate(), clang::CodeGen::CodeGenModule::isTypeConstant(), LookupMethodInReceiverType(), clang::Sema::LookupSpecialMember(), LookupStdInitializerList(), lookupStdTypeTraitMember(), MatchTemplateParameterKind(), clang::Sema::maybeAddCUDAHostDeviceAttrs(), clang::Sema::MergeVarDecl(), clang::Sema::NoteDeletedFunction(), clang::Sema::NoteDeletedInheritingConstructor(), clang::Sema::NoteHiddenVirtualMethods(), NoteLValueLocation(), clang::Sema::NoteOverloadCandidate(), clang::Sema::ParseObjCSelectorExpression(), clang::Sema::PerformOpenMPImplicitIntegerConversion(), clang::Sema::ProcessPropertyDecl(), clang::Sema::propagateDLLAttrToBaseClassTemplate(), clang::TreeTransform< Derived >::RebuildDependentNameType(), clang::TreeTransform< Derived >::RebuildObjCExceptionDecl(), ReferenceDllExportedMethods(), clang::CodeGen::SanitizerMetadata::reportGlobalToASan(), ReportOriginalDSA(), rewriteToObjCInterfaceDecl(), roundUpSizeToCharAlignment(), clang::consumed::ConsumedAnalyzer::run(), clang::Sema::SetDeclDeleted(), clang::Sema::SetIvarInitializers(), clang::Sema::SetMemberAccessSpecifier(), clang::Sema::SetParamDefaultArgument(), clang::Sema::ShouldDeleteSpecialMember(), shouldIgnoreDueToReservedName(), clang::Parser::SkipMalformedDecl(), clang::Sema::SpecialMemberIsTrivial(), clang::CodeGen::CodeGenFunction::StartObjCMethod(), clang::CodeGen::CodeGenFunction::StartThunk(), clang::Sema::SubstExceptionSpec(), clang::Sema::SubstParmVarDecl(), SuggestInitializationFixit(), clang::TreeTransform< Derived >::TransformCondition(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), clang::threadSafety::SExprBuilder::translateAttrExpr(), clang::Sema::tryCaptureVariable(), clang::Sema::UnifySection(), UseNSOptionsMacro(), clang::ASTNodeImporter::VisitAccessSpecDecl(), clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(), clang::ASTDeclWriter::VisitDecl(), clang::ASTNodeImporter::VisitDecl(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), clang::ASTNodeImporter::VisitImplicitParamDecl(), clang::ASTNodeImporter::VisitLabelDecl(), clang::ASTNodeImporter::VisitLinkageSpecDecl(), clang::ASTNodeImporter::VisitNonTypeTemplateParmDecl(), clang::ASTNodeImporter::VisitObjCCategoryImplDecl(), clang::ASTNodeImporter::VisitObjCImplementationDecl(), clang::ASTNodeImporter::VisitObjCPropertyImplDecl(), clang::ASTNodeImporter::VisitObjCTypeParamDecl(), clang::ASTNodeImporter::VisitParmVarDecl(), clang::ASTNodeImporter::VisitStaticAssertDecl(), clang::ASTNodeImporter::VisitTemplateTemplateParmDecl(), clang::ASTNodeImporter::VisitTemplateTypeParmDecl(), clang::TemplateDeclInstantiator::VisitVarDecl(), clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl(), clang::TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(), warnBracedScalarInit(), clang::Sema::WarnConflictingTypedMethods(), clang::Sema::WarnExactTypedMethods(), and warnOnLifetimeExtension().

◆ getLocEnd()

SourceLocation clang::Decl::getLocEnd ( ) const
inline

◆ getLocStart()

SourceLocation clang::Decl::getLocStart ( ) const
inline

◆ getMaxAlignment()

unsigned Decl::getMaxAlignment ( ) const

getMaxAlignment - return the maximum alignment specified by attributes on this decl, 0 if there are none.

Definition at line 340 of file DeclBase.cpp.

References getASTContext(), getAttrs(), and hasAttrs().

Referenced by clang::ASTContext::getDeclAlign(), getDeclAlignIfRequired(), roundUpSizeToCharAlignment(), and clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition().

◆ getMostRecentDecl() [1/2]

Decl* clang::Decl::getMostRecentDecl ( )
inline

Retrieve the most recent declaration that declares the same entity as this declaration (which may be this declaration).

Definition at line 868 of file DeclBase.h.

Referenced by clang::ASTDeclWriter::AddFirstDeclFromEachModule(), isImportedDeclContext(), isUsed(), and clang::Sema::mergeDeclAttributes().

◆ getMostRecentDecl() [2/2]

const Decl* clang::Decl::getMostRecentDecl ( ) const
inline

Retrieve the most recent declaration that declares the same entity as this declaration (which may be this declaration).

Definition at line 872 of file DeclBase.h.

◆ getMostRecentDeclImpl()

virtual Decl* clang::Decl::getMostRecentDeclImpl ( )
inlineprotectedvirtual

Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.

Reimplemented in clang::TagDecl, clang::TypedefNameDecl, clang::FunctionDecl, and clang::VarDecl.

Definition at line 793 of file DeclBase.h.

◆ getNextDeclInContext() [1/2]

Decl* clang::Decl::getNextDeclInContext ( )
inline

◆ getNextDeclInContext() [2/2]

const Decl* clang::Decl::getNextDeclInContext ( ) const
inline

Definition at line 394 of file DeclBase.h.

◆ getNextRedeclarationImpl()

virtual Decl* clang::Decl::getNextRedeclarationImpl ( )
inlineprotectedvirtual

Returns the next redeclaration or itself if this is the only decl.

Decl subclasses that can be redeclared should override this method so that Decl::redecl_iterator can iterate over them.

Reimplemented in clang::TagDecl, clang::TypedefNameDecl, clang::FunctionDecl, and clang::VarDecl.

Definition at line 785 of file DeclBase.h.

◆ getNonClosureContext() [1/2]

Decl * Decl::getNonClosureContext ( )

Find the innermost non-closure ancestor of this declaration, walking up through blocks, lambdas, etc.

If that ancestor is not a code context (!isFunctionOrMethod()), returns null.

A declaration may be its own non-closure context.

Definition at line 887 of file DeclBase.cpp.

References getNonClosureContext().

Referenced by clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(), getNonClosureContext(), clang::CodeGen::CodeGenModule::getOrCreateStaticVarDecl(), and clang::CodeGen::CodeGenFunction::StartFunction().

◆ getNonClosureContext() [2/2]

const Decl* clang::Decl::getNonClosureContext ( ) const
inline

Definition at line 411 of file DeclBase.h.

References getNonClosureContext().

◆ getOwningModuleID()

unsigned clang::Decl::getOwningModuleID ( ) const
inline

Retrieve the global ID of the module that owns this particular declaration.

Definition at line 667 of file DeclBase.h.

Referenced by clang::CodeGen::CGDebugInfo::completeTemplateDefinition(), clang::ASTContext::GetGVALinkageForFunction(), and clang::ASTReader::mergeDefinitionVisibility().

◆ getParentFunctionOrMethod() [1/2]

const DeclContext * Decl::getParentFunctionOrMethod ( ) const

If this decl is defined inside a function/method/block it returns the corresponding DeclContext, otherwise it returns null.

Definition at line 220 of file DeclBase.cpp.

References getDeclContext(), and clang::DeclContext::isTranslationUnit().

Referenced by clang::index::isFunctionLocalSymbol().

◆ getParentFunctionOrMethod() [2/2]

DeclContext* clang::Decl::getParentFunctionOrMethod ( )
inline

Definition at line 766 of file DeclBase.h.

◆ getPreviousDecl() [1/2]

Decl* clang::Decl::getPreviousDecl ( )
inline

◆ getPreviousDecl() [2/2]

const Decl* clang::Decl::getPreviousDecl ( ) const
inline

Retrieve the most recent declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.

Definition at line 857 of file DeclBase.h.

◆ getPreviousDeclImpl()

virtual Decl* clang::Decl::getPreviousDeclImpl ( )
inlineprotectedvirtual

Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.

Reimplemented in clang::TagDecl, clang::TypedefNameDecl, clang::FunctionDecl, and clang::VarDecl.

Definition at line 789 of file DeclBase.h.

◆ getSourceRange()

virtual SourceRange clang::Decl::getSourceRange ( ) const
inlinevirtual

◆ getTranslationUnitDecl() [1/2]

TranslationUnitDecl * Decl::getTranslationUnitDecl ( )

◆ getTranslationUnitDecl() [2/2]

const TranslationUnitDecl* clang::Decl::getTranslationUnitDecl ( ) const
inline

Definition at line 416 of file DeclBase.h.

◆ hasAttr()

template<typename T >
bool clang::Decl::hasAttr ( ) const
inline

Definition at line 501 of file DeclBase.h.

Referenced by clang::Sema::ActOnFinishNamespaceDef(), clang::Sema::ActOnOpenMPDeclareTargetName(), clang::Sema::ActOnOpenMPLinearClause(), clang::Sema::ActOnPragmaWeakAlias(), clang::Sema::ActOnStartCategoryImplementation(), clang::Sema::ActOnStartClassImplementation(), clang::Sema::ActOnStartOfObjCMethodDef(), clang::Sema::AddCFAuditedAttribute(), clang::CodeGen::CodeGenModule::AddGlobalAnnotations(), clang::Sema::AddInitializerToDecl(), clang::Sema::AddOptnoneAttributeIfNoConflicts(), clang::Sema::AreMultipleMethodsInGlobalPool(), assignInheritanceModel(), AuditedType(), clang::Sema::BuildResolvedCallExpr(), clang::CodeGen::CGCXXABI::buildThisParam(), clang::CodeGen::CodeGenFunction::CanDevirtualizeMemberFunctionCall(), canRedefineFunction(), clang::Sema::CheckARCMethodDecl(), checkDeclInTargetContext(), clang::comments::Sema::checkDeprecatedCommand(), checkForIBOutlets(), clang::Sema::CheckMain(), clang::Sema::CheckObjCMethodOverride(), clang::Sema::CheckObjCPropertyAttributes(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckTransparentUnionArgumentConstraints(), checkTypedefTypeForCapability(), checkValueDeclInTarget(), clang::Sema::CheckVirtualDtorCall(), computeKeyFunction(), computeLVForDecl(), clang::CodeGen::CodeGenModule::ConstructAttributeList(), clang::CodeGen::CodeGenModule::CreateGlobalInitOrDestructFunction(), clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::Sema::CUDASetLambdaAttrs(), clang::DeclAttrsMatchCUDAMode(), clang::ASTContext::DeclMustBeEmitted(), clang::Sema::DiagnoseAbsenceOfOverrideControl(), clang::Sema::DiagnoseOwningPropertyGetterSynthesis(), DiagnoseUninitializedUse(), clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitAutoVarCleanups(), clang::CodeGen::CodeGenFunction::emitAutoVarTypeCleanup(), EmitAutoVarWithLifetime(), clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(), clang::CodeGen::CodeGenFunction::EmitFieldAnnotations(), EmitFunctionDeclPointer(), clang::CodeGen::CodeGenModule::EmitGlobal(), clang::CodeGen::CGDebugInfo::EmitGlobalVariable(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitParmDecl(), clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(), clang::CodeGen::CodeGenVTables::EmitThunks(), clang::CodeGen::CodeGenFunction::EmitVarAnnotations(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), findProtocolsWithExplicitImpls(), clang::CodeGen::CodeGenFunction::GenerateCode(), clang::CodeGen::CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(), clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(), GetAllocationSite(), clang::ento::MemRegion::getAsOffset(), clang::ASTContext::getBlockVarCopyInits(), getCallingConventionForDecl(), clang::CodeGen::CodeGenModule::getClassPointerAlignment(), clang::ASTContext::getDeclAlign(), getDeclAlignIfRequired(), clang::getDLLAttr(), clang::CodeGen::CodeGenModule::GetGlobalVarAddressSpace(), clang::CodeGen::CodeGenModule::getLLVMLinkageForDeclarator(), clang::LinkageComputer::getLVForDecl(), clang::index::getSymbolInfo(), getTypeInfoLinkage(), clang::Sema::getUndefinedButUsed(), clang::CodeGen::CodeGenModule::HandleCXXStaticMemberVarInstantiation(), hasDefaultCXXMethodCC(), hasDirectVisibilityAttribute(), clang::CodeGen::CodeGenModule::HasHiddenLTOVisibility(), clang::Expr::HasSideEffects(), clang::Sema::IdentifyCUDATarget(), clang::Sema::InstantiateAttrs(), clang::Sema::InstantiateVariableInitializer(), clang::CXXDynamicCastExpr::isAlwaysNull(), clang::ObjCInterfaceDecl::isArcWeakrefUnavailable(), isBlockVarRef(), isClassOrMethodDLLImport(), clang::Type::isIncompleteType(), isObjCReceiverType(), clang::ObjCInterfaceDecl::isObjCRequiresPropertyDefs(), isTestingFunction(), IsTransparentUnionStandardConversion(), clang::CodeGen::CodeGenModule::isTypeConstant(), IsValidIdentifier(), isVarDeclStrongDefinition(), isWeakLinkedClass(), LookThroughTransitiveAssignmentsAndCommaOperators(), clang::Sema::makeUnavailableInSystemHeader(), mangleThunkThisAdjustment(), clang::Sema::MarkFunctionReferenced(), clang::Sema::MatchTwoMethodDeclarations(), clang::Sema::maybeAddCUDAHostDeviceAttrs(), clang::CodeGen::CodeGenModule::maybeSetTrivialComdat(), clang::Sema::mergeAlwaysInlineAttr(), clang::Sema::mergeDLLExportAttr(), clang::Sema::mergeDLLImportAttr(), clang::Sema::mergeMinSizeAttr(), clang::Sema::mergeOptimizeNoneAttr(), clang::ASTContext::mergeTransparentUnionType(), clang::Sema::MergeVarDecl(), clang::ASTContext::ObjCMethodsAreEqual(), clang::consumed::ConsumedStateMap::operator!=(), clang::Sema::ProcessPropertyDecl(), RecordModifiableNonNullParam(), recordUsesEBO(), roundUpSizeToCharAlignment(), clang::CodeGen::CodeGenModule::setAliasAttributes(), clang::ASTContext::setBlockVarCopyInits(), clang::CodeGen::CodeGenModule::SetCommonAttributes(), setLinkageAndVisibilityForGV(), clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition(), shouldBeInCOMDAT(), shouldConsiderTemplateVisibility(), ShouldDiagnoseUnusedDecl(), shouldExtendReceiverForInnerPointerMessage(), clang::CodeGen::CodeGenFunction::ShouldInstrumentFunction(), clang::MangleContext::shouldMangleDeclName(), ShouldWarnAboutMissingPrototype(), clang::Sema::ShouldWarnIfUnusedFileScopedDecl(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::CodeGenFunction::StartObjCMethod(), SuggestInitializationFixit(), SymbolNameForMethod(), useFirstFieldIfTransparentUnion(), useInlineVisibilityHidden(), clang::ento::SValExplainer::VisitVarRegion(), and clang::Sema::WarnExactTypedMethods().

◆ hasAttrs()

bool clang::Decl::hasAttrs ( ) const
inline

◆ hasBody()

virtual bool clang::Decl::hasBody ( ) const
inlinevirtual

Returns true if this Decl represents a declaration for a body of code, such as a function or method definition.

Note that hasBody can also return true if any redeclaration of this Decl represents a declaration for a body of code.

Reimplemented in clang::FunctionDecl, and clang::ObjCMethodDecl.

Definition at line 885 of file DeclBase.h.

Referenced by clang::CloneDetector::analyzeCodeBody(), clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(), clang::FunctionDecl::getBody(), hasImplicitBody(), clang::CallGraph::includeInGraph(), and clang::ento::CheckerManager::runCheckersOnASTBody().

◆ hasCachedLinkage()

bool clang::Decl::hasCachedLinkage ( ) const
inlineprotected

◆ hasDefiningAttr()

bool Decl::hasDefiningAttr ( ) const

Return true if this declaration has an attribute which acts as definition of the entity, such as 'alias' or 'ifunc'.

Definition at line 406 of file DeclBase.cpp.

Referenced by clang::VarDecl::isThisDeclarationADefinition().

◆ hasLocalOwningModuleStorage()

bool Decl::hasLocalOwningModuleStorage ( ) const
protected

Definition at line 96 of file DeclBase.cpp.

References getASTContext(), and clang::ASTContext::getLangOpts().

◆ hasTagIdentifierNamespace()

bool clang::Decl::hasTagIdentifierNamespace ( ) const
inline

◆ isCanonicalDecl()

bool clang::Decl::isCanonicalDecl ( ) const
inline

◆ isDefinedOutsideFunctionOrMethod()

bool clang::Decl::isDefinedOutsideFunctionOrMethod ( ) const
inline

isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside the current function or method.

This is roughly global variables and functions, but also handles enums (which could be defined inside or outside a function etc).

Definition at line 750 of file DeclBase.h.

Referenced by clang::Sema::InstantiateClass(), clang::Sema::LookupInObjCMethod(), and LookupPotentialTypoResult().

◆ isDeprecated()

bool clang::Decl::isDeprecated ( std::string *  Message = nullptr) const
inline

Determine whether this declaration is marked 'deprecated'.

Parameters
MessageIf non-NULL and the declaration is deprecated, this will be set to the message describing why the declaration was deprecated (which may be empty).

Definition at line 624 of file DeclBase.h.

References clang::AR_Deprecated.

Referenced by clang::Sema::addMethodToGlobalList(), AuditedType(), IsCategoryNameWithDeprecatedSuffix(), IsValidIdentifier(), and UseNSOptionsMacro().

◆ isExported()

bool Decl::isExported ( ) const

Whether this declaration is exported (by virtue of being lexically within an ExportDecl or by being a NamespaceDecl).

Definition at line 390 of file DeclBase.cpp.

References getLexicalDeclContext(), clang::DeclContext::getLexicalParent(), and isModulePrivate().

◆ isFirstDecl()

bool clang::Decl::isFirstDecl ( ) const
inline

True if this is the first declaration in its redeclaration chain.

Definition at line 862 of file DeclBase.h.

◆ isFromASTFile()

bool clang::Decl::isFromASTFile ( ) const
inline

◆ isFunctionOrFunctionTemplate()

bool clang::Decl::isFunctionOrFunctionTemplate ( ) const
inline

Whether this declaration is a function or function template.

Definition at line 911 of file DeclBase.h.

References getDescribedTemplate().

Referenced by clang::VisibleDeclConsumer::includeHiddenDecls().

◆ isImplicit()

bool clang::Decl::isImplicit ( ) const
inline

isImplicit - Indicates whether the declaration was implicitly generated by the implementation.

If false, this declaration was written explicitly in the source code.

Definition at line 517 of file DeclBase.h.

Referenced by clang::CodeGen::CodeGenPGO::assignRegionCounters(), AuditedType(), clang::Sema::BuildCXXNew(), BuildImplicitMemberInitializer(), clang::Sema::buildOverloadedCallSet(), clang::Sema::CheckDestructor(), clang::Sema::CheckObjCMethodOverrides(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitCopyConstructor(), clang::InitializationSequence::Diagnose(), clang::Sema::DiagnoseAbsenceOfOverrideControl(), diagnoseDeprecatedCopyOperation(), clang::CodeGen::CGDebugInfo::EmitFunctionDecl(), clang::CXXRecordDecl::finishedDefaultedOrDeletedMember(), clang::ASTContext::getBuiltinVaListDecl(), getCanonicalDecl(), clang::ASTContext::getRawCommentForDeclNoCache(), hasImplicitBody(), clang::ObjCContainerDecl::HasUserDeclaredSetterMethod(), clang::Sema::IdentifyCUDATarget(), clang::ASTImporter::Imported(), clang::index::IndexingContext::importedModule(), clang::index::IndexingContext::indexDecl(), clang::TemplateDeclInstantiator::InitFunctionInstantiation(), clang::FieldDecl::isAnonymousStructOrUnion(), isFunctionLocalClass(), isImportedDeclContext(), clang::RecordDecl::isInjectedClassName(), isTrackedVar(), clang::CXXRecordDecl::isTriviallyCopyable(), IsValidIdentifier(), clang::ODRHash::isWhitelistedDecl(), clang::ObjCInterfaceDecl::lookupMethod(), RedeclForcesDefC99(), clang::Sema::ShouldDeleteSpecialMember(), clang::RecursiveASTVisitor< CallGraph >::TraverseDecl(), clang::Sema::UseArgumentDependentLookup(), clang::ASTDeclWriter::VisitDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTDeclWriter::VisitObjCIvarDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclWriter::VisitTypedefDecl(), clang::ASTDeclWriter::VisitVarDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().

◆ isInAnonymousNamespace()

bool Decl::isInAnonymousNamespace ( ) const

Definition at line 302 of file DeclBase.cpp.

References getDeclContext(), and clang::DeclContext::getParent().

◆ isInIdentifierNamespace()

bool clang::Decl::isInIdentifierNamespace ( unsigned  NS) const
inline

Definition at line 704 of file DeclBase.h.

Referenced by clang::LookupResult::getAcceptableDecl().

◆ isInStdNamespace()

bool Decl::isInStdNamespace ( ) const

◆ isInvalidDecl()

bool clang::Decl::isInvalidDecl ( ) const
inline

Definition at line 512 of file DeclBase.h.

Referenced by clang::Sema::ActOnCXXEnterDeclInitializer(), clang::Sema::ActOnCXXExitDeclInitializer(), clang::Sema::ActOnCXXTryBlock(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnFinishDelayedCXXMethodDeclaration(), clang::Sema::ActOnFinishFunctionBody(), clang::Sema::ActOnForEachDeclStmt(), clang::Sema::ActOnInitializerError(), clang::Sema::ActOnObjCAtCatchStmt(), clang::Sema::ActOnObjCForCollectionStmt(), clang::Sema::AddInitializerToDecl(), clang::Sema::AddKnownFunctionAttributes(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildDeclaratorGroup(), buildDeclareReductionRef(), BuildImplicitMemberInitializer(), clang::Sema::BuildMemberInitializer(), clang::Sema::BuildVarTemplateInstantiation(), clang::Sema::CheckCompletedCoroutineBody(), clang::Sema::CheckCompletedCXXClass(), clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::CheckConditionVariable(), CheckConstexprCtorInitializer(), CheckConstexprFunction(), clang::Sema::CheckConstructor(), clang::Sema::CheckCXXDefaultArguments(), CheckDeclInExpr(), clang::Sema::checkDeclIsAllowedInOpenMPTarget(), clang::Sema::checkInitMethod(), clang::Sema::CheckMessageArgumentTypes(), clang::Sema::CheckMSVCRTEntryPoint(), clang::Sema::CheckNontrivialField(), clang::Sema::CheckObjCPropertyAttributes(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckPureMethod(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckVariableDeclaration(), clang::Sema::CheckVariableDeclarationType(), CollectFieldInitializer(), ComputeDefaultedSpecialMemberExceptionSpec(), clang::Sema::DeduceFunctionTypeFromReturnExpr(), clang::Sema::DeduceReturnType(), clang::Sema::DeduceTemplateArguments(), clang::Sema::DeduceVariableDeclarationType(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitDestructor(), clang::Sema::DefineImplicitMoveAssignment(), clang::Sema::DefineInheritingConstructor(), clang::Sema::DiagnoseAbsenceOfOverrideControl(), clang::Sema::DiagnoseHiddenVirtualMethods(), DiagnoseReinterpretUpDownCast(), clang::Sema::DiagnoseUninstantiableTemplate(), clang::Sema::FinalizeVarWithDestructor(), findCompleteObject(), clang::Sema::FindInstantiatedDecl(), clang::ASTContext::getASTRecordLayout(), getBodyRBrace(), clang::ASTContext::getCommentForDecl(), getContainedDynamicClass(), clang::ASTContext::getDeclAlign(), clang::Sema::getOwningModule(), clang::Sema::getUndefinedButUsed(), HandleClassZeroInitialization(), HandleLValueBase(), HandleLValueDirectBase(), HandleLValueMember(), clang::Sema::InheritedConstructorInfo::InheritedConstructorInfo(), clang::Sema::InstantiateClass(), clang::Sema::InstantiateClassTemplateSpecialization(), clang::Sema::InstantiateEnum(), clang::Sema::InstantiateFunctionDefinition(), clang::Sema::InstantiateMemInitializers(), clang::Sema::InstantiateVariableDefinition(), IsCXXRecordForMappable(), clang::Sema::IsDerivedFrom(), isDesignatorAtObjectEnd(), clang::FunctionDecl::isImplicitlyInstantiable(), isNonPlacementDeallocationFunction(), clang::CXXRecordDecl::isTriviallyCopyable(), clang::Sema::LookupInObjCMethod(), clang::Sema::LookupLiteralOperator(), LookupMemberExpr(), clang::CXXRecordDecl::mayBeAbstract(), clang::Sema::MergeVarDecl(), clang::Sema::MergeVarDeclTypes(), clang::Sema::PerformPendingInstantiations(), clang::Sema::PopParsingDeclaration(), clang::Sema::ProcessPropertyDecl(), clang::TreeTransform< Derived >::RebuildUnresolvedUsingType(), clang::Sema::SetDeclDefaulted(), clang::Sema::SetIvarInitializers(), clang::ObjCMethodDecl::setMethodParams(), clang::Sema::setTagNameForLinkagePurposes(), clang::Sema::ShouldDeleteSpecialMember(), ShouldDiagnoseUnusedDecl(), ShouldWarnAboutMissingPrototype(), clang::Sema::ShouldWarnIfUnusedFileScopedDecl(), clang::Sema::SubstDecl(), clang::TemplateDeclInstantiator::SubstTemplateParams(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), TryRefInitWithConversionFunction(), clang::ASTDeclWriter::VisitDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTDeclWriter::VisitObjCIvarDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclWriter::VisitTypedefDecl(), clang::ASTDeclWriter::VisitVarDecl(), and warnBracedScalarInit().

◆ isLexicallyWithinFunctionOrMethod()

bool Decl::isLexicallyWithinFunctionOrMethod ( ) const

Returns true if this declaration lexically is inside a function.

It recognizes non-defining declarations as well as members of local classes:

void foo() { void bar(); }
void foo2() { class ABC { void bar(); }; }

Definition at line 290 of file DeclBase.cpp.

References getLexicalDeclContext(), clang::DeclContext::getLexicalParent(), and clang::DeclContext::isFunctionOrMethod().

Referenced by clang::TemplateDeclInstantiator::InitFunctionInstantiation(), and clang::Sema::SubstParmVarDecl().

◆ isLocalExternDecl()

bool clang::Decl::isLocalExternDecl ( )
inline

Determine whether this is a block-scope declaration with linkage.

This will either be a local variable declaration declared 'extern', or a local function declaration.

Definition at line 951 of file DeclBase.h.

Referenced by clang::Sema::BuildVariableInstantiation(), clang::Sema::HandleDelayedAccessCheck(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().

◆ isModulePrivate()

bool clang::Decl::isModulePrivate ( ) const
inline

◆ isOutOfLine()

bool Decl::isOutOfLine ( ) const
virtual

◆ isParameterPack()

bool Decl::isParameterPack ( ) const

Whether this declaration is a parameter pack.

Definition at line 190 of file DeclBase.cpp.

References isTemplateParameterPack().

Referenced by MatchTemplateParameterKind().

◆ isReferenced()

bool Decl::isReferenced ( ) const

◆ isTagIdentifierNamespace()

static bool clang::Decl::isTagIdentifierNamespace ( unsigned  NS)
inlinestatic

Definition at line 712 of file DeclBase.h.

◆ isTemplateDecl()

bool Decl::isTemplateDecl ( ) const

returns true if this declaration is a template

Definition at line 205 of file DeclBase.cpp.

◆ isTemplateParameter()

bool clang::Decl::isTemplateParameter ( ) const
inline

isTemplateParameter - Determines whether this declaration is a template parameter.

Definition at line 1837 of file DeclBase.h.

References getKind().

Referenced by clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::DiagnoseTemplateParameterShadow(), shouldBeHidden(), and clang::ASTDeclReader::VisitDecl().

◆ isTemplateParameterPack()

bool Decl::isTemplateParameterPack ( ) const

isTemplateParameter - Determines whether this declaration is a template parameter pack.

Definition at line 178 of file DeclBase.cpp.

Referenced by checkLiteralOperatorTemplateParameterList(), isParameterPack(), MatchTemplateParameterKind(), clang::TemplateParameterList::TemplateParameterList(), and clang::ASTDeclReader::VisitDecl().

◆ isThisDeclarationReferenced()

bool clang::Decl::isThisDeclarationReferenced ( ) const
inline

Whether this declaration was referenced.

This should not be relied upon for anything other than debugging.

Definition at line 545 of file DeclBase.h.

◆ isTopLevelDeclInObjCContainer()

bool clang::Decl::isTopLevelDeclInObjCContainer ( ) const
inline

Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition.

Definition at line 552 of file DeclBase.h.

Referenced by clang::ASTDeclWriter::VisitDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclWriter::VisitTypedefDecl(), and clang::ASTDeclWriter::VisitVarDecl().

◆ isUnavailable()

bool clang::Decl::isUnavailable ( std::string *  Message = nullptr) const
inline

Determine whether this declaration is marked 'unavailable'.

Parameters
MessageIf non-NULL and the declaration is unavailable, this will be set to the message describing why the declaration was made unavailable (which may be empty).

Definition at line 633 of file DeclBase.h.

References clang::AR_Unavailable.

Referenced by clang::Sema::addMethodToGlobalList(), and clang::Sema::isFunctionConsideredUnavailable().

◆ isUsed()

bool Decl::isUsed ( bool  CheckUsedAttr = true) const

◆ isWeakImported()

bool Decl::isWeakImported ( ) const

Determine whether this is a weak-imported symbol.

Weak-imported symbols are typically marked with the 'weak_import' attribute, but may also be marked with an 'availability' attribute where we're targing a platform prior to the introduction of this feature.

Definition at line 600 of file DeclBase.cpp.

References clang::AR_NotYetIntroduced, attrs(), canBeWeakImported(), CheckAvailability(), and getASTContext().

Referenced by clang::CodeGen::CodeGenModule::HandleCXXStaticMemberVarInstantiation(), isWeakLinkedClass(), setLinkageAndVisibilityForGV(), and SymbolNameForMethod().

◆ markUsed()

void Decl::markUsed ( ASTContext C)

◆ operator new() [1/2]

void * Decl::operator new ( std::size_t  Size,
const ASTContext Ctx,
unsigned  ID,
std::size_t  Extra = 0 
)
protected

Allocate memory for a deserialized declaration.

This routine must be used to allocate memory for any declaration that is deserialized from a module file.

Parameters
SizeThe size of the allocated object.
CtxThe context in which we will allocate memory.
IDThe global ID of the deserialized declaration.
ExtraThe amount of extra space to allocate after the object.

Definition at line 53 of file DeclBase.cpp.

◆ operator new() [2/2]

void * Decl::operator new ( std::size_t  Size,
const ASTContext Ctx,
DeclContext Parent,
std::size_t  Extra = 0 
)
protected

Allocate memory for a non-deserialized declaration.

Definition at line 73 of file DeclBase.cpp.

◆ print() [1/2]

void Decl::print ( raw_ostream &  Out,
unsigned  Indentation = 0,
bool  PrintInstantiation = false 
) const

◆ print() [2/2]

void Decl::print ( raw_ostream &  Out,
const PrintingPolicy Policy,
unsigned  Indentation = 0,
bool  PrintInstantiation = false 
) const

Definition at line 116 of file DeclPrinter.cpp.

◆ printGroup()

void Decl::printGroup ( Decl **  Begin,
unsigned  NumDecls,
raw_ostream &  Out,
const PrintingPolicy Policy,
unsigned  Indentation = 0 
)
static

Definition at line 156 of file DeclPrinter.cpp.

◆ PrintStats()

void Decl::PrintStats ( )
static

Definition at line 146 of file DeclBase.cpp.

◆ redecls()

redecl_range clang::Decl::redecls ( ) const
inline

Returns an iterator range for all the redeclarations of the same decl.

It will iterate at least once (when this decl is the only one).

Definition at line 842 of file DeclBase.h.

Referenced by compareDeclarations(), clang::Sema::DiagnoseOwningPropertyGetterSynthesis(), findAcceptableDecl(), clang::Sema::hasVisibleDeclarationSlow(), and clang::Sema::hasVisibleMemberSpecialization().

◆ redecls_begin()

redecl_iterator clang::Decl::redecls_begin ( ) const
inline

Definition at line 846 of file DeclBase.h.

◆ redecls_end()

redecl_iterator clang::Decl::redecls_end ( ) const
inline

Definition at line 849 of file DeclBase.h.

◆ setAccess()

void clang::Decl::setAccess ( AccessSpecifier  AS)
inline

◆ setAttrs()

void clang::Decl::setAttrs ( const AttrVec Attrs)
inline

Definition at line 443 of file DeclBase.h.

◆ setCachedLinkage()

void clang::Decl::setCachedLinkage ( Linkage  L) const
inlineprotected

◆ setDeclContext()

void Decl::setDeclContext ( DeclContext DC)

setDeclContext - Set both the semantic and lexical DeclContext to DC.

Definition at line 262 of file DeclBase.cpp.

Referenced by clang::Sema::SubstParmVarDecl(), and clang::ASTDeclReader::VisitDecl().

◆ setImplicit()

void clang::Decl::setImplicit ( bool  I = true)
inline

◆ setInvalidDecl()

void Decl::setInvalidDecl ( bool  Invalid = true)

setInvalidDecl - Indicates the Decl had a semantic error.

This allows for graceful error recovery.

Definition at line 109 of file DeclBase.cpp.

References clang::AS_public, and setAccess().

Referenced by clang::Sema::ActOnBaseSpecifier(), clang::Sema::ActOnCapturedRegionError(), clang::Sema::ActOnCXXForRangeDecl(), clang::Sema::ActOnFinishCXXInClassMemberInitializer(), clang::Sema::ActOnFinishFunctionBody(), clang::Sema::ActOnForEachDeclStmt(), clang::Sema::ActOnInitializerError(), clang::Sema::ActOnLambdaError(), clang::Sema::ActOnOpenMPDeclareReductionDirectiveEnd(), clang::Sema::ActOnParamDefaultArgument(), clang::Sema::ActOnParamDefaultArgumentError(), clang::Sema::ActOnStartCategoryImplementation(), clang::Sema::ActOnStartCategoryInterface(), clang::Sema::ActOnStartClassImplementation(), clang::Sema::ActOnStartOfFunctionDef(), clang::Sema::AddInitializerToDecl(), clang::Sema::BuildObjCExceptionDecl(), clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::CheckConstructor(), clang::Sema::checkCUDATargetOverload(), clang::Sema::CheckCXXDefaultArgExpr(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckForFunctionRedefinition(), clang::Sema::CheckInheritingConstructorUsingDecl(), clang::Sema::checkInitMethod(), clang::Sema::CheckMain(), clang::Sema::CheckMSVCRTEntryPoint(), clang::Sema::CheckObjCDeclScope(), clang::Sema::CheckObjCPropertyAttributes(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckUsingShadowDecl(), clang::Sema::checkVarDeclRedefinition(), CreateNewFunctionDecl(), clang::Sema::DeduceVariableDeclarationType(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), FinishForRangeVarDecl(), clang::Sema::InheritedConstructorInfo::InheritedConstructorInfo(), clang::Sema::InstantiateClass(), clang::TemplateDeclInstantiator::InstantiateEnumDefinition(), clang::Sema::InstantiateFunctionDefinition(), clang::Sema::InstantiateInClassInitializer(), clang::Sema::InstantiateMemInitializers(), clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl(), clang::Sema::InstantiateVariableInitializer(), clang::Sema::MergeVarDecl(), clang::Sema::SetDeclDeleted(), clang::Sema::SetParamDefaultArgument(), clang::Sema::SubstBaseSpecifiers(), clang::ASTDeclReader::VisitDecl(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().

◆ setIsUsed()

void clang::Decl::setIsUsed ( )
inline

Set whether the declaration is used, in the sense of odr-use.

This should only be used immediately after creating a declaration. It intentionally doesn't notify any listeners.

Definition at line 532 of file DeclBase.h.

References AttributeLangSupport::C, and getCanonicalDecl().

Referenced by clang::Sema::BuildVariableInstantiation(), clang::ASTImporter::Imported(), markUsed(), clang::Sema::MergeVarDecl(), and clang::ASTNodeImporter::VisitParmVarDecl().

◆ setLexicalDeclContext()

void Decl::setLexicalDeclContext ( DeclContext DC)

◆ setLocalExternDecl()

void clang::Decl::setLocalExternDecl ( )
inline

Changes the namespace of this declaration to reflect that it's a function-local extern declaration.

These declarations appear in the lexical context of the extern declaration, but in the semantic context of the enclosing namespace scope.

Definition at line 935 of file DeclBase.h.

References getIdentifierNamespace().

Referenced by clang::Sema::BuildVariableInstantiation(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), and clang::ASTDeclReader::VisitVarDeclImpl().

◆ setLocalOwningModule()

void clang::Decl::setLocalOwningModule ( Module M)
inline

Definition at line 695 of file DeclBase.h.

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

◆ setLocation()

void clang::Decl::setLocation ( SourceLocation  L)
inline

◆ setModulePrivate()

void clang::Decl::setModulePrivate ( bool  MP = true)
inlineprotected

Specify whether this declaration was marked as being private to the module in which it was defined.

Definition at line 585 of file DeclBase.h.

Referenced by clang::NamedDecl::setDeclName(), and clang::ASTDeclReader::VisitDecl().

◆ setNonMemberOperator()

void clang::Decl::setNonMemberOperator ( )
inline

Specifies that this declaration is a C++ overloaded non-member.

Definition at line 1010 of file DeclBase.h.

References getKind().

◆ setObjectOfFriendDecl()

void clang::Decl::setObjectOfFriendDecl ( bool  PerformFriendInjection = false)
inline

Changes the namespace of this declaration to reflect that it's the object of a friend declaration.

These declarations appear in the lexical context of the friending class, but in the semantic context of the actual entity. This property applies only to a specific decl object; other redeclarations of the same entity may not (and probably don't) share this property.

Definition at line 962 of file DeclBase.h.

References getIdentifierNamespace().

Referenced by clang::TemplateDeclInstantiator::InstantiateEnumDefinition(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().

◆ setOwningModuleID()

void clang::Decl::setOwningModuleID ( unsigned  ID)
inlineprotected

Set the owning module ID.

Definition at line 595 of file DeclBase.h.

Referenced by clang::ASTDeclReader::VisitDecl().

◆ setReferenced()

void clang::Decl::setReferenced ( bool  R = true)
inline

◆ setTopLevelDeclInObjCContainer()

void clang::Decl::setTopLevelDeclInObjCContainer ( bool  V = true)
inline

◆ specific_attr_begin()

template<typename T >
specific_attr_iterator<T> clang::Decl::specific_attr_begin ( ) const
inline

Definition at line 490 of file DeclBase.h.

◆ specific_attr_end()

template<typename T >
specific_attr_iterator<T> clang::Decl::specific_attr_end ( ) const
inline

Definition at line 494 of file DeclBase.h.

◆ specific_attrs()

template<typename T >
llvm::iterator_range<specific_attr_iterator<T> > clang::Decl::specific_attrs ( ) const
inline

◆ updateOutOfDate()

void Decl::updateOutOfDate ( IdentifierInfo II) const
protected

Update a potentially out-of-date declaration.

Definition at line 43 of file DeclBase.cpp.

References getASTContext(), clang::ASTContext::getExternalSource(), and clang::ExternalASTSource::updateOutOfDateIdentifier().

Referenced by clang::TagDecl::getDefinition().

Friends And Related Function Documentation

◆ ASTDeclReader

friend class ASTDeclReader
friend

Definition at line 309 of file DeclBase.h.

◆ ASTDeclWriter

friend class ASTDeclWriter
friend

Definition at line 308 of file DeclBase.h.

◆ ASTReader

friend class ASTReader
friend

Definition at line 310 of file DeclBase.h.

◆ CXXClassMemberWrapper

friend class CXXClassMemberWrapper
friend

Definition at line 291 of file DeclBase.h.

◆ DeclContext

friend class DeclContext
friend

Definition at line 226 of file DeclBase.h.

Referenced by isOutOfLine().

◆ LinkageComputer

friend class LinkageComputer
friend

Definition at line 311 of file DeclBase.h.

◆ Redeclarable

template<typename decl_type >
friend class Redeclarable
friend

Definition at line 313 of file DeclBase.h.

Member Data Documentation

◆ Access

unsigned clang::Decl::Access
protected

Access - Used by C++ decls for the access specifier.

Definition at line 290 of file DeclBase.h.

Referenced by getBodyRBrace().

◆ CacheValidAndLinkage

unsigned clang::Decl::CacheValidAndLinkage
mutableprotected

If 0, we have not computed the linkage of this declaration.

Otherwise, it is the linkage + 1.

Definition at line 306 of file DeclBase.h.

◆ FromASTFile

unsigned clang::Decl::FromASTFile
protected

Whether this declaration was loaded from an AST file.

Definition at line 294 of file DeclBase.h.

Referenced by clang::ASTDeclReader::VisitDecl().

◆ Hidden

unsigned clang::Decl::Hidden
protected

Whether this declaration is hidden from normal name lookup, e.g., because it is was loaded from an AST file is either module-private or because its submodule has not been made visible.

Definition at line 299 of file DeclBase.h.

Referenced by isOutOfLine(), clang::ASTReader::mergeDefinitionVisibility(), setLexicalDeclContext(), and clang::ASTDeclReader::VisitDecl().

◆ IdentifierNamespace

IdentifierNamespace - This specifies what IDNS_* namespace this lives in.

Definition at line 302 of file DeclBase.h.

◆ NextInContextAndBits

llvm::PointerIntPair<Decl *, 2, unsigned> clang::Decl::NextInContextAndBits
protected

The next declaration within the same lexical DeclContext.

These pointers form the linked list that is traversed via DeclContext's decls_begin()/decls_end().

The extra two bits are used for the TopLevelDeclInObjCContainer and ModulePrivate bits.

Definition at line 223 of file DeclBase.h.

Referenced by clang::DeclContext::containsDecl(), clang::DeclContext::isDeclInLexicalTraversal(), and clang::DeclContext::removeDecl().


The documentation for this class was generated from the following files: