class NamespaceDecl
Declaration
class NamespaceDecl : public NamedDecl,
public DeclContext,
public Redeclarable { /* full declaration omitted */ };
Description
Represent a C++ namespace.
Declared at: clang/include/clang/AST/Decl.h:540
Inherits from: NamedDecl, DeclContext, Redeclarable
Member Variables
- private clang::SourceLocation LocStart
- The starting location of the source range, pointing to either the namespace or the inline keyword.
- private clang::SourceLocation RBraceLoc
- The ending location of the source range.
- private llvm::PointerIntPair<NamespaceDecl*, 1, bool> AnonOrFirstNamespaceAndInline
- A pointer to either the anonymous namespace that lives just inside this namespace or to the first namespace in the chain (the latter case only when this is not the first in the chain), along with a boolean value indicating whether this is an inline namespace.
Inherited from DeclContext:
- protected
- protected FirstDecl = nullptr
- protected LastDecl = nullptr
Inherited from Decl:
- protected NextInContextAndBits
- protected Access
- protected FromASTFile
- protected IdentifierNamespace
- protected CacheValidAndLinkage
Method Overview
- public static clang::NamespaceDecl * Create(clang::ASTContext & C, clang::DeclContext * DC, bool Inline, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, clang::IdentifierInfo * Id, clang::NamespaceDecl * PrevDecl)
- public static clang::NamespaceDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID)
- private NamespaceDecl(clang::ASTContext & C, clang::DeclContext * DC, bool Inline, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, clang::IdentifierInfo * Id, clang::NamespaceDecl * PrevDecl)
- public static clang::NamespaceDecl * castFromDeclContext(const clang::DeclContext * DC)
- public static clang::DeclContext * castToDeclContext(const clang::NamespaceDecl * D)
- public static bool classof(const clang::Decl * D)
- public static bool classofKind(clang::Decl::Kind K)
- public clang::NamespaceDecl * getAnonymousNamespace() const
- public clang::SourceLocation getBeginLoc() const
- public clang::NamespaceDecl * getCanonicalDecl()
- public const clang::NamespaceDecl * getCanonicalDecl() const
- private clang::NamespaceDecl * getMostRecentDeclImpl()
- private clang::NamespaceDecl * getNextRedeclarationImpl()
- public clang::NamespaceDecl * getOriginalNamespace()
- public const clang::NamespaceDecl * getOriginalNamespace() const
- private clang::NamespaceDecl * getPreviousDeclImpl()
- public clang::SourceLocation getRBraceLoc() const
- public clang::SourceRange getSourceRange() const
- public bool isAnonymousNamespace() const
- public bool isInline() const
- public bool isOriginalNamespace() const
- public bool isRedundantInlineQualifierFor(clang::DeclarationName Name) const
- public void setAnonymousNamespace(clang::NamespaceDecl * D)
- public void setInline(bool Inline)
- public void setLocStart(clang::SourceLocation L)
- public void setRBraceLoc(clang::SourceLocation L)
Inherited from DeclContext:
- protected BuildDeclChain
- public Encloses
- public Equals
- public InEnclosingNamespaceSetOf
- public addDecl
- public addDeclInternal
- public addHiddenDecl
- public buildLookup
- public classof
- public classof
- public collectAllContexts
- public containsDecl
- public containsDeclAndLoad
- public ddiags
- public decls
- public decls_begin
- public decls_empty
- public decls_end
- public dumpDeclContext
- public dumpLookups
- public dumpLookups
- public getDeclKind
- public getDeclKindName
- public getEnclosingNamespaceContext
- public getEnclosingNamespaceContext
- public getExternCContext
- public getInnermostBlockDecl
- public getLexicalParent
- public getLexicalParent
- public getLookupParent
- public getLookupParent
- public getLookupPtr
- public getNonClosureAncestor
- public getNonClosureAncestor
- public getNonTransparentContext
- public getNonTransparentContext
- public getOuterLexicalRecordContext
- public getOuterLexicalRecordContext
- public getParent
- public getParent
- public getParentASTContext
- public getPrimaryContext
- public getPrimaryContext
- public getRedeclContext
- public getRedeclContext
- public hasExternalLexicalStorage
- public hasExternalVisibleStorage
- public isClosure
- public isDeclInLexicalTraversal
- public isDependentContext
- public isExternCContext
- public isExternCXXContext
- public isFileContext
- public isFunctionOrMethod
- public isInlineNamespace
- public isLookupContext
- public isNamespace
- public isObjCContainer
- public isRecord
- public isStdNamespace
- public isTranslationUnit
- public isTransparentContext
- public localUncachedLookup
- public lookup
- public lookups
- public lookups_begin
- public lookups_end
- public makeDeclVisibleInContext
- public noload_decls
- public noload_decls_begin
- public noload_decls_end
- public noload_lookup
- public noload_lookups
- public noload_lookups_begin
- public noload_lookups_end
- public removeDecl
- public setHasExternalLexicalStorage
- public setHasExternalVisibleStorage
- public setMustBuildLookupTable
- public setUseQualifiedLookup
- public shouldUseQualifiedLookup
- public using_directives
Inherited from NamedDecl:
- public classof
- public classofKind
- public declarationReplaces
- public getDeclName
- public getExplicitVisibility
- public getFormalLinkage
- public getIdentifier
- public getLinkageAndVisibility
- public getLinkageInternal
- public getMostRecentDecl
- public getMostRecentDecl
- public getName
- public getNameAsString
- public getNameForDiagnostic
- public getObjCFStringFormattingFamily
- public getQualifiedNameAsString
- public getUnderlyingDecl
- public getUnderlyingDecl
- public getVisibility
- public hasExternalFormalLinkage
- public hasLinkage
- public hasLinkageBeenComputed
- public isCXXClassMember
- public isCXXInstanceMember
- public isExternallyDeclarable
- public isExternallyVisible
- public isLinkageValid
- public isReserved
- public printName
- public printNestedNameSpecifier
- public printNestedNameSpecifier
- public printQualifiedName
- public printQualifiedName
- public setDeclName
Inherited from Decl:
- public EnableStatistics
- public PrintStats
- public add
- public addAttr
- public attr_begin
- public attr_end
- public attrs
- public canBeWeakImported
- public castFromDeclContext
- public castToDeclContext
- public classofKind
- public dropAttr
- public dropAttrs
- public dump
- public dump
- public dumpColor
- public getASTContext
- protected getASTMutationListener
- public getAccess
- public getAccessUnsafe
- public getAsFunction
- public getAsFunction
- public getAttr
- public getAttrs
- public getAttrs
- public getAvailability
- public getBeginLoc
- public getBody
- public getBodyRBrace
- protected getCachedLinkage
- public getCanonicalDecl
- public getCanonicalDecl
- public getDeclContext
- public getDeclContext
- public getDeclKindName
- public getDefiningAttr
- public getDescribedTemplate
- public getDescribedTemplateParams
- public getEndLoc
- public getExternalSourceSymbolAttr
- public getFriendObjectKind
- public getFunctionType
- public getGlobalID
- public getID
- public getIdentifierNamespace
- public getIdentifierNamespaceForKind
- public getImportedOwningModule
- public getKind
- public getLangOpts
- public getLexicalDeclContext
- public getLexicalDeclContext
- public getLocalOwningModule
- public getLocation
- public getMaxAlignment
- public getModuleOwnershipKind
- public getMostRecentDecl
- public getMostRecentDecl
- protected getMostRecentDeclImpl
- public getNextDeclInContext
- public getNextDeclInContext
- protected getNextRedeclarationImpl
- public getNonClosureContext
- public getNonClosureContext
- public getOwningModule
- public getOwningModuleForLinkage
- public getOwningModuleID
- public getParentFunctionOrMethod
- public getParentFunctionOrMethod
- public getPreviousDecl
- public getPreviousDecl
- protected getPreviousDeclImpl
- public getSourceRange
- public getTemplateDepth
- public getTranslationUnitDecl
- public getTranslationUnitDecl
- public getVersionIntroduced
- public hasAttr
- public hasAttrs
- public hasBody
- protected hasCachedLinkage
- public hasDefiningAttr
- protected hasLocalOwningModuleStorage
- public hasOwningModule
- public hasTagIdentifierNamespace
- public isCanonicalDecl
- public isDefinedOutsideFunctionOrMethod
- public isDeprecated
- public isDiscardedInGlobalModuleFragment
- public isFirstDecl
- public isFromASTFile
- public isFunctionOrFunctionTemplate
- public isImplicit
- public isInAnonymousNamespace
- public isInExportDeclContext
- public isInIdentifierNamespace
- public isInLocalScopeForInstantiation
- public isInStdNamespace
- public isInvalidDecl
- public isInvisibleOutsideTheOwningModule
- public isLocalExternDecl
- public isModulePrivate
- public isOutOfLine
- public isParameterPack
- public isReachable
- public isReferenced
- public isTagIdentifierNamespace
- public isTemplateDecl
- public isTemplateParameter
- public isTemplateParameterPack
- public isTemplated
- public isThisDeclarationReferenced
- public isTopLevelDeclInObjCContainer
- public isUnavailable
- public isUnconditionallyVisible
- public isUsed
- public isWeakImported
- public markUsed
- public print
- public print
- public printGroup
- public redecls
- public redecls_begin
- public redecls_end
- public setAccess
- public setAttrs
- protected setCachedLinkage
- public setDeclContext
- public setFromASTFile
- public setImplicit
- public setInvalidDecl
- public setIsUsed
- public setLexicalDeclContext
- public setLocalExternDecl
- public setLocalOwningModule
- public setLocation
- public setModuleOwnershipKind
- protected setModulePrivate
- public setNonMemberOperator
- public setObjectOfFriendDecl
- public setOwningModuleID
- public setReferenced
- public setTopLevelDeclInObjCContainer
- public setVisibleDespiteOwningModule
- public specific_attr_begin
- public specific_attr_end
- public specific_attrs
- protected updateOutOfDate
Methods
¶static clang::NamespaceDecl* Create(
clang::ASTContext& C,
clang::DeclContext* DC,
bool Inline,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::NamespaceDecl* PrevDecl)
static clang::NamespaceDecl* Create(
clang::ASTContext& C,
clang::DeclContext* DC,
bool Inline,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::NamespaceDecl* PrevDecl)
Declared at: clang/include/clang/AST/Decl.h:570
Parameters
- clang::ASTContext& C
- clang::DeclContext* DC
- bool Inline
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- clang::IdentifierInfo* Id
- clang::NamespaceDecl* PrevDecl
¶static clang::NamespaceDecl* CreateDeserialized(
clang::ASTContext& C,
unsigned int ID)
static clang::NamespaceDecl* CreateDeserialized(
clang::ASTContext& C,
unsigned int ID)
Declared at: clang/include/clang/AST/Decl.h:575
Parameters
- clang::ASTContext& C
- unsigned int ID
¶NamespaceDecl(clang::ASTContext& C,
clang::DeclContext* DC,
bool Inline,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::NamespaceDecl* PrevDecl)
NamespaceDecl(clang::ASTContext& C,
clang::DeclContext* DC,
bool Inline,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::NamespaceDecl* PrevDecl)
Declared at: clang/include/clang/AST/Decl.h:556
Parameters
- clang::ASTContext& C
- clang::DeclContext* DC
- bool Inline
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- clang::IdentifierInfo* Id
- clang::NamespaceDecl* PrevDecl
¶static clang::NamespaceDecl* castFromDeclContext(
const clang::DeclContext* DC)
static clang::NamespaceDecl* castFromDeclContext(
const clang::DeclContext* DC)
Declared at: clang/include/clang/AST/Decl.h:666
Parameters
- const clang::DeclContext* DC
¶static clang::DeclContext* castToDeclContext(
const clang::NamespaceDecl* D)
static clang::DeclContext* castToDeclContext(
const clang::NamespaceDecl* D)
Declared at: clang/include/clang/AST/Decl.h:663
Parameters
- const clang::NamespaceDecl* D
¶static bool classof(const clang::Decl* D)
static bool classof(const clang::Decl* D)
Declared at: clang/include/clang/AST/Decl.h:661
Parameters
- const clang::Decl* D
¶static bool classofKind(clang::Decl::Kind K)
static bool classofKind(clang::Decl::Kind K)
Declared at: clang/include/clang/AST/Decl.h:662
Parameters
- clang::Decl::Kind K
¶clang::NamespaceDecl* getAnonymousNamespace()
const
clang::NamespaceDecl* getAnonymousNamespace()
const
Description
Retrieve the anonymous namespace nested inside this namespace, if any.
Declared at: clang/include/clang/AST/Decl.h:635
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/Decl.h:655
¶clang::NamespaceDecl* getCanonicalDecl()
clang::NamespaceDecl* getCanonicalDecl()
Description
Retrieves the canonical declaration of this namespace.
Declared at: clang/include/clang/AST/Decl.h:644
¶const clang::NamespaceDecl* getCanonicalDecl()
const
const clang::NamespaceDecl* getCanonicalDecl()
const
Declared at: clang/include/clang/AST/Decl.h:647
¶clang::NamespaceDecl* getMostRecentDeclImpl()
clang::NamespaceDecl* getMostRecentDeclImpl()
Description
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.
Declared at: clang/include/clang/AST/Decl.h:564
¶clang::NamespaceDecl* getNextRedeclarationImpl()
clang::NamespaceDecl* 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/Decl.h:562
¶clang::NamespaceDecl* getOriginalNamespace()
clang::NamespaceDecl* getOriginalNamespace()
Description
Get the original (first) namespace declaration.
Declared at: clang/include/clang/AST/Decl.h:623
¶const clang::NamespaceDecl* getOriginalNamespace()
const
const clang::NamespaceDecl* getOriginalNamespace()
const
Description
Get the original (first) namespace declaration.
Declared at: clang/include/clang/AST/Decl.h:626
¶clang::NamespaceDecl* getPreviousDeclImpl()
clang::NamespaceDecl* getPreviousDeclImpl()
Description
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
Declared at: clang/include/clang/AST/Decl.h:563
¶clang::SourceLocation getRBraceLoc() const
clang::SourceLocation getRBraceLoc() const
Declared at: clang/include/clang/AST/Decl.h:656
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() const
Description
Source range that this declaration covers.
Declared at: clang/include/clang/AST/Decl.h:651
¶bool isAnonymousNamespace() const
bool isAnonymousNamespace() const
Description
Returns true if this is an anonymous namespace declaration. For example: q.v. C++ [namespace.unnamed]
Declared at: clang/include/clang/AST/Decl.h:596
¶bool isInline() const
bool isInline() const
Description
Returns true if this is an inline namespace declaration.
Declared at: clang/include/clang/AST/Decl.h:601
¶bool isOriginalNamespace() const
bool isOriginalNamespace() const
Description
Return true if this declaration is an original (first) declaration of the namespace. This is false for non-original (subsequent) namespace declarations and anonymous namespaces.
Declared at: clang/include/clang/AST/Decl.h:631
¶bool isRedundantInlineQualifierFor(
clang::DeclarationName Name) const
bool isRedundantInlineQualifierFor(
clang::DeclarationName Name) const
Description
Returns true if the inline qualifier for \c Name is redundant.
Declared at: clang/include/clang/AST/Decl.h:611
Parameters
¶void setAnonymousNamespace(
clang::NamespaceDecl* D)
void setAnonymousNamespace(
clang::NamespaceDecl* D)
Declared at: clang/include/clang/AST/Decl.h:639
Parameters
¶void setInline(bool Inline)
void setInline(bool Inline)
Description
Set whether this is an inline namespace declaration.
Declared at: clang/include/clang/AST/Decl.h:606
Parameters
- bool Inline
¶void setLocStart(clang::SourceLocation L)
void setLocStart(clang::SourceLocation L)
Declared at: clang/include/clang/AST/Decl.h:657
Parameters
¶void setRBraceLoc(clang::SourceLocation L)
void setRBraceLoc(clang::SourceLocation L)
Declared at: clang/include/clang/AST/Decl.h:658