class Decl

Declaration

class Decl { /* full declaration omitted */ };

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.

Declared at: clang/include/clang/AST/DeclBase.h:83

Member Variables

protected llvm:: PointerIntPair<Decl*, 3, ModuleOwnershipKind> NextInContextAndBits
The extra three bits are used for the ModuleOwnershipKind.
private llvm::PointerUnion<DeclContext*, MultipleDC*> DeclCtx
namespace A { void f(); // SemanticDC == LexicalDC == 'namespace A' } void A::f(); // SemanticDC == namespace 'A' // LexicalDC == global namespace
private clang::SourceLocation Loc
Loc - The location of this decl.
private unsigned int DeclKind
DeclKind - This indicates which class this is.
private unsigned int InvalidDecl
InvalidDecl - This indicates a semantic error occurred.
private unsigned int HasAttrs
HasAttrs - This indicates whether the decl has attributes or not.
private unsigned int Implicit
Implicit - Whether this declaration was implicitly generated by the implementation rather than explicitly written by the user.
private unsigned int Used
Whether this declaration was "used", meaning that a definition is required.
private unsigned int Referenced
Whether this declaration was "referenced". The difference with 'Used' is whether the reference appears in a evaluated context or not, e.g. functions used in uninstantiated templates are regarded as "referenced" but not "used".
private unsigned int TopLevelDeclInObjCContainer
Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition.
protected unsigned int Access
Access - Used by C++ decls for the access specifier.
protected unsigned int FromASTFile
Whether this declaration was loaded from an AST file.
protected unsigned int IdentifierNamespace
IdentifierNamespace - This specifies what IDNS_* namespace this lives in.
protected unsigned int CacheValidAndLinkage
If 0, we have not computed the linkage of this declaration. Otherwise, it is the linkage + 1.
private static bool StatisticsEnabled
Whether statistic collection is enabled.

Method Overview

Methods

bool AccessDeclContextCheck() const

Declared at: clang/include/clang/AST/DeclBase.h:357

Decl()

Declared at: clang/include/clang/AST/DeclBase.h:375

Decl(const clang::Decl&)

Declared at: clang/include/clang/AST/DeclBase.h:376

Parameters

const clang::Decl&

Decl(clang::Decl&&)

Declared at: clang/include/clang/AST/DeclBase.h:377

Parameters

clang::Decl&&

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

Declared at: clang/include/clang/AST/DeclBase.h:382

Parameters

clang::Decl::Kind DK
clang::DeclContext* DC
clang::SourceLocation L

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

Declared at: clang/include/clang/AST/DeclBase.h:392

Parameters

clang::Decl::Kind DK
clang::Decl::EmptyShell Empty

static void EnableStatistics()

Declared at: clang/include/clang/AST/DeclBase.h:1055

static void PrintStats()

Declared at: clang/include/clang/AST/DeclBase.h:1056

static void add(clang::Decl::Kind k)

Declared at: clang/include/clang/AST/DeclBase.h:1054

Parameters

clang::Decl::Kind k

void addAttr(clang::Attr* A)

Declared at: clang/include/clang/AST/DeclBase.h:503

Parameters

clang::Attr* A

clang::Decl::attr_iterator attr_begin() const

Declared at: clang/include/clang/AST/DeclBase.h:512

clang::Decl::attr_iterator attr_end() const

Declared at: clang/include/clang/AST/DeclBase.h:515

clang::Decl::attr_range attrs() const

Declared at: clang/include/clang/AST/DeclBase.h:508

bool canBeWeakImported(bool& IsDefinition) const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:736

Parameters

bool& IsDefinition
Set to \c true to indicate that this declaration cannot be weak-imported because it has a definition.

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

Declared at: clang/include/clang/AST/DeclBase.h:1192

Parameters

const clang::DeclContext*

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

Declared at: clang/include/clang/AST/DeclBase.h:1191

Parameters

const clang::Decl*

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

Declared at: clang/include/clang/AST/DeclBase.h:1190

Parameters

clang::Decl::Kind K

template <typename T>
void dropAttr()

Declared at: clang/include/clang/AST/DeclBase.h:520

Templates

T

void dropAttrs()

Declared at: clang/include/clang/AST/DeclBase.h:502

void dump() const

Declared at: clang/include/clang/AST/DeclBase.h:1203

void dump(llvm::raw_ostream& Out,
          bool Deserialize = false,
          clang::ASTDumpOutputFormat
              OutputFormat = ADOF_Default) const

Declared at: clang/include/clang/AST/DeclBase.h:1208

Parameters

llvm::raw_ostream& Out
bool Deserialize = false
clang::ASTDumpOutputFormat OutputFormat = ADOF_Default

void dumpColor() const

Declared at: clang/include/clang/AST/DeclBase.h:1206

clang::ASTContext& getASTContext() const

Declared at: clang/include/clang/AST/DeclBase.h:469

clang::ASTMutationListener*
getASTMutationListener() const

Declared at: clang/include/clang/AST/DeclBase.h:1225

clang::AccessSpecifier getAccess() const

Declared at: clang/include/clang/AST/DeclBase.h:480

clang::AccessSpecifier getAccessUnsafe() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:487

const clang::FunctionDecl* getAsFunction() const

Declared at: clang/include/clang/AST/DeclBase.h:1095

clang::FunctionDecl* getAsFunction()

Description

Returns the function itself, or the templated function if this is a function template.

Declared at: clang/include/clang/AST/DeclBase.h:1093

template <typename T>
T* getAttr() const

Declared at: clang/include/clang/AST/DeclBase.h:545

Templates

T

clang::AttrVec& getAttrs()

Declared at: clang/include/clang/AST/DeclBase.h:497

const clang::AttrVec& getAttrs() const

Declared at: clang/include/clang/AST/DeclBase.h:501

clang::AvailabilityResult getAvailability(
    std::string* Message = nullptr,
    llvm::VersionTuple EnclosingVersion =
        llvm::VersionTuple(),
    llvm::StringRef* RealizedPlatform =
        nullptr) const

Description

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').

Declared at: clang/include/clang/AST/DeclBase.h:692

Parameters

std::string* Message = nullptr
If non-NULL and the result is not \c AR_Available, will be set to a (possibly empty) message describing why the declaration has not been introduced, is deprecated, or is unavailable.
llvm::VersionTuple EnclosingVersion = llvm::VersionTuple()
The version to compare with. If empty, assume the deployment target version.
llvm::StringRef* RealizedPlatform = nullptr
If non-NULL and the availability result is found in an available attribute it will set to the platform which is written in the available attribute.

clang::SourceLocation getBeginLoc() const

Declared at: clang/include/clang/AST/DeclBase.h:424

virtual clang::Stmt* getBody() const

Description

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. Otherwise this method returns null.

Declared at: clang/include/clang/AST/DeclBase.h:1041

clang::SourceLocation getBodyRBrace() const

Description

getBodyRBrace - Gets the right brace of the body, if a body exists. This works whether the body is a CompoundStmt or a CXXTryStmt.

Declared at: clang/include/clang/AST/DeclBase.h:1051

clang::Linkage getCachedLinkage() const

Declared at: clang/include/clang/AST/DeclBase.h:406

virtual clang::Decl* getCanonicalDecl()

Description

Retrieves the "canonical" declaration of the given declaration.

Declared at: clang/include/clang/AST/DeclBase.h:932

const clang::Decl* getCanonicalDecl() const

Declared at: clang/include/clang/AST/DeclBase.h:933

const clang::DeclContext* getDeclContext() const

Declared at: clang/include/clang/AST/DeclBase.h:446

clang::DeclContext* getDeclContext()

Declared at: clang/include/clang/AST/DeclBase.h:441

const char* getDeclKindName() const

Declared at: clang/include/clang/AST/DeclBase.h:436

const clang::Attr* getDefiningAttr() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:645

clang::TemplateDecl* getDescribedTemplate() const

Description

If this is a declaration that describes some template, this method returns that template declaration. Note that this returns nullptr for partial specializations, because they are not modeled as TemplateDecls. Use getDescribedTemplateParams to handle those cases.

Declared at: clang/include/clang/AST/DeclBase.h:1085

const clang::TemplateParameterList*
getDescribedTemplateParams() const

Description

If this is a declaration that describes some template or partial specialization, this returns the corresponding template parameter list.

Declared at: clang/include/clang/AST/DeclBase.h:1089

clang::SourceLocation getEndLoc() const

Declared at: clang/include/clang/AST/DeclBase.h:428

clang::ExternalSourceSymbolAttr*
getExternalSourceSymbolAttr() const

Description

Looks on this and related declarations for an applicable external source symbol attribute.

Declared at: clang/include/clang/AST/DeclBase.h:610

clang::Decl::FriendObjectKind
getFriendObjectKind() const

Description

Determines whether this declaration is the object of a friend declaration and, if so, what kind. There is currently no direct way to find the associated FriendDecl.

Declared at: clang/include/clang/AST/DeclBase.h:1174

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

Description

Looks through the Decl's underlying type to extract a FunctionType when possible. Will return null if the type underlying the Decl does not have a FunctionType.

Declared at: clang/include/clang/AST/DeclBase.h:1217

Parameters

bool BlocksToo = true

unsigned int getGlobalID() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:744

int64_t getID() const

Declared at: clang/include/clang/AST/DeclBase.h:1212

Returns

Unique reproducible object identifier

unsigned int getIdentifierNamespace() const

Declared at: clang/include/clang/AST/DeclBase.h:843

static unsigned int getIdentifierNamespaceForKind(
    clang::Decl::Kind DK)

Declared at: clang/include/clang/AST/DeclBase.h:851

Parameters

clang::Decl::Kind DK

clang::Module* getImportedOwningModule() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:767

clang::Decl::Kind getKind() const

Declared at: clang/include/clang/AST/DeclBase.h:435

const clang::LangOptions& getLangOpts() const

Description

Helper to get the language options from the ASTContext. Defined out of line to avoid depending on ASTContext.h.

Declared at: clang/include/clang/AST/DeclBase.h:473

const clang::DeclContext* getLexicalDeclContext()
    const

Declared at: clang/include/clang/AST/DeclBase.h:877

clang::DeclContext* getLexicalDeclContext()

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:872

clang::Module* getLocalOwningModule() const

Description

Get the local owning module, if known. Returns nullptr if owner is not yet known or declaration is not from a module.

Declared at: clang/include/clang/AST/DeclBase.h:776

clang::SourceLocation getLocation() const

Declared at: clang/include/clang/AST/DeclBase.h:432

unsigned int getMaxAlignment() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:555

clang::Decl::ModuleOwnershipKind
getModuleOwnershipKind() const

Description

Get the kind of module ownership for this declaration.

Declared at: clang/include/clang/AST/DeclBase.h:830

static clang::Decl::ModuleOwnershipKind
getModuleOwnershipKindForChildOf(
    clang::DeclContext* DC)

Description

Get the module ownership kind to use for a local lexical child of \p DC, which may be either a local or (rarely) an imported declaration.

Declared at: clang/include/clang/AST/DeclBase.h:361

Parameters

clang::DeclContext* DC

const clang::Decl* getMostRecentDecl() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:1034

clang::Decl* getMostRecentDecl()

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:1030

virtual clang::Decl* getMostRecentDeclImpl()

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:953

clang::Decl::MultipleDC* getMultipleDC() const

Declared at: clang/include/clang/AST/DeclBase.h:274

clang::Decl* getNextDeclInContext()

Declared at: clang/include/clang/AST/DeclBase.h:438

const clang::Decl* getNextDeclInContext() const

Declared at: clang/include/clang/AST/DeclBase.h:439

virtual clang::Decl* getNextRedeclarationImpl()

Description

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.

Declared at: clang/include/clang/AST/DeclBase.h:945

clang::Decl* getNonClosureContext()

Description

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.

Declared at: clang/include/clang/AST/DeclBase.h:455

const clang::Decl* getNonClosureContext() const

Declared at: clang/include/clang/AST/DeclBase.h:456

clang::Module* getOwningModule() const

Description

Get the module that owns this declaration (for visibility purposes).

Declared at: clang/include/clang/AST/DeclBase.h:797

clang::Module* getOwningModuleForLinkage(
    bool IgnoreLinkage = false) const

Description

Get the module that owns this declaration for linkage purposes. There only ever is such a module under the C++ Modules TS.

Declared at: clang/include/clang/AST/DeclBase.h:806

Parameters

bool IgnoreLinkage = false
Ignore the linkage of the entity; assume that all declarations in a global module fragment are unowned.

unsigned int getOwningModuleID() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:752

clang::Module* getOwningModuleSlow() const

Declared at: clang/include/clang/AST/DeclBase.h:759

const clang::DeclContext*
getParentFunctionOrMethod(
    bool LexicalParent = false) const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:924

Parameters

bool LexicalParent = false

clang::DeclContext* getParentFunctionOrMethod(
    bool LexicalParent = false)

Declared at: clang/include/clang/AST/DeclBase.h:925

Parameters

bool LexicalParent = false

clang::Decl* getPreviousDecl()

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:1015

const clang::Decl* getPreviousDecl() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:1019

virtual clang::Decl* getPreviousDeclImpl()

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:949

clang::DeclContext* getSemanticDC() const

Declared at: clang/include/clang/AST/DeclBase.h:278

virtual clang::SourceRange getSourceRange() const

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/DeclBase.h:420

unsigned int getTemplateDepth() const

Description

Determine the number of levels of template parameter surrounding this declaration.

Declared at: clang/include/clang/AST/DeclBase.h:897

const clang::TranslationUnitDecl*
getTranslationUnitDecl() const

Declared at: clang/include/clang/AST/DeclBase.h:461

clang::TranslationUnitDecl*
getTranslationUnitDecl()

Declared at: clang/include/clang/AST/DeclBase.h:460

llvm::VersionTuple getVersionIntroduced() const

Description

Retrieve the version of the target platform in which this declaration was introduced.

Declared at: clang/include/clang/AST/DeclBase.h:702

Returns

An empty version tuple if this declaration has no 'introduced' availability attributes, or the version tuple that's specified in the attribute otherwise.

template <typename T>
bool hasAttr() const

Declared at: clang/include/clang/AST/DeclBase.h:549

Templates

T

bool hasAttrs() const

Declared at: clang/include/clang/AST/DeclBase.h:491

virtual bool hasBody() const

Description

Returns true if this \c Decl represents a declaration for a body of code, such as a function or method definition. Note that \c hasBody can also return true if any redeclaration of this\c Decl represents a declaration for a body of code.

Declared at: clang/include/clang/AST/DeclBase.h:1047

bool hasCachedLinkage() const

Declared at: clang/include/clang/AST/DeclBase.h:414

bool hasDefiningAttr() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:642

bool hasLocalOwningModuleStorage() const

Declared at: clang/include/clang/AST/DeclBase.h:762

bool hasOwningModule() const

Description

Is this declaration owned by some module?

Declared at: clang/include/clang/AST/DeclBase.h:792

bool hasTagIdentifierNamespace() const

Declared at: clang/include/clang/AST/DeclBase.h:853

bool isCanonicalDecl() const

Description

Whether this particular Decl is a canonical one.

Declared at: clang/include/clang/AST/DeclBase.h:938

bool isDefinedOutsideFunctionOrMethod() const

Description

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).

