clang API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
clang::DeclContext Class Reference

#include <DeclBase.h>

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

List of all members.

Classes

class  ddiag_iterator
class  decl_iterator
class  filtered_decl_iterator
 Iterates over a filtered subrange of declarations stored in a DeclContext. More...
class  specific_decl_iterator

Public Types

typedef NamedDecl ** lookup_iterator
typedef NamedDecl *const * lookup_const_iterator
typedef DeclContextLookupResult lookup_result
typedef
DeclContextLookupConstResult 
lookup_const_result
typedef UsingDirectiveDecl *const * udir_iterator
typedef std::pair
< udir_iterator, udir_iterator
udir_iterator_range

Public Member Functions

 ~DeclContext ()
Decl::Kind getDeclKind () const
const char * getDeclKindName () const
DeclContextgetParent ()
 getParent - Returns the containing DeclContext.
const DeclContextgetParent () const
DeclContextgetLexicalParent ()
const DeclContextgetLexicalParent () const
DeclContextgetLookupParent ()
 Find the parent context of this context that will be used for unqualified name lookup.
const DeclContextgetLookupParent () const
ASTContextgetParentASTContext () const
bool isClosure () const
bool isObjCContainer () const
bool isFunctionOrMethod () const
bool isFileContext () const
bool isTranslationUnit () const
bool isRecord () const
bool isNamespace () const
bool isInlineNamespace () const
bool isDependentContext () const
 Determines whether this context is dependent on a template parameter.
bool isTransparentContext () const
bool isExternCContext () const
 Determines whether this context is, or is nested within, a C++ extern "C" linkage spec.
bool Equals (const DeclContext *DC) const
 Determine whether this declaration context is equivalent to the declaration context DC.
bool Encloses (const DeclContext *DC) const
 Determine whether this declaration context encloses the declaration context DC.
DeclContextgetNonClosureAncestor ()
 Find the nearest non-closure ancestor of this context, i.e. the innermost semantic parent of this context which is not a closure. A context may be its own non-closure ancestor.
const DeclContextgetNonClosureAncestor () const
DeclContextgetPrimaryContext ()
const DeclContextgetPrimaryContext () const
DeclContextgetRedeclContext ()
const DeclContextgetRedeclContext () const
DeclContextgetEnclosingNamespaceContext ()
 Retrieve the nearest enclosing namespace context.
const DeclContextgetEnclosingNamespaceContext () const
bool InEnclosingNamespaceSetOf (const DeclContext *NS) const
 Test if this context is part of the enclosing namespace set of the context NS, as defined in C++0x [namespace.def]p9. If either context isn't a namespace, this is equivalent to Equals().
void collectAllContexts (llvm::SmallVectorImpl< DeclContext * > &Contexts)
decl_iterator decls_begin () const
decl_iterator decls_end () const
bool decls_empty () const
decl_iterator noload_decls_begin () const
decl_iterator noload_decls_end () const
void addDecl (Decl *D)
 Add the declaration D into this context.
void addDeclInternal (Decl *D)
 Add the declaration D into this context, but suppress searches for external declarations with the same name.
void addHiddenDecl (Decl *D)
 Add the declaration D to this context without modifying any lookup tables.
void removeDecl (Decl *D)
 Removes a declaration from this context.
lookup_result lookup (DeclarationName Name)
lookup_const_result lookup (DeclarationName Name) const
void localUncachedLookup (DeclarationName Name, llvm::SmallVectorImpl< NamedDecl * > &Results)
 A simplistic name lookup mechanism that performs name lookup into this declaration context without consulting the external source.
void makeDeclVisibleInContext (NamedDecl *D, bool Recoverable=true)
 Makes a declaration visible within this context.
udir_iterator_range getUsingDirectives () const
udir_iterator using_directives_begin () const
udir_iterator using_directives_end () const
ddiag_iterator ddiag_begin () const
ddiag_iterator ddiag_end () const
StoredDeclsMapgetLookupPtr () const
 Retrieve the internal representation of the lookup structure.
bool hasExternalLexicalStorage () const
 Whether this DeclContext has external storage containing additional declarations that are lexically in this context.
