clang 20.0.0git
Classes | Public Member Functions | List of all members
clang::IdentifierResolver Class Reference

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 ()
 
 IdentifierResolver (const IdentifierResolver &)=delete
 
IdentifierResolveroperator= (const IdentifierResolver &)=delete
 
llvm::iterator_range< iteratordecls (DeclarationName Name)
 Returns a range of decls with the name 'Name'.
 
iterator begin (DeclarationName Name)
 Returns an iterator over decls with the name 'Name'.
 
iterator end ()
 Returns the end iterator.
 
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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ IdentifierResolver() [1/2]

IdentifierResolver::IdentifierResolver ( Preprocessor PP)
explicit

Definition at line 92 of file IdentifierResolver.cpp.

◆ ~IdentifierResolver()

IdentifierResolver::~IdentifierResolver ( )

Definition at line 95 of file IdentifierResolver.cpp.

◆ IdentifierResolver() [2/2]

clang::IdentifierResolver::IdentifierResolver ( const IdentifierResolver )
delete

Member Function Documentation

◆ AddDecl()

void IdentifierResolver::AddDecl ( NamedDecl D)

◆ begin()

IdentifierResolver::iterator IdentifierResolver::begin ( DeclarationName  Name)

Returns an iterator over decls with the name 'Name'.

Definition at line 244 of file IdentifierResolver.cpp.

References end().

Referenced by clang::Sema::addImplicitTypedef(), decls(), clang::Sema::Initialize(), clang::Sema::LookupName(), and clang::Sema::PushOnScopeChains().

◆ decls()

llvm::iterator_range< IdentifierResolver::iterator > IdentifierResolver::decls ( DeclarationName  Name)

Returns a range of decls with the name 'Name'.

Definition at line 240 of file IdentifierResolver.cpp.

References begin(), and end().

◆ end()

iterator clang::IdentifierResolver::end ( )
inline

◆ InsertDeclAfter()

void IdentifierResolver::InsertDeclAfter ( iterator  Pos,
NamedDecl D 
)

Insert the given declaration after the given iterator position.

Definition at line 180 of file IdentifierResolver.cpp.

References AddDecl(), D, clang::IdentifierResolver::iterator::getIterator(), clang::IdentifierResolver::iterator::isIterator(), and RemoveDecl().

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

◆ isDeclInScope()

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.

Parameters
AllowInlineNamespaceIf 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 102 of file IdentifierResolver.cpp.

References D, clang::DeclContext::Equals(), clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), clang::DeclContext::InEnclosingNamespaceSetOf(), and clang::DeclContext::isFunctionOrMethod().

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

◆ operator=()

IdentifierResolver & clang::IdentifierResolver::operator= ( const IdentifierResolver )
delete

◆ RemoveDecl()

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 220 of file IdentifierResolver.cpp.

References D.

Referenced by clang::Sema::ActOnPopScope(), clang::IncrementalParser::CleanUpPTU(), clang::Sema::HideUsingShadowDecl(), InsertDeclAfter(), clang::Sema::MergeTypedefNameDecl(), clang::SemaObjC::popObjCTypeParamList(), and clang::Sema::PushOnScopeChains().

◆ tryAddTopLevelDecl()

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.

Parameters
DThe externally-produced declaration to add.
NameThe name of the externally-produced declaration.
Returns
true if the declaration was added, false otherwise.

Definition at line 316 of file IdentifierResolver.cpp.

References compareDeclarations(), D, clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), and clang::DeclContext::isTranslationUnit().

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


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