Declared at: clang/include/clang/AST/DeclBase.h:903

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

Description

Determine whether this declaration is marked 'deprecated'.

Declared at: clang/include/clang/AST/DeclBase.h:709

Parameters

std::string* Message = nullptr
If non-NULL and the declaration is deprecated, this will be set to the message describing why the declaration was deprecated (which may be empty).

bool isDiscardedInGlobalModuleFragment() const

Description

FIXME: Implement discarding declarations actually in global module fragment. See [module.global.frag]p3,4 for details.

Declared at: clang/include/clang/AST/DeclBase.h:638

bool isFirstDecl() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:1024

bool isFromASTFile() const

Description

Determine whether this declaration came from an AST file (such as a precompiled header or module) rather than having been parsed.

Declared at: clang/include/clang/AST/DeclBase.h:740

bool isFunctionOrFunctionTemplate() const

Description

Whether this declaration is a function or function template.

Declared at: clang/include/clang/AST/DeclBase.h:1073

bool isImplicit() const

Description

isImplicit - Indicates whether the declaration was implicitly generated by the implementation. If false, this declaration was written explicitly in the source code.

Declared at: clang/include/clang/AST/DeclBase.h:565

bool isInAnonymousNamespace() const

Declared at: clang/include/clang/AST/DeclBase.h:465

