clang API Documentation
#include <IdentifierResolver.h>
Classes | |
class | IdDeclInfo |
class | IdDeclInfoMap |
class | iterator |
Public Member Functions | |
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 |
void | AddDecl (NamedDecl *D) |
AddDecl - Link the decl to its shadowed decl chain. | |
void | RemoveDecl (NamedDecl *D) |
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 (Preprocessor &PP) | |
~IdentifierResolver () |
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 35 of file IdentifierResolver.h.
IdentifierResolver::IdentifierResolver | ( | Preprocessor & | PP | ) | [explicit] |
Definition at line 85 of file IdentifierResolver.cpp.
Definition at line 90 of file IdentifierResolver.cpp.
void IdentifierResolver::AddDecl | ( | NamedDecl * | D | ) |
AddDecl - Link the decl to its shadowed decl chain.
Definition at line 142 of file IdentifierResolver.cpp.
References clang::DeclarationName::getAsIdentifierInfo(), clang::NamedDecl::getDeclName(), clang::DeclarationName::getFETokenInfo(), and clang::DeclarationName::setFETokenInfo().
Referenced by clang::Sema::ActOnDelayedCXXMethodParameter(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnObjCExceptionDecl(), clang::Sema::ActOnReenterCXXMethodParameter(), clang::Sema::ActOnReenterTemplateScope(), and InsertDeclAfter().
begin - Returns an iterator for decls with the name 'Name'.
begin - Returns an iterator for decls with name 'Name'.
Definition at line 228 of file IdentifierResolver.cpp.
References end(), clang::DeclarationName::getAsIdentifierInfo(), and clang::DeclarationName::getFETokenInfo().
Referenced by clang::Sema::addImplicitTypedef(), and clang::Sema::Initialize().
iterator clang::IdentifierResolver::end | ( | ) | [inline] |
end - Returns an iterator that has 'finished'.
Definition at line 145 of file IdentifierResolver.h.
Referenced by clang::Sema::addImplicitTypedef(), begin(), and clang::Sema::Initialize().
void IdentifierResolver::InsertDeclAfter | ( | iterator | Pos, |
NamedDecl * | D | ||
) |
Insert the given declaration after the given iterator position.
Definition at line 167 of file IdentifierResolver.cpp.
References AddDecl(), clang::DeclarationName::getAsIdentifierInfo(), clang::NamedDecl::getDeclName(), clang::DeclarationName::getFETokenInfo(), clang::IdentifierResolver::iterator::getIterator(), clang::IdentifierResolver::iterator::isIterator(), and RemoveDecl().
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. |
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.
Definition at line 97 of file IdentifierResolver.cpp.
References clang::Scope::ControlScope, clang::DeclContext::Equals(), clang::Scope::FnTryCatchScope, clang::Decl::getDeclContext(), clang::Scope::getEntity(), clang::Scope::getFlags(), clang::Scope::getParent(), clang::DeclContext::getRedeclContext(), clang::DeclContext::InEnclosingNamespaceSetOf(), clang::Scope::isDeclScope(), clang::DeclContext::isFunctionOrMethod(), clang::Scope::isFunctionPrototypeScope(), and clang::DeclContext::isTransparentContext().
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 207 of file IdentifierResolver.cpp.
References clang::DeclarationName::getAsIdentifierInfo(), clang::NamedDecl::getDeclName(), clang::DeclarationName::getFETokenInfo(), and clang::DeclarationName::setFETokenInfo().
Referenced by clang::Sema::HideUsingShadowDecl(), and InsertDeclAfter().
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 293 of file IdentifierResolver.cpp.
References compareDeclarations(), clang::DeclarationName::getAsIdentifierInfo(), clang::Decl::getDeclContext(), clang::DeclarationName::getFETokenInfo(), clang::DeclContext::getRedeclContext(), clang::DeclContext::isTranslationUnit(), and clang::DeclarationName::setFETokenInfo().
Referenced by clang::Sema::DeclareGlobalAllocationFunction().