void setHasExternalLexicalStorage (bool ES=true)
 State whether this DeclContext has external storage for declarations lexically in this context.
bool hasExternalVisibleStorage () const
 Whether this DeclContext has external storage containing additional declarations that are visible in this context.
void setHasExternalVisibleStorage (bool ES=true)
 State whether this DeclContext has external storage for declarations visible in this context.
bool isDeclInLexicalTraversal (const Decl *D) const
 Determine whether the given declaration is stored in the list of declarations lexically within this context.
void dumpDeclContext () const

Static Public Member Functions

static bool classof (const Decl *D)
static bool classof (const DeclContext *D)

Protected Member Functions

 DeclContext (Decl::Kind K)

Static Protected Member Functions

static std::pair< Decl *, Decl * > BuildDeclChain (const SmallVectorImpl< Decl * > &Decls, bool FieldsAlreadyLoaded)
 Build up a chain of declarations.

Protected Attributes

DeclFirstDecl
DeclLastDecl

Friends

class ExternalASTSource
class DependentDiagnostic

Detailed Description

DeclContext - This is used only as base class of specific decl types that can act as declaration contexts. These decls are (only the top classes that directly derive from DeclContext are mentioned, not their subclasses):

TranslationUnitDecl NamespaceDecl FunctionDecl TagDecl ObjCMethodDecl ObjCContainerDecl LinkageSpecDecl BlockDecl

Definition at line 923 of file DeclBase.h.


Member Typedef Documentation

lookup_const_iterator - An iterator that provides non-mutable access to the results of lookup up a name within this context.

Definition at line 1386 of file DeclBase.h.

Definition at line 1389 of file DeclBase.h.

lookup_iterator - An iterator that provides access to the results of looking up a name within this context.

Definition at line 1382 of file DeclBase.h.

Definition at line 1388 of file DeclBase.h.

udir_iterator - Iterates through the using-directives stored within this context.

Definition at line 1430 of file DeclBase.h.

Definition at line 1432 of file DeclBase.h.


Constructor & Destructor Documentation

clang::DeclContext::DeclContext ( Decl::Kind  K) [inline, protected]

Definition at line 961 of file DeclBase.h.

DeclContext::~DeclContext ( )

Definition at line 705 of file DeclBase.cpp.


Member Function Documentation

void DeclContext::addDecl ( Decl D)

Add the declaration D into this context.

This routine should be invoked when the declaration D has first been declared, to place D into the context where it was (lexically) defined. Every declaration must be added to one (and only one!) context, where it can be visited via [decls_begin(), decls_end()). Once a declaration has been added to its lexical context, the corresponding DeclContext owns the declaration.

If D is also a NamedDecl, it will be made visible within its semantic context via makeDeclVisibleInContext.

Definition at line 1060 of file DeclBase.cpp.

References addHiddenDecl().