bool isInExportDeclContext() const

Description

Whether this declaration was exported in a lexical context. e.g.: export namespace A { void f1(); // isInExportDeclContext() == true } void A::f1(); // isInExportDeclContext() == false namespace B { void f2(); // isInExportDeclContext() == false } export void B::f2(); // isInExportDeclContext() == true

Declared at: clang/include/clang/AST/DeclBase.h:630

bool isInIdentifierNamespace(
    unsigned int NS) const

Declared at: clang/include/clang/AST/DeclBase.h:847

Parameters

unsigned int NS

bool isInLocalScopeForInstantiation() const

Description

Determine whether a substitution into this declaration would occur as part of a substitution into a dependent local scope. Such a substitution transitively substitutes into all constructs nested within this declaration. This recognizes non-defining declarations as well as members of local classes and lambdas:

Declared at: clang/include/clang/AST/DeclBase.h:919

bool isInSemaDC() const

Declared at: clang/include/clang/AST/DeclBase.h:271

bool isInStdNamespace() const

Declared at: clang/include/clang/AST/DeclBase.h:467

bool isInvalidDecl() const

Declared at: clang/include/clang/AST/DeclBase.h:560

bool isInvisibleOutsideTheOwningModule() const

Declared at: clang/include/clang/AST/DeclBase.h:632

bool isLocalExternDecl()

Description

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.

Declared at: clang/include/clang/AST/DeclBase.h:1123

bool isModulePrivate() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:614

virtual bool isOutOfLine() const

Description

Determine whether this declaration is declared out of line (outside its semantic context).

Declared at: clang/include/clang/AST/DeclBase.h:883

bool isOutOfSemaDC() const

Declared at: clang/include/clang/AST/DeclBase.h:272

bool isParameterPack() const

Description

Whether this declaration is a parameter pack.

Declared at: clang/include/clang/AST/DeclBase.h:1067

bool isReachable() const

Declared at: clang/include/clang/AST/DeclBase.h:817

bool isReferenced() const

Description

Whether any declaration of this entity was referenced.

Declared at: clang/include/clang/AST/DeclBase.h:589

static bool isTagIdentifierNamespace(
    unsigned int NS)

Declared at: clang/include/clang/AST/DeclBase.h:857

Parameters

unsigned int NS

bool isTemplateDecl() const

Description

returns true if this declaration is a template

Declared at: clang/include/clang/AST/DeclBase.h:1070

bool isTemplateParameter() const

Description

isTemplateParameter - Determines whether this declaration is a template parameter.

Declared at: clang/include/clang/AST/DeclBase.h:1060

bool isTemplateParameterPack() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:1064

bool isTemplated() const

Description

Determine whether this declaration is a templated entity (whether it is

Declared at: clang/include/clang/AST/DeclBase.h:893

bool isThisDeclarationReferenced() const

Description

Whether this declaration was referenced. This should not be relied upon for anything other than debugging.

Declared at: clang/include/clang/AST/DeclBase.h:593

bool isTopLevelDeclInObjCContainer() const

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:600

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

Description

Determine whether this declaration is marked 'unavailable'.

Declared at: clang/include/clang/AST/DeclBase.h:718

Parameters

std::string* Message = nullptr
If 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).

bool isUnconditionallyVisible() const

Description

Determine whether this declaration is definitely visible to name lookup, independent of whether the owning module is visible. Note: The declaration may be visible even if this returns \c false if the owning module is visible within the query context. This is a low-level helper function; most code should be calling Sema::isVisible() instead.

Declared at: clang/include/clang/AST/DeclBase.h:813

bool isUsed(bool CheckUsedAttr = true) const

Description

Whether *any* (re-)declaration of the entity was used, meaning that a definition is required.

Declared at: clang/include/clang/AST/DeclBase.h:574

Parameters

bool CheckUsedAttr = true
When true, also consider the "used" attribute (in addition to the "used" bit set by \c setUsed()) when determining whether the function is used.

bool isWeakImported() const

Description

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.

Declared at: clang/include/clang/AST/DeclBase.h:728

void markUsed(clang::ASTContext& C)

Description

Mark the declaration used, in the sense of odr-use. This notifies any mutation listeners in addition to setting a bit indicating the declaration is used.

Declared at: clang/include/clang/AST/DeclBase.h:586

Parameters

clang::ASTContext& C

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

Declared at: clang/include/clang/AST/DeclBase.h:1194

Parameters

llvm::raw_ostream& Out
unsigned int Indentation = 0
bool PrintInstantiation = false

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

Declared at: clang/include/clang/AST/DeclBase.h:1196

Parameters

llvm::raw_ostream& Out
const clang::PrintingPolicy& Policy
unsigned int Indentation = 0
bool PrintInstantiation = false

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

Declared at: clang/include/clang/AST/DeclBase.h:1198

Parameters

clang::Decl** Begin
unsigned int NumDecls
llvm::raw_ostream& Out
const clang::PrintingPolicy& Policy
unsigned int Indentation = 0

clang::Decl::redecl_range redecls() const

Description

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).

