clang 17.0.0git
|
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes. More...
#include "clang/Sema/IdentifierResolver.h"
Classes | |
class | IdDeclInfoMap |
IdDeclInfoMap - Associates IdDeclInfos with declaration names. More... | |
class | iterator |
iterator - Iterate over the decls of a specified declaration name. More... | |
Public Member Functions | |
IdentifierResolver (Preprocessor &PP) | |
~IdentifierResolver () | |
iterator | begin (DeclarationName Name) |
begin - Returns an iterator for decls with the name 'Name'. | |
iterator | end () |
end - Returns an iterator that has 'finished'. | |
bool | isDeclInScope (Decl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const |
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns true if 'D' belongs to the given declaration context. | |
void | AddDecl (NamedDecl *D) |
AddDecl - Link the decl to its shadowed decl chain. | |
void | RemoveDecl (NamedDecl *D) |
RemoveDecl - Unlink the decl from its shadowed decl chain. | |
void | InsertDeclAfter (iterator Pos, NamedDecl *D) |
Insert the given declaration after the given iterator position. | |
bool | tryAddTopLevelDecl (NamedDecl *D, DeclarationName Name) |
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't already been added. | |
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
It manages the shadowing chains of declaration names and implements efficient decl lookup based on a declaration name.
Definition at line 38 of file IdentifierResolver.h.
|
explicit |
Definition at line 89 of file IdentifierResolver.cpp.
IdentifierResolver::~IdentifierResolver | ( | ) |
Definition at line 92 of file IdentifierResolver.cpp.
void IdentifierResolver::AddDecl | ( | NamedDecl * | D | ) |
AddDecl - Link the decl to its shadowed decl chain.
Definition at line 150 of file IdentifierResolver.cpp.
References clang::NamedDecl::getDeclName().
Referenced by clang::Sema::ActOnDelayedCXXMethodParameter(), clang::Sema::ActOnIvar(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnNonTypeTemplateParameter(), clang::Sema::ActOnObjCExceptionDecl(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnReenterCXXMethodParameter(), clang::Sema::ActOnReenterFunctionContext(), clang::Sema::ActOnReenterTemplateScope(), clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::ActOnTypeParameter(), InsertDeclAfter(), and clang::Sema::PushOnScopeChains().
IdentifierResolver::iterator IdentifierResolver::begin | ( | DeclarationName | Name | ) |
begin - Returns an iterator for decls with the name 'Name'.
begin - Returns an iterator for decls with name 'Name'.
Definition at line 236 of file IdentifierResolver.cpp.
References end().
Referenced by clang::Sema::addImplicitTypedef(), clang::Sema::Initialize(), clang::Sema::LookupName(), and clang::Sema::PushOnScopeChains().
|
inline |
end - Returns an iterator that has 'finished'.
Definition at line 141 of file IdentifierResolver.h.
Referenced by clang::Sema::addImplicitTypedef(), begin(), clang::Sema::Initialize(), clang::Sema::LookupName(), and clang::Sema::PushOnScopeChains().
Insert the given declaration after the given iterator position.
Definition at line 175 of file IdentifierResolver.cpp.
References AddDecl(), clang::NamedDecl::getDeclName(), clang::IdentifierResolver::iterator::getIterator(), clang::IdentifierResolver::iterator::isIterator(), and RemoveDecl().
Referenced by clang::Sema::PushOnScopeChains().
bool IdentifierResolver::isDeclInScope | ( | Decl * | D, |
DeclContext * | Ctx, | ||
Scope * | S = nullptr , |
||
bool | AllowInlineNamespace = false |
||
) | const |
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns true if 'D' belongs to the given declaration context.
AllowInlineNamespace | If true , we are checking whether a prior declaration is in scope in a declaration that requires a prior declaration (because it is either explicitly qualified or is a template instantiation or specialization). In this case, a declaration is in scope if it's in the inline namespace set of the context. |
Definition at line 99 of file IdentifierResolver.cpp.
References clang::DeclContext::Equals(), clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), clang::DeclContext::InEnclosingNamespaceSetOf(), and clang::DeclContext::isFunctionOrMethod().
Referenced by clang::Sema::isDeclInScope().
void IdentifierResolver::RemoveDecl | ( | NamedDecl * | D | ) |
RemoveDecl - Unlink the decl from its shadowed decl chain.
The decl must already be part of the decl chain.
Definition at line 215 of file IdentifierResolver.cpp.
References clang::NamedDecl::getDeclName().
Referenced by clang::Sema::ActOnPopScope(), clang::Sema::HideUsingShadowDecl(), InsertDeclAfter(), clang::Sema::MergeTypedefNameDecl(), clang::Sema::popObjCTypeParamList(), and clang::Sema::PushOnScopeChains().
bool IdentifierResolver::tryAddTopLevelDecl | ( | NamedDecl * | D, |
DeclarationName | Name | ||
) |
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't already been added.
D | The externally-produced declaration to add. |
Name | The name of the externally-produced declaration. |
Definition at line 308 of file IdentifierResolver.cpp.
References compareDeclarations(), clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), and clang::DeclContext::isTranslationUnit().
Referenced by clang::Sema::DeclareGlobalAllocationFunction().