Referenced by clang::Sema::ActOnExceptionDeclarator(), clang::Sema::ActOnFileScopeAsmDecl(), clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnFriendTypeDecl(), clang::Sema::ActOnModuleImport(), clang::Sema::ActOnPropertyImplDecl(), clang::Sema::ActOnStartCategoryImplementation(), clang::Sema::ActOnStartCategoryInterface(), clang::Sema::ActOnStartLinkageSpecification(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnStartOfLambdaDefinition(), clang::Sema::ActOnStaticAssertDeclaration(), clang::Sema::ActOnTemplatedFriendTag(), clang::ObjCImplDecl::addClassMethod(), clang::ObjCImplDecl::addInstanceMethod(), clang::ObjCImplDecl::addPropertyImplementation(), clang::Sema::BuildAnonymousStructOrUnion(), clang::ASTContext::BuildByRefType(), clang::Sema::BuildUsingDeclaration(), clang::Sema::BuildUsingShadowDecl(), clang::Sema::CreatePropertyDecl(), clang::Sema::DeclareImplicitCopyAssignment(), clang::Sema::DeclareImplicitCopyConstructor(), clang::Sema::DeclareImplicitDefaultConstructor(), clang::Sema::DeclareImplicitDestructor(), clang::Sema::DeclareImplicitMoveAssignment(), clang::Sema::DeclareImplicitMoveConstructor(), clang::Sema::DeclareInheritedConstructors(), clang::CodeGen::CodeGenModule::GetAddrOfConstantString(), clang::ASTContext::getBlockDescriptorExtendedType(), clang::ASTContext::getBlockDescriptorType(), clang::ASTContext::getCFConstantStringType(), clang::CodeGen::CodeGenModule::getObjCFastEnumerationStateType(), clang::Sema::HandleField(), clang::CompilerInstance::loadModule(), clang::Sema::ProcessPropertyDecl(), clang::TemplateDeclInstantiator::VisitClassTemplateDecl(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), clang::TemplateDeclInstantiator::VisitCXXRecordDecl(), clang::TemplateDeclInstantiator::VisitEnumDecl(), clang::TemplateDeclInstantiator::VisitFieldDecl(), clang::TemplateDeclInstantiator::VisitFriendDecl(), clang::TemplateDeclInstantiator::VisitFunctionTemplateDecl(), clang::TemplateDeclInstantiator::VisitIndirectFieldDecl(), clang::TemplateDeclInstantiator::VisitLabelDecl(), clang::TemplateDeclInstantiator::VisitNamespaceAliasDecl(), clang::TemplateDeclInstantiator::VisitTypeAliasDecl(), clang::TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(), clang::TemplateDeclInstantiator::VisitTypedefDecl(), clang::TemplateDeclInstantiator::VisitUsingDecl(), clang::TemplateDeclInstantiator::VisitUsingDirectiveDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().

void DeclContext::addDeclInternal ( Decl D)
void DeclContext::addHiddenDecl ( Decl D)

Add the declaration D to this context without modifying any lookup tables.

This is useful for some operations in dependent contexts where the semantic context might not be dependent; this basically only happens with friends.

Definition at line 1034 of file DeclBase.cpp.

References clang::ASTContext::addedLocalImportDecl(), FirstDecl, clang::Decl::getASTContext(), clang::Decl::getLexicalDeclContext(), clang::Decl::getNextDeclInContext(), clang::Decl::isFromASTFile(), LastDecl, and clang::Decl::NextInContextAndBits.

Referenced by clang::Sema::ActOnAccessSpecifier(), addDecl(), addDeclInternal(), and clang::TemplateDeclInstantiator::VisitAccessSpecDecl().

std::pair< Decl *, Decl * > DeclContext::BuildDeclChain ( const SmallVectorImpl< Decl * > &  Decls,
bool  FieldsAlreadyLoaded 
) [static, protected]

Build up a chain of declarations.

Returns:
the first/last pair of declarations.

Definition at line 862 of file DeclBase.cpp.

References clang::Decl::NextInContextAndBits.

bool DeclContext::classof ( const Decl D) [static]
static bool clang::DeclContext::classof ( const DeclContext D) [inline, static]

Definition at line 1482 of file DeclBase.h.

void DeclContext::collectAllContexts ( llvm::SmallVectorImpl< DeclContext * > &  Contexts)

\brief Collects all of the declaration contexts that are semantically connected to this declaration context.

For declaration contexts that have multiple semantically connected but syntactically distinct contexts, such as C++ namespaces, this routine retrieves the complete set of such declaration contexts in source order. For example, given:

 namespace N {
   int x;
 }
 namespace N {
   int y;
 }

The Contexts parameter will contain both definitions of N.

Parameters:
ContextsWill be cleared and set to the set of declaration contexts that are semanticaly connected to this declaration context, in source order, including this context (which may be the only result, for non-namespace contexts).

Definition at line 845 of file DeclBase.cpp.

References clang::Redeclarable< decl_type >::getMostRecentDecl(), and clang::Redeclarable< decl_type >::getPreviousDecl().

Referenced by LookupVisibleDecls().

DeclContext::ddiag_iterator clang::DeclContext::ddiag_begin ( ) const [inline]
DeclContext::ddiag_iterator clang::DeclContext::ddiag_end ( ) const [inline]

Definition at line 186 of file DependentDiagnostic.h.

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

DeclContext::decl_iterator DeclContext::decls_begin ( ) const
bool DeclContext::decls_empty ( ) const

Definition at line 984 of file DeclBase.cpp.

References FirstDecl, and hasExternalLexicalStorage().

Referenced by clang::LinkageSpecDecl::getLocEnd().

DeclContext::decl_iterator DeclContext::decls_end ( ) const
void DeclContext::dumpDeclContext ( ) const
bool DeclContext::Encloses ( const DeclContext DC) const
bool clang::DeclContext::Equals ( const DeclContext DC) const [inline]
Decl::Kind clang::DeclContext::getDeclKind ( ) const [inline]
const char * DeclContext::getDeclKindName ( ) const

Definition at line 82 of file DeclBase.cpp.

DeclContext * DeclContext::getEnclosingNamespaceContext ( )
const DeclContext* clang::DeclContext::getEnclosingNamespaceContext ( ) const [inline]

Definition at line 1116 of file DeclBase.h.

References getEnclosingNamespaceContext().

DeclContext* clang::DeclContext::getLexicalParent ( ) [inline]

getLexicalParent - Returns the containing lexical DeclContext. May be different from getParent, e.g.:

namespace A { struct S; } struct A::S {}; // getParent() == namespace 'A' getLexicalParent() == translation unit

Definition at line 991 of file DeclBase.h.

Referenced by clang::Sema::DiagnoseEmptyLookup(), clang::Sema::getContainingDC(), getLexicalParent(), getLookupParent(), and isDependentContext().

const DeclContext* clang::DeclContext::getLexicalParent ( ) const [inline]

Definition at line 994 of file DeclBase.h.

References getLexicalParent().

DeclContext * DeclContext::getLookupParent ( )

Find the parent context of this context that will be used for unqualified name lookup.

Generally, the parent lookup context is the semantic context. However, for a friend function the parent lookup context is the lexical context, which is the class in which the friend is declared.

Definition at line 713 of file DeclBase.cpp.

References getLexicalParent(), getParent(), getRedeclContext(), isFileContext(), and isRecord().

Referenced by clang::Sema::CheckClassTemplate(), clang::Sema::CheckTemplateIdType(), getLookupParent(), and LookupVisibleDecls().

const DeclContext* clang::DeclContext::getLookupParent ( ) const [inline]

Definition at line 1000 of file DeclBase.h.

References getLookupParent().

StoredDeclsMap* clang::DeclContext::getLookupPtr ( ) const [inline]

Retrieve the internal representation of the lookup structure.

Definition at line 1452 of file DeclBase.h.

Referenced by clang::ASTDeclWriter::VisitNamespaceDecl().

DeclContext * DeclContext::getNonClosureAncestor ( )

Find the nearest non-closure ancestor of this context, i.e. the innermost semantic parent of this context which is not a closure. A context may be its own non-closure ancestor.

Definition at line 670 of file DeclBase.cpp.

References isClosure().

Referenced by getNonClosureAncestor(), clang::Decl::getNonClosureContext(), clang::Sema::isSelfExpr(), and LookupMethodInReceiverType().

const DeclContext* clang::DeclContext::getNonClosureAncestor ( ) const [inline]

Definition at line 1091 of file DeclBase.h.

References getNonClosureAncestor().

DeclContext* clang::DeclContext::getParent ( ) [inline]

getParent - Returns the containing DeclContext.

Reimplemented in clang::CXXMethodDecl.

Definition at line 975 of file DeclBase.h.

Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnStartOfLambdaDefinition(), clang::Sema::ActOnTag(), clang::Sema::ActOnUsingDirective(), CheckAddressOfOperand(), clang::Sema::CheckConstexprFunctionBody(), clang::Sema::CheckConstexprFunctionDecl(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckFunctionDeclaration(), clang::Sema::CheckQualifiedMemberReference(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CheckUsingShadowDecl(), ClassifyImplicitMemberAccess(), CollectEnclosingNamespace(), clang::ASTContext::DeclMustBeEmitted(), DiagnoseAccessPath(), clang::Sema::DiagnoseEmptyLookup(), clang::DiagnoseTwoPhaseLookup(), diagnoseUncapturableValueReference(), dumpDeclContext(), Encloses(), clang::Sema::FindInstantiatedDecl(), findOuterContext(), clang::CodeGen::CodeGenVTables::GenerateClassData(), getCurrentInstantiationOf(), getEnclosingNamespaceContext(), clang::Sema::getFunctionLevelDeclContext(), getLookupParent(), getLVForNamespaceScopeDecl(), getParent(), clang::NamedDecl::getQualifiedNameAsString(), getRedeclContext(), clang::Sema::getTemplateInstantiationArgs(), clang::Decl::getTranslationUnitDecl(), clang::Sema::HandleDeclarator(), handleIBOutletCollection(), IgnoreLinkageSpecDecls(), InEnclosingNamespaceSetOf(), clang::Sema::InstantiateMemInitializers(), IsAccessible(), clang::NamedDecl::isCXXClassMember(), isDependentContext(), isExternCContext(), clang::Decl::isInAnonymousNamespace(), clang::Sema::IsInsideALocalClassWithinATemplateFunction(), isStd(), IsUsingDirectiveInToplevelContext(), clang::MangleContext::mangleBlock(), clang::Sema::MatchTemplateParametersToScopeSpecifier(), MaybeAddOverrideCalls(), clang::CodeGen::CGRecordLayout::print(), clang::Sema::TryCaptureVar(), clang::TemplateDeclInstantiator::VisitClassTemplateDecl(), and clang::ASTDeclWriter::VisitNamespaceDecl().

const DeclContext* clang::DeclContext::getParent ( ) const [inline]

Reimplemented in clang::CXXMethodDecl.

Definition at line 978 of file DeclBase.h.

References getParent().

ASTContext& clang::DeclContext::getParentASTContext ( ) const [inline]
DeclContext * DeclContext::getPrimaryContext ( )

getPrimaryContext - There may be many different declarations of the same entity (including forward declarations of classes, multiple definitions of namespaces, etc.), each with a different set of declarations. This routine returns the "primary" DeclContext structure, which will contain the information needed to perform name lookup into this context.

Definition at line 782 of file DeclBase.cpp.

References clang::TagType::getDecl(), clang::ObjCInterfaceDecl::getDefinition(), clang::ObjCProtocolDecl::getDefinition(), clang::TagDecl::getDefinition(), and clang::TagType::isBeingDefined().

Referenced by CollectEnclosingNamespace(), ddiag_begin(), Encloses(), Equals(), getEnclosingNamespaceContext(), getPrimaryContext(), clang::Sema::getScopeForContext(), clang::Sema::getScopeForDeclContext(), lookup(), LookupVisibleDecls(), MightInstantiateTo(), removeDecl(), and clang::ASTDeclWriter::VisitNamespaceDecl().

const DeclContext* clang::DeclContext::getPrimaryContext ( ) const [inline]

Definition at line 1102 of file DeclBase.h.

References getPrimaryContext().

DeclContext * DeclContext::getRedeclContext ( )

getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same name, or where it is a redeclaration if the two entities are compatible. This skips through transparent contexts.

Definition at line 1171 of file DeclBase.cpp.

References getParent(), and isTransparentContext().

Referenced by clang::Sema::ActOnEnumConstant(), clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnTag(), clang::Sema::ActOnTypedefNameDecl(), clang::Sema::CheckClassTemplate(), clang::Sema::CheckDependentFunctionTemplateSpecialization(), CheckExplicitInstantiationScope(), clang::Sema::CheckFunctionTemplateSpecialization(), clang::Sema::CheckObjCDeclScope(), CheckOperatorNewDeleteDeclarationScope(), CheckTemplateSpecializationScope(), clang::Sema::CheckUsingDeclRedeclaration(), getFunctionStorageClass(), getLookupParent(), getLVForDecl(), getLVForNamespaceScopeDecl(), clang::CodeCompletionResult::getPriorityFromDecl(), getRedeclContext(), handleWeakRefAttr(), clang::IdentifierResolver::isDeclInScope(), clang::VarDecl::isFunctionOrMethodVarDecl(), clang::FunctionDecl::isMain(), isOutOfScopePreviousDeclaration(), clang::FunctionDecl::isReservedGlobalPlacementOperator(), isSameEntity(), clang::Sema::LookupName(), clang::Sema::PushOnScopeChains(), clang::Sema::ShouldEnterDeclaratorScope(), clang::IdentifierResolver::tryAddTopLevelDecl(), clang::TemplateDeclInstantiator::VisitCXXRecordDecl(), and clang::ASTDeclWriter::VisitNamespaceDecl().

const DeclContext* clang::DeclContext::getRedeclContext ( ) const [inline]

Definition at line 1110 of file DeclBase.h.

References getRedeclContext().

DeclContext::udir_iterator_range DeclContext::getUsingDirectives ( ) const

Returns iterator range [First, Last) of UsingDirectiveDecls stored within this context.

Definition at line 1297 of file DeclBase.cpp.

References lookup().

Referenced by LookupQualifiedNameInUsingDirectives(), LookupVisibleDecls(), using_directives_begin(), and using_directives_end().

bool clang::DeclContext::hasExternalLexicalStorage ( ) const [inline]

Whether this DeclContext has external storage containing additional declarations that are lexically in this context.

Definition at line 1456 of file DeclBase.h.

Referenced by decls_begin(), decls_empty(), decls_end(), clang::RecordDecl::field_begin(), clang::ASTContext::getASTRecordLayout(), localUncachedLookup(), and clang::Sema::RequireCompleteType().

bool clang::DeclContext::hasExternalVisibleStorage ( ) const [inline]

Whether this DeclContext has external storage containing additional declarations that are visible in this context.

Definition at line 1466 of file DeclBase.h.

Referenced by clang::ASTReader::FindExternalVisibleDeclsByName(), localUncachedLookup(), and lookup().

bool DeclContext::InEnclosingNamespaceSetOf ( const DeclContext NS) const

Test if this context is part of the enclosing namespace set of the context NS, as defined in C++0x [namespace.def]p9. If either context isn't a namespace, this is equivalent to Equals().

The enclosing namespace set of a namespace is the namespace and, if it is inline, its enclosing namespace, recursively.

Definition at line 1187 of file DeclBase.cpp.

References Equals(), getParent(), isFileContext(), and clang::NamespaceDecl::isInline().

Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::CheckDependentFunctionTemplateSpecialization(), CheckExplicitInstantiationScope(), clang::Sema::CheckFunctionTemplateSpecialization(), CheckTemplateSpecializationScope(), clang::IdentifierResolver::isDeclInScope(), and clang::Sema::isStdInitializerList().

bool clang::DeclContext::isClosure ( ) const [inline]

Definition at line 1008 of file DeclBase.h.

Referenced by getNonClosureAncestor().

bool clang::DeclContext::isDeclInLexicalTraversal ( const Decl D) const [inline]

Determine whether the given declaration is stored in the list of declarations lexically within this context.

Definition at line 1476 of file DeclBase.h.

References FirstDecl, LastDecl, and clang::Decl::NextInContextAndBits.

bool DeclContext::isDependentContext ( ) const

Determines whether this context is dependent on a template parameter.

Definition at line 728 of file DeclBase.cpp.

References getLexicalParent(), getParent(), isDependentContext(), and isFileContext().

Referenced by clang::Sema::ActOnCXXEnterDeclaratorScope(), clang::Sema::ActOnDependentTemplateName(), clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnFunctionDeclarator(), AddOrdinaryNameResults(), clang::CXXMethodDecl::addOverriddenMethod(), clang::Sema::BuildBaseInitializer(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildMemberInitializer(), clang::Sema::BuildQualifiedDeclarationNameExpr(), CanDeclareSpecialMemberFunction(), clang::Sema::CheckClassTemplate(), clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckPureMethod(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckUsingDeclQualifier(), clang::Sema::CodeCompleteMemberReferenceExpr(), computeDeclRefDependence(), ddiag_begin(), DiagnoseBaseOrMemInitializerOrder(), clang::CodeGen::CodeGenModule::EmitTopLevelDecl(), clang::Sema::FinalizeVarWithDestructor(), clang::Sema::FindInstantiatedDecl(), clang::Sema::getDestructorName(), clang::Sema::getTypeName(), clang::Sema::HandleDeclarator(), clang::CXXRecordDecl::hasAnyDependentBases(), clang::TemplateArgument::isDependent(), isDependentContext(), IsDerivedFromInclusive(), clang::TemplateArgument::isInstantiationDependent(), clang::Sema::isNonTypeNestedNameSpecifier(), clang::Expr::isPotentialConstantExpr(), IsPotentiallyEvaluatedContext(), clang::Sema::LookupParsedName(), clang::Sema::LookupQualifiedName(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), clang::Sema::MarkVTableUsed(), clang::CXXRecordDecl::mayBeAbstract(), clang::Sema::MergeCXXFunctionDecl(), MightInstantiateTo(), clang::Sema::SetCtorInitializers(), and clang::Sema::ShouldWarnIfUnusedFileScopedDecl().

bool DeclContext::isExternCContext ( ) const

Determines whether this context is, or is nested within, a C++ extern "C" linkage spec.

Definition at line 761 of file DeclBase.cpp.

References getParent(), and clang::LinkageSpecDecl::lang_c.

Referenced by getLVForNamespaceScopeDecl(), clang::VarDecl::isExternC(), and clang::FunctionDecl::isExternC().

bool clang::DeclContext::isFileContext ( ) const [inline]
bool clang::DeclContext::isFunctionOrMethod ( ) const [inline]
bool DeclContext::isInlineNamespace ( ) const

Definition at line 723 of file DeclBase.cpp.

References isNamespace().

Referenced by CollectEnclosingNamespace().

bool clang::DeclContext::isNamespace ( ) const [inline]
bool clang::DeclContext::isObjCContainer ( ) const [inline]
bool clang::DeclContext::isRecord ( ) const [inline]
bool clang::DeclContext::isTranslationUnit ( ) const [inline]
bool DeclContext::isTransparentContext ( ) const

isTransparentContext - Determines whether this context is a "transparent" context, meaning that the members declared in this context are semantically declared in the nearest enclosing non-transparent (opaque) context but are lexically declared in this context. For example, consider the enumerators of an enumeration type:

 enum E {
   Val1
 };

Here, E is a transparent context, so its enumerator (Val1) will appear (semantically) that it is in the same context of E. Examples of transparent contexts include: enumerations (except for C++0x scoped enums), and C++ linkage specifications.

Definition at line 752 of file DeclBase.cpp.

Referenced by clang::Sema::ActOnTag(), clang::Sema::CheckQualifiedMemberReference(), CollectEnclosingNamespace(), and getRedeclContext().

void DeclContext::localUncachedLookup ( DeclarationName  Name,
llvm::SmallVectorImpl< NamedDecl * > &  Results 
)
DeclContext::lookup_result DeclContext::lookup ( DeclarationName  Name)

lookup - Find the declarations (if any) with the given Name in this context. Returns a range of iterators that contains all of the declarations with this name, with object, function, member, and enumerator names preceding any tag name. Note that this routine will not look into parent contexts.

If there is no lookup data structure, build one now by walking all of the linked DeclContexts (in declaration order!) and inserting their values.

Definition at line 1101 of file DeclBase.cpp.

References clang::ExternalASTSource::FindExternalVisibleDeclsByName(), clang::ASTContext::getExternalSource(), getParentASTContext(), getPrimaryContext(), hasExternalVisibleStorage(), and lookup().

Referenced by clang::Sema::ActOnStartNamespaceDef(), clang::Sema::BuildMemInitializer(), clang::Sema::CheckCompletedCXXClass(), clang::Sema::DeclareGlobalAllocationFunction(), clang::Sema::DiagnoseHiddenVirtualMethods(), FindHiddenVirtualMethod(), clang::Sema::FindInstantiatedDecl(), clang::CXXRecordDecl::FindNestedNameSpecifierMember(), clang::CXXRecordDecl::FindOrdinaryMember(), FindOverriddenMethod(), clang::ObjCPropertyDecl::findPropertyDecl(), clang::CXXRecordDecl::FindTagMember(), clang::LambdaExpr::getCallOperator(), clang::CXXRecordDecl::getCopyAssignmentOperator(), clang::CXXRecordDecl::getCopyConstructor(), clang::idx::EntityImpl::getDecl(), getDefaultedDefaultConstructorUnsafe(), clang::CXXRecordDecl::getDestructor(), clang::ObjCContainerDecl::getIvarDecl(), clang::ObjCContainerDecl::getMethod(), getUsingDirectives(), clang::CXXMethodDecl::isUsualDeallocationFunction(), localUncachedLookup(), lookup(), LookupAnyMember(), clang::Sema::LookupConstructors(), LookupDirect(), clang::TreeTransform< Derived >::RebuildShuffleVectorExpr(), clang::TemplateDeclInstantiator::VisitClassTemplateDecl(), clang::TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(), clang::ASTDeclWriter::VisitNamespaceDecl(), and clang::TemplateDeclInstantiator::VisitTypeAliasTemplateDecl().

DeclContext::lookup_const_result DeclContext::lookup ( DeclarationName  Name) const

Definition at line 1135 of file DeclBase.cpp.

References lookup().

void DeclContext::makeDeclVisibleInContext ( NamedDecl D,
bool  Recoverable = true 
)

Makes a declaration visible within this context.

This routine makes the declaration D visible to name lookup within this context and, if this is a transparent context, within its parent contexts up to the first enclosing non-transparent context. Making a declaration visible within a context does not transfer ownership of a declaration, and a declaration can be visible in many contexts that aren't its lexical context.

If D is a redeclaration of an existing declaration that is visible from this context, as determined by NamedDecl::declarationReplaces, the previous declaration will be replaced with D.

Parameters:
Recoverabletrue if it's okay to not add this decl to the lookup tables because it can be easily recovered by walking the declaration chains.

Definition at line 1205 of file DeclBase.cpp.

Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnPropertyImplDecl(), clang::Sema::ActOnTag(), clang::Sema::CheckClassTemplate(), clang::TemplateDeclInstantiator::VisitClassTemplateDecl(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), and clang::TemplateDeclInstantiator::VisitVarDecl().

DeclContext::decl_iterator DeclContext::noload_decls_begin ( ) const

noload_decls_begin/end - Iterate over the declarations stored in this context that are currently loaded; don't attempt to retrieve anything from an external source.

Definition at line 962 of file DeclBase.cpp.

References FirstDecl.

DeclContext::decl_iterator DeclContext::noload_decls_end ( ) const

Definition at line 966 of file DeclBase.cpp.

void DeclContext::removeDecl ( Decl D)
void clang::DeclContext::setHasExternalLexicalStorage ( bool  ES = true) [inline]

State whether this DeclContext has external storage for declarations lexically in this context.

Definition at line 1460 of file DeclBase.h.

void clang::DeclContext::setHasExternalVisibleStorage ( bool  ES = true) [inline]

State whether this DeclContext has external storage for declarations visible in this context.

Definition at line 1470 of file DeclBase.h.

udir_iterator clang::DeclContext::using_directives_begin ( ) const [inline]

Definition at line 1436 of file DeclBase.h.

References getUsingDirectives().

Referenced by LookupQualifiedNameInUsingDirectives().

udir_iterator clang::DeclContext::using_directives_end ( ) const [inline]

Definition at line 1440 of file DeclBase.h.

References getUsingDirectives().

Referenced by LookupQualifiedNameInUsingDirectives().


Friends And Related Function Documentation

friend class DependentDiagnostic [friend]

Definition at line 1502 of file DeclBase.h.

friend class ExternalASTSource [friend]

Definition at line 953 of file DeclBase.h.


Member Data Documentation

Decl* clang::DeclContext::FirstDecl [mutable, protected]
Decl* clang::DeclContext::LastDecl [mutable, protected]

LastDecl - The last declaration stored within this declaration context. FIXME: We could probably cache this value somewhere outside of the DeclContext, to reduce the size of DeclContext by another pointer.

Definition at line 951 of file DeclBase.h.

Referenced by addHiddenDecl(), isDeclInLexicalTraversal(), and removeDecl().


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