Declared at: clang/include/clang/AST/DeclBase.h:1003

clang::Decl::redecl_iterator redecls_begin() const

Declared at: clang/include/clang/AST/DeclBase.h:1007

clang::Decl::redecl_iterator redecls_end() const

Declared at: clang/include/clang/AST/DeclBase.h:1011

void setAccess(clang::AccessSpecifier AS)

Declared at: clang/include/clang/AST/DeclBase.h:475

Parameters

clang::AccessSpecifier AS

void setAttrs(const clang::AttrVec& Attrs)

Declared at: clang/include/clang/AST/DeclBase.h:493

Parameters

const clang::AttrVec& Attrs

void setAttrsImpl(const clang::AttrVec& Attrs,
                  clang::ASTContext& Ctx)

Declared at: clang/include/clang/AST/DeclBase.h:1220

Parameters

const clang::AttrVec& Attrs
clang::ASTContext& Ctx

void setCachedLinkage(clang::Linkage L) const

Declared at: clang/include/clang/AST/DeclBase.h:410

Parameters

clang::Linkage L

void setDeclContext(clang::DeclContext* DC)

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:887

Parameters

clang::DeclContext* DC

void setDeclContextsImpl(
    clang::DeclContext* SemaDC,
    clang::DeclContext* LexicalDC,
    clang::ASTContext& Ctx)

Declared at: clang/include/clang/AST/DeclBase.h:1221

Parameters

clang::DeclContext* SemaDC
clang::DeclContext* LexicalDC
clang::ASTContext& Ctx

void setFromASTFile()

Description

Set the FromASTFile flag. This indicates that this declaration was deserialized and not parsed from source code and enables features such as module ownership information.

Declared at: clang/include/clang/AST/DeclBase.h:662

void setImplicit(bool I = true)

Declared at: clang/include/clang/AST/DeclBase.h:566

Parameters

bool I = true

void setInvalidDecl(bool Invalid = true)

Description

setInvalidDecl - Indicates the Decl had a semantic error. This allows for graceful error recovery.

Declared at: clang/include/clang/AST/DeclBase.h:559

Parameters

bool Invalid = true

void setIsUsed()

Description

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.

Declared at: clang/include/clang/AST/DeclBase.h:580

void setLexicalDeclContext(clang::DeclContext* DC)

Declared at: clang/include/clang/AST/DeclBase.h:889

Parameters

clang::DeclContext* DC

void setLocalExternDecl()

Description

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.

Declared at: clang/include/clang/AST/DeclBase.h:1105

void setLocalOwningModule(clang::Module* M)

Declared at: clang/include/clang/AST/DeclBase.h:784

Parameters

clang::Module* M

void setLocation(clang::SourceLocation L)

Declared at: clang/include/clang/AST/DeclBase.h:433

Parameters

clang::SourceLocation L

void setModuleOwnershipKind(
    clang::Decl::ModuleOwnershipKind MOK)

Description

Set whether this declaration is hidden from name lookup.

Declared at: clang/include/clang/AST/DeclBase.h:835

Parameters

clang::Decl::ModuleOwnershipKind MOK

void setModulePrivate()

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:650

void setNonMemberOperator()

Description

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

Declared at: clang/include/clang/AST/DeclBase.h:1183

void setObjectOfFriendDecl(
    bool PerformFriendInjection = false)

Description

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.

Declared at: clang/include/clang/AST/DeclBase.h:1134

Parameters

bool PerformFriendInjection = false

void setOwningModuleID(unsigned int ID)

Description

Set the owning module ID. This may only be called for deserialized Decls.

Declared at: clang/include/clang/AST/DeclBase.h:668

Parameters

unsigned int ID

void setReferenced(bool R = true)

Declared at: clang/include/clang/AST/DeclBase.h:595

Parameters

bool R = true

void setTopLevelDeclInObjCContainer(bool V = true)

Declared at: clang/include/clang/AST/DeclBase.h:604

Parameters

bool V = true

void setVisibleDespiteOwningModule()

Description

Set that this declaration is globally visible, even if it came from a module that is not visible.

Declared at: clang/include/clang/AST/DeclBase.h:824

template <typename T>
specific_attr_iterator<T> specific_attr_begin()
    const

Declared at: clang/include/clang/AST/DeclBase.h:536

Templates

T

template <typename T>
specific_attr_iterator<T> specific_attr_end()
    const

Declared at: clang/include/clang/AST/DeclBase.h:541

Templates

T

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

Declared at: clang/include/clang/AST/DeclBase.h:531

Templates

T

void updateOutOfDate(
    clang::IdentifierInfo& II) const

Description

Update a potentially out-of-date declaration.

Declared at: clang/include/clang/AST/DeclBase.h:404

Parameters

clang::IdentifierInfo& II

virtual ~Decl()

Declared at: clang/include/clang/AST/DeclBase.h:401