clang 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::LookupResult Class Reference

Represents the results of name lookup. More...

#include "clang/Sema/Lookup.h"

Classes

class  Filter
 A class for iterating through a result set and possibly filtering out results. More...
 

Public Types

enum  LookupResultKind {
  NotFound = 0 , NotFoundInCurrentInstantiation , Found , FoundOverloaded ,
  FoundUnresolvedValue , Ambiguous
}
 
enum  AmbiguityKind {
  AmbiguousBaseSubobjectTypes , AmbiguousBaseSubobjects , AmbiguousReference , AmbiguousReferenceToPlaceholderVariable ,
  AmbiguousTagHiding
}
 
enum  TemporaryToken { Temporary }
 A little identifier for flagging temporary lookup results. More...
 
using iterator = UnresolvedSetImpl::iterator
 

Public Member Functions

 LookupResult (Sema &SemaRef, const DeclarationNameInfo &NameInfo, Sema::LookupNameKind LookupKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
 
 LookupResult (Sema &SemaRef, DeclarationName Name, SourceLocation NameLoc, Sema::LookupNameKind LookupKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
 
 LookupResult (TemporaryToken _, const LookupResult &Other)
 Creates a temporary lookup result, initializing its core data using the information from another result.
 
 LookupResult (const LookupResult &)=delete
 
LookupResultoperator= (const LookupResult &)=delete
 
 LookupResult (LookupResult &&Other)
 
LookupResultoperator= (LookupResult &&Other)
 
 ~LookupResult ()
 
const DeclarationNameInfogetLookupNameInfo () const
 Gets the name info to look up.
 
void setLookupNameInfo (const DeclarationNameInfo &NameInfo)
 Sets the name info to look up.
 
DeclarationName getLookupName () const
 Gets the name to look up.
 
void setLookupName (DeclarationName Name)
 Sets the name to look up.
 
Sema::LookupNameKind getLookupKind () const
 Gets the kind of lookup to perform.
 
bool isForRedeclaration () const
 True if this lookup is just looking for an existing declaration.
 
bool isForExternalRedeclaration () const
 True if this lookup is just looking for an existing declaration to link against a declaration with external linkage.
 
RedeclarationKind redeclarationKind () const
 
void setAllowHidden (bool AH)
 Specify whether hidden declarations are visible, e.g., for recovery reasons.
 
bool isHiddenDeclarationVisible (NamedDecl *ND) const
 Determine whether this lookup is permitted to see hidden declarations, such as those in modules that have not yet been imported.
 
void setHideTags (bool Hide)
 Sets whether tag declarations should be hidden by non-tag declarations during resolution.
 
void setTemplateNameLookup (bool TemplateName)
 Sets whether this is a template-name lookup.
 
bool isTemplateNameLookup () const
 
bool isAmbiguous () const
 
bool isSingleResult () const
 Determines if this names a single result which is not an unresolved value using decl.
 
bool isOverloadedResult () const
 Determines if the results are overloaded.
 
bool isUnresolvableResult () const
 
LookupResultKind getResultKind () const
 
AmbiguityKind getAmbiguityKind () const
 
const UnresolvedSetImplasUnresolvedSet () const
 
iterator begin () const
 
iterator end () const
 
bool empty () const
 Return true if no decls were found.
 
CXXBasePathsgetBasePaths () const
 Return the base paths structure that's associated with these results, or null if none is.
 
NamedDeclgetAcceptableDecl (NamedDecl *D) const
 Retrieve the accepted (re)declaration of the given declaration, if there is one.
 
unsigned getIdentifierNamespace () const
 Returns the identifier namespace mask for this lookup.
 
bool isClassLookup () const
 Returns whether these results arose from performing a lookup into a class.
 
CXXRecordDeclgetNamingClass () const
 Returns the 'naming class' for this lookup, i.e.
 
void setNamingClass (CXXRecordDecl *Record)
 Sets the 'naming class' for this lookup.
 
QualType getBaseObjectType () const
 Returns the base object type associated with this lookup; important for [class.protected].
 
void setBaseObjectType (QualType T)
 Sets the base object type for this lookup.
 
void addDecl (NamedDecl *D)
 Add a declaration to these results with its natural access.
 
void addDecl (NamedDecl *D, AccessSpecifier AS)
 Add a declaration to these results with the given access.
 
void addAllDecls (const LookupResult &Other)
 Add all the declarations from another set of lookup results.
 
bool wasNotFoundInCurrentInstantiation () const
 Determine whether no result was found because we could not search into dependent base classes of the current instantiation.
 
void setNotFoundInCurrentInstantiation ()
 Note that while no result was found in the current instantiation, there were dependent base classes that could not be searched.
 
bool isShadowed () const
 Determine whether the lookup result was shadowed by some other declaration that lookup ignored.
 
void setShadowed ()
 Note that we found and ignored a declaration while performing lookup.
 
void resolveKind ()
 Resolves the result kind of the lookup, possibly hiding decls.
 
void resolveKindAfterFilter ()
 Re-resolves the result kind of the lookup after a set of removals has been performed.
 
template<class DeclClass >
DeclClass * getAsSingle () const
 
NamedDeclgetFoundDecl () const
 Fetch the unique decl found by this lookup.
 
NamedDeclgetRepresentativeDecl () const
 Fetches a representative decl. Useful for lazy diagnostics.
 
bool isSingleTagDecl () const
 Asks if the result is a single tag decl.
 
void setAmbiguousBaseSubobjectTypes (CXXBasePaths &P)
 Make these results show that the name was found in base classes of different types.
 
void setAmbiguousBaseSubobjects (CXXBasePaths &P)
 Make these results show that the name was found in distinct base classes of the same type.
 
void setAmbiguousQualifiedTagHiding ()
 Make these results show that the name was found in different contexts and a tag decl was hidden by an ordinary decl in a different context.
 
LLVM_ATTRIBUTE_REINITIALIZES void clear ()
 Clears out any current state.
 
void clear (Sema::LookupNameKind Kind)
 Clears out any current state and re-initializes for a different kind of lookup.
 
void setRedeclarationKind (RedeclarationKind RK)
 Change this lookup's redeclaration kind.
 
void dump ()
 
void print (raw_ostream &)
 
void suppressDiagnostics ()
 Suppress the diagnostics that would normally fire because of this lookup.
 
void suppressAccessDiagnostics ()
 Suppress the diagnostics that would normally fire because of this lookup due to access control violations.
 
bool isSuppressingAccessDiagnostics () const
 Determines whether this lookup is suppressing access control diagnostics.
 
bool isSuppressingAmbiguousDiagnostics () const
 Determines whether this lookup is suppressing ambiguous lookup diagnostics.
 
void setContextRange (SourceRange SR)
 Sets a 'context' source range.
 
SourceRange getContextRange () const
 Gets the source range of the context of this name; for C++ qualified lookups, this is the source range of the scope specifier.
 
SourceLocation getNameLoc () const
 Gets the location of the identifier.
 
SemagetSema () const
 Get the Sema object that this lookup result is searching with.
 
Filter makeFilter ()
 Create a filter for this result set.
 
void setFindLocalExtern (bool FindLocalExtern)
 

Static Public Member Functions

static bool isVisible (Sema &SemaRef, NamedDecl *D)
 Determine whether the given declaration is visible to the program.
 
static bool isReachable (Sema &SemaRef, NamedDecl *D)
 
static bool isAcceptable (Sema &SemaRef, NamedDecl *D, Sema::AcceptableKind Kind)
 
static bool isAvailableForLookup (Sema &SemaRef, NamedDecl *ND)
 Determine whether this lookup is permitted to see the declaration.
 

Detailed Description

Represents the results of name lookup.

An instance of the LookupResult class captures the results of a single name lookup, which can return no result (nothing found), a single declaration, a set of overloaded functions, or an ambiguity. Use the getKind() method to determine which of these results occurred for a given lookup.

Definition at line 46 of file Lookup.h.

Member Typedef Documentation

◆ iterator

Definition at line 154 of file Lookup.h.

Member Enumeration Documentation

◆ AmbiguityKind

Enumerator
AmbiguousBaseSubobjectTypes 

Name lookup results in an ambiguity because multiple entities that meet the lookup criteria were found in subobjects of different types.

For example:

struct A { void f(int); }
struct B { void f(double); }
struct C : A, B { };
void test(C c) {
c.f(0); // error: A::f and B::f come from subobjects of different
// types. overload resolution is not performed.
}
__device__ __2f16 float c
AmbiguousBaseSubobjects 

Name lookup results in an ambiguity because multiple nonstatic entities that meet the lookup criteria were found in different subobjects of the same type.

For example:

struct A { int x; };
struct B : A { };
struct C : A { };
struct D : B, C { };
int test(D d) {
return d.x; // error: 'x' is found in two A subobjects (of B and C)
}
const Decl * D
AmbiguousReference 

Name lookup results in an ambiguity because multiple definitions of entity that meet the lookup criteria were found in different declaration contexts.

namespace A {
int i;
namespace B { int i; }
int test() {
using namespace B;
return i; // error 'i' is found in namespace A and A::B
}
}
AmbiguousReferenceToPlaceholderVariable 

Name lookup results in an ambiguity because multiple placeholder variables were found in the same scope.

void f() {
int _ = 0;
int _ = 0;
return _; // ambiguous use of placeholder variable
}
AmbiguousTagHiding 

Name lookup results in an ambiguity because an entity with a tag name was hidden by an entity with an ordinary name from a different context.

namespace A { struct Foo {}; }
namespace B { void Foo(); }
namespace C {
using namespace A;
using namespace B;
}
void test() {
C::Foo(); // error: tag 'A::Foo' is hidden by an object in a
// different namespace
}

Definition at line 76 of file Lookup.h.

◆ LookupResultKind

Enumerator
NotFound 

No entity found met the criteria.

NotFoundInCurrentInstantiation 

No entity found met the criteria within the current instantiation,, but there were dependent base classes of the current instantiation that could not be searched.

Found 

Name lookup found a single declaration that met the criteria.

getFoundDecl() will return this declaration.

FoundOverloaded 

Name lookup found a set of overloaded functions that met the criteria.

FoundUnresolvedValue 

Name lookup found an unresolvable value declaration and cannot yet complete.

This only happens in C++ dependent contexts with dependent using declarations.

Ambiguous 

Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we have.

Definition at line 48 of file Lookup.h.

◆ TemporaryToken

A little identifier for flagging temporary lookup results.

Enumerator
Temporary 

Definition at line 150 of file Lookup.h.

Constructor & Destructor Documentation

◆ LookupResult() [1/5]

clang::LookupResult::LookupResult ( Sema SemaRef,
const DeclarationNameInfo NameInfo,
Sema::LookupNameKind  LookupKind,
RedeclarationKind  Redecl = RedeclarationKind::NotForRedeclaration 
)
inline

Definition at line 156 of file Lookup.h.

◆ LookupResult() [2/5]

clang::LookupResult::LookupResult ( Sema SemaRef,
DeclarationName  Name,
SourceLocation  NameLoc,
Sema::LookupNameKind  LookupKind,
RedeclarationKind  Redecl = RedeclarationKind::NotForRedeclaration 
)
inline

Definition at line 171 of file Lookup.h.

◆ LookupResult() [3/5]

clang::LookupResult::LookupResult ( TemporaryToken  _,
const LookupResult Other 
)
inline

Creates a temporary lookup result, initializing its core data using the information from another result.

Diagnostics are always disabled.

Definition at line 186 of file Lookup.h.

◆ LookupResult() [4/5]

clang::LookupResult::LookupResult ( const LookupResult )
delete

◆ LookupResult() [5/5]

clang::LookupResult::LookupResult ( LookupResult &&  Other)
inline

Definition at line 198 of file Lookup.h.

References clang::Other.

◆ ~LookupResult()

clang::LookupResult::~LookupResult ( )
inline

Definition at line 246 of file Lookup.h.

Member Function Documentation

◆ addAllDecls()

void clang::LookupResult::addAllDecls ( const LookupResult Other)
inline

Add all the declarations from another set of lookup results.

Definition at line 488 of file Lookup.h.

References clang::UnresolvedSetImpl::append(), Found, and clang::Other.

Referenced by clang::Sema::CheckOverload(), and LookupQualifiedNameInUsingDirectives().

◆ addDecl() [1/2]

void clang::LookupResult::addDecl ( NamedDecl D)
inline

◆ addDecl() [2/2]

void clang::LookupResult::addDecl ( NamedDecl D,
AccessSpecifier  AS 
)
inline

Add a declaration to these results with the given access.

Does not test the acceptance criteria.

Definition at line 481 of file Lookup.h.

References clang::UnresolvedSetImpl::addDecl(), D, and Found.

◆ asUnresolvedSet()

const UnresolvedSetImpl & clang::LookupResult::asUnresolvedSet ( ) const
inline

◆ begin()

iterator clang::LookupResult::begin ( ) const
inline

◆ clear() [1/2]

LLVM_ATTRIBUTE_REINITIALIZES void clang::LookupResult::clear ( )
inline

◆ clear() [2/2]

void clang::LookupResult::clear ( Sema::LookupNameKind  Kind)
inline

Clears out any current state and re-initializes for a different kind of lookup.

Definition at line 616 of file Lookup.h.

References clear(), and Kind.

◆ dump()

LLVM_DUMP_METHOD void LookupResult::dump ( )

◆ empty()

bool clang::LookupResult::empty ( ) const
inline

Return true if no decls were found.

Definition at line 362 of file Lookup.h.

References clang::UnresolvedSetImpl::empty().

Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnLambdaExpressionAfterIntroducer(), clang::Sema::ActOnNamespaceAliasDef(), clang::SemaOpenMP::ActOnOpenMPIdExpression(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnPragmaUnused(), clang::Sema::ActOnUsingDirective(), clang::Sema::BuildCXXNestedNameSpecifier(), buildDeclareReductionRef(), clang::Sema::BuildForRangeBeginEndCall(), clang::Sema::BuildImplicitMemberExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildMemInitializer(), BuildNonArrayForRange(), clang::Sema::BuildQualifiedDeclarationNameExpr(), clang::Sema::BuildQualifiedTemplateIdExpr(), BuildRecoveryCallExpr(), clang::Sema::BuildUsingDeclaration(), ClassifyImplicitMemberAccess(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseInvalidRedeclaration(), DiagnoseTwoPhaseLookup(), doesUsualArrayDeleteWantSize(), emitReplacement(), clang::Sema::EvaluateStaticAssertMessageAsString(), clang::Sema::FindAllocationFunctions(), clang::Interpreter::FindRuntimeInterface(), getTupleLikeElementType(), clang::Sema::isDeductionGuideName(), clang::Sema::isPotentialImplicitMemberAccess(), clang::Sema::isTemplateName(), isTupleLike(), clang::SemaObjC::LookupInObjCMethod(), clang::Sema::LookupInSuper(), clang::SemaObjC::LookupIvarInObjCMethod(), LookupMemberExprInRecord(), clang::LookupNamed(), clang::LookupNamespace(), LookupPotentialTypoResult(), LookupQualifiedNameInUsingDirectives(), clang::Sema::LookupTemplateName(), clang::MultiplexExternalSemaSource::LookupUnqualified(), resolveBuiltinNewDeleteOverload(), and clang::TreeTransform< Derived >::TransformOverloadExprDecls().

◆ end()

iterator clang::LookupResult::end ( ) const
inline

◆ getAcceptableDecl()

NamedDecl * clang::LookupResult::getAcceptableDecl ( NamedDecl D) const
inline

Retrieve the accepted (re)declaration of the given declaration, if there is one.

Definition at line 408 of file Lookup.h.

References D, getSema(), isAvailableForLookup(), and isHiddenDeclarationVisible().

Referenced by clang::Sema::CheckImplicitSpecialMemberDeclaration(), LookupDirect(), and clang::Sema::LookupName().

◆ getAmbiguityKind()

AmbiguityKind clang::LookupResult::getAmbiguityKind ( ) const
inline

Definition at line 349 of file Lookup.h.

References isAmbiguous().

◆ getAsSingle()

template<class DeclClass >
DeclClass * clang::LookupResult::getAsSingle ( ) const
inline

◆ getBaseObjectType()

QualType clang::LookupResult::getBaseObjectType ( ) const
inline

Returns the base object type associated with this lookup; important for [class.protected].

Most lookups do not have an associated base object.

Definition at line 464 of file Lookup.h.

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

◆ getBasePaths()

CXXBasePaths * clang::LookupResult::getBasePaths ( ) const
inline

Return the base paths structure that's associated with these results, or null if none is.

Definition at line 366 of file Lookup.h.

◆ getContextRange()

SourceRange clang::LookupResult::getContextRange ( ) const
inline

Gets the source range of the context of this name; for C++ qualified lookups, this is the source range of the scope specifier.

Definition at line 658 of file Lookup.h.

◆ getFoundDecl()

NamedDecl * clang::LookupResult::getFoundDecl ( ) const
inline

◆ getIdentifierNamespace()

unsigned clang::LookupResult::getIdentifierNamespace ( ) const
inline

Returns the identifier namespace mask for this lookup.

Definition at line 426 of file Lookup.h.

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

◆ getLookupKind()

Sema::LookupNameKind clang::LookupResult::getLookupKind ( ) const
inline

◆ getLookupName()

DeclarationName clang::LookupResult::getLookupName ( ) const
inline

◆ getLookupNameInfo()

const DeclarationNameInfo & clang::LookupResult::getLookupNameInfo ( ) const
inline

◆ getNameLoc()

SourceLocation clang::LookupResult::getNameLoc ( ) const
inline

◆ getNamingClass()

CXXRecordDecl * clang::LookupResult::getNamingClass ( ) const
inline

Returns the 'naming class' for this lookup, i.e.

the class which was looked into to find these results.

C++0x [class.access.base]p5: The access to a member is affected by the class in which the member is named. This naming class is the class in which the member name was looked up and found. [Note: this class can be explicit, e.g., when a qualified-id is used, or implicit, e.g., when a class member access operator (5.2.5) is used (including cases where an implicit "this->" is added). If both a class member access operator and a qualified-id are used to name the member (as in p->T::m), the class naming the member is the class named by the nested-name-specifier of the qualified-id (that is, T). – end note ]

This is set by the lookup routines when they find results in a class.

Definition at line 452 of file Lookup.h.

Referenced by clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildPossibleImplicitMemberExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::CheckLookupAccess(), ClassifyImplicitMemberAccess(), clang::Sema::DiagnoseDependentMemberLookup(), clang::Sema::FindAllocationFunctions(), resolveAllocationOverload(), and resolveBuiltinNewDeleteOverload().

◆ getRepresentativeDecl()

NamedDecl * clang::LookupResult::getRepresentativeDecl ( ) const
inline

◆ getResultKind()

LookupResultKind clang::LookupResult::getResultKind ( ) const
inline

◆ getSema()

Sema & clang::LookupResult::getSema ( ) const
inline

Get the Sema object that this lookup result is searching with.

Definition at line 670 of file Lookup.h.

Referenced by getAcceptableDecl(), isResultTypeOrTemplate(), LookupDirect(), LookupMemberExprInRecord(), and resolveKind().

◆ isAcceptable()

static bool clang::LookupResult::isAcceptable ( Sema SemaRef,
NamedDecl D,
Sema::AcceptableKind  Kind 
)
inlinestatic

Definition at line 376 of file Lookup.h.

References D, isReachable(), isVisible(), Kind, and clang::Sema::Visible.

◆ isAmbiguous()

bool clang::LookupResult::isAmbiguous ( ) const
inline

◆ isAvailableForLookup()

bool LookupResult::isAvailableForLookup ( Sema SemaRef,
NamedDecl ND 
)
static

Determine whether this lookup is permitted to see the declaration.

Note that a reachable but not visible declaration inhabiting a namespace is not allowed to be seen during name lookup.

For example:

// m.cppm
export module m;
struct reachable { int v; }
export auto func() { return reachable{43}; }
// Use.cpp
import m;
auto Use() {
// Not valid. We couldn't see reachable here.
// So isAvailableForLookup would return false when we look
up 'reachable' here.
// return reachable(43).v;
// Valid. The field name 'v' is allowed during name lookup.
// So isAvailableForLookup would return true when we look up 'v' here.
return func().v;
}
do v
Definition: arm_acle.h:91

Definition at line 2115 of file SemaLookup.cpp.

References clang::DeclarationName::getCXXDeductionGuideTemplate(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::Sema::hasReachableDefinition(), clang::DeclContext::isFileContext(), and isVisible().

Referenced by findAcceptableDecl(), and getAcceptableDecl().

◆ isClassLookup()

bool clang::LookupResult::isClassLookup ( ) const
inline

Returns whether these results arose from performing a lookup into a class.

Definition at line 432 of file Lookup.h.

Referenced by resolveAllocationOverload().

◆ isForExternalRedeclaration()

bool clang::LookupResult::isForExternalRedeclaration ( ) const
inline

True if this lookup is just looking for an existing declaration to link against a declaration with external linkage.

Definition at line 286 of file Lookup.h.

Referenced by isHiddenDeclarationVisible().

◆ isForRedeclaration()

bool clang::LookupResult::isForRedeclaration ( ) const
inline

True if this lookup is just looking for an existing declaration.

Definition at line 280 of file Lookup.h.

Referenced by clang::Sema::LookupBuiltin(), LookupDirect(), and clang::Sema::LookupQualifiedName().

◆ isHiddenDeclarationVisible()

bool clang::LookupResult::isHiddenDeclarationVisible ( NamedDecl ND) const
inline

Determine whether this lookup is permitted to see hidden declarations, such as those in modules that have not yet been imported.

Definition at line 304 of file Lookup.h.

References clang::NamedDecl::isExternallyDeclarable(), and isForExternalRedeclaration().

Referenced by getAcceptableDecl().

◆ isOverloadedResult()

bool clang::LookupResult::isOverloadedResult ( ) const
inline

Determines if the results are overloaded.

Definition at line 336 of file Lookup.h.

References FoundOverloaded, and getResultKind().

Referenced by clang::Sema::BuildMemberReferenceExpr(), and clang::Sema::isPotentialImplicitMemberAccess().

◆ isReachable()

bool LookupResult::isReachable ( Sema SemaRef,
NamedDecl D 
)
static

Definition at line 2108 of file SemaLookup.cpp.

References D, clang::Decl::isUnconditionallyVisible(), and clang::Sema::Reachable.

Referenced by isAcceptable().

◆ isShadowed()

bool clang::LookupResult::isShadowed ( ) const
inline

Determine whether the lookup result was shadowed by some other declaration that lookup ignored.

Definition at line 510 of file Lookup.h.

◆ isSingleResult()

bool clang::LookupResult::isSingleResult ( ) const
inline

◆ isSingleTagDecl()

bool clang::LookupResult::isSingleTagDecl ( ) const
inline

Asks if the result is a single tag decl.

Definition at line 581 of file Lookup.h.

References Found, getFoundDecl(), and getResultKind().

Referenced by LookupQualifiedNameInUsingDirectives().

◆ isSuppressingAccessDiagnostics()

bool clang::LookupResult::isSuppressingAccessDiagnostics ( ) const
inline

Determines whether this lookup is suppressing access control diagnostics.

Definition at line 644 of file Lookup.h.

◆ isSuppressingAmbiguousDiagnostics()

bool clang::LookupResult::isSuppressingAmbiguousDiagnostics ( ) const
inline

Determines whether this lookup is suppressing ambiguous lookup diagnostics.

Definition at line 648 of file Lookup.h.

◆ isTemplateNameLookup()

bool clang::LookupResult::isTemplateNameLookup ( ) const
inline

Definition at line 322 of file Lookup.h.

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

◆ isUnresolvableResult()

bool clang::LookupResult::isUnresolvableResult ( ) const
inline

◆ isVisible()

bool LookupResult::isVisible ( Sema SemaRef,
NamedDecl D 
)
static

◆ makeFilter()

Filter clang::LookupResult::makeFilter ( )
inline

◆ operator=() [1/2]

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

◆ operator=() [2/2]

LookupResult & clang::LookupResult::operator= ( LookupResult &&  Other)
inline

Definition at line 220 of file Lookup.h.

References clang::Other.

◆ print()

void LookupResult::print ( raw_ostream &  Out)

Definition at line 680 of file SemaLookup.cpp.

References begin(), E, end(), isAmbiguous(), and clang::UnresolvedSetImpl::size().

◆ redeclarationKind()

RedeclarationKind clang::LookupResult::redeclarationKind ( ) const
inline

Definition at line 290 of file Lookup.h.

Referenced by LookupMemberExprInRecord().

◆ resolveKind()

void LookupResult::resolveKind ( )

Resolves the result kind of the lookup, possibly hiding decls.

Resolves the result kind of this lookup.

This should be called in any environment where lookup might generate multiple lookup results.

Definition at line 485 of file SemaLookup.cpp.

References Ambiguous, AmbiguousReference, AmbiguousReferenceToPlaceholderVariable, clang::UnresolvedSetImpl::begin(), canHideTag(), clang::Sema::Context, D, clang::Sema::diagnoseEquivalentInternalLinkageDeclarations(), Found, FoundOverloaded, FoundUnresolvedValue, clang::Decl::getCanonicalDecl(), clang::ASTContext::getCanonicalType(), getContextForScopeMatching(), getLookupKind(), getNameLoc(), getSema(), clang::ASTContext::getTypeDeclType(), clang::Decl::isInvalidDecl(), isPreferredLookupResult(), NotFound, NotFoundInCurrentInstantiation, clang::UnresolvedSetImpl::size(), clang::T, and clang::UnresolvedSetImpl::truncate().

Referenced by clang::Sema::ActOnUsingDirective(), BuildImplicitMemberInitializer(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckImplicitSpecialMemberDeclaration(), CppNamespaceLookup(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), InsertOCLBuiltinDeclarationsFromTable(), clang::Sema::LookupInSuper(), clang::Sema::LookupName(), clang::LookupNamed(), clang::LookupNamespace(), LookupPotentialTypoResult(), clang::Sema::LookupQualifiedName(), LookupQualifiedNameInUsingDirectives(), clang::TreeTransform< Derived >::RebuildMemberExpr(), resolveKindAfterFilter(), setAmbiguousBaseSubobjects(), setAmbiguousBaseSubobjectTypes(), and clang::TreeTransform< Derived >::TransformOverloadExprDecls().

◆ resolveKindAfterFilter()

void clang::LookupResult::resolveKindAfterFilter ( )
inline

Re-resolves the result kind of the lookup after a set of removals has been performed.

Definition at line 525 of file Lookup.h.

References Ambiguous, clang::UnresolvedSetImpl::empty(), Found, NotFound, NotFoundInCurrentInstantiation, and resolveKind().

◆ setAllowHidden()

void clang::LookupResult::setAllowHidden ( bool  AH)
inline

Specify whether hidden declarations are visible, e.g., for recovery reasons.

Definition at line 298 of file Lookup.h.

Referenced by LookupPotentialTypoResult().

◆ setAmbiguousBaseSubobjects()

void LookupResult::setAmbiguousBaseSubobjects ( CXXBasePaths P)

Make these results show that the name was found in distinct base classes of the same type.

The given paths object is copied and invalidated.

Definition at line 664 of file SemaLookup.cpp.

References AmbiguousBaseSubobjects, P, resolveKind(), and clang::CXXBasePaths::swap().

◆ setAmbiguousBaseSubobjectTypes()

void LookupResult::setAmbiguousBaseSubobjectTypes ( CXXBasePaths P)

Make these results show that the name was found in base classes of different types.

The given paths object is copied and invalidated.

Definition at line 672 of file SemaLookup.cpp.

References AmbiguousBaseSubobjectTypes, P, resolveKind(), and clang::CXXBasePaths::swap().

◆ setAmbiguousQualifiedTagHiding()

void clang::LookupResult::setAmbiguousQualifiedTagHiding ( )
inline

Make these results show that the name was found in different contexts and a tag decl was hidden by an ordinary decl in a different context.

Definition at line 600 of file Lookup.h.

References AmbiguousTagHiding.

Referenced by LookupQualifiedNameInUsingDirectives().

◆ setBaseObjectType()

void clang::LookupResult::setBaseObjectType ( QualType  T)
inline

Sets the base object type for this lookup.

Definition at line 469 of file Lookup.h.

References clang::T.

Referenced by clang::Sema::BuildMemberReferenceExpr(), and clang::Sema::BuildUsingDeclaration().

◆ setContextRange()

void clang::LookupResult::setContextRange ( SourceRange  SR)
inline

Sets a 'context' source range.

Definition at line 651 of file Lookup.h.

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

◆ setFindLocalExtern()

void clang::LookupResult::setFindLocalExtern ( bool  FindLocalExtern)
inline

Definition at line 753 of file Lookup.h.

References clang::Decl::IDNS_LocalExtern.

◆ setHideTags()

void clang::LookupResult::setHideTags ( bool  Hide)
inline

Sets whether tag declarations should be hidden by non-tag declarations during resolution.

The default is true.

Definition at line 311 of file Lookup.h.

Referenced by clang::Sema::ActOnPragmaDump(), and clang::Sema::BuildUsingDeclaration().

◆ setLookupName()

void clang::LookupResult::setLookupName ( DeclarationName  Name)
inline

◆ setLookupNameInfo()

void clang::LookupResult::setLookupNameInfo ( const DeclarationNameInfo NameInfo)
inline

Sets the name info to look up.

Definition at line 260 of file Lookup.h.

◆ setNamingClass()

void clang::LookupResult::setNamingClass ( CXXRecordDecl Record)
inline

Sets the 'naming class' for this lookup.

Definition at line 457 of file Lookup.h.

Referenced by attemptRecovery(), clang::Sema::DiagnoseEmptyLookup(), clang::Sema::LookupInSuper(), and clang::Sema::LookupQualifiedName().

◆ setNotFoundInCurrentInstantiation()

void clang::LookupResult::setNotFoundInCurrentInstantiation ( )
inline

Note that while no result was found in the current instantiation, there were dependent base classes that could not be searched.

Definition at line 501 of file Lookup.h.

References clang::UnresolvedSetImpl::empty(), NotFound, and NotFoundInCurrentInstantiation.

Referenced by LookupMemberExpr(), clang::Sema::LookupParsedName(), and clang::Sema::LookupQualifiedName().

◆ setRedeclarationKind()

void clang::LookupResult::setRedeclarationKind ( RedeclarationKind  RK)
inline

Change this lookup's redeclaration kind.

Definition at line 623 of file Lookup.h.

◆ setShadowed()

void clang::LookupResult::setShadowed ( )
inline

Note that we found and ignored a declaration while performing lookup.

Definition at line 514 of file Lookup.h.

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

◆ setTemplateNameLookup()

void clang::LookupResult::setTemplateNameLookup ( bool  TemplateName)
inline

Sets whether this is a template-name lookup.

For template-name lookups, injected-class-names are treated as naming a template rather than a template specialization.

Definition at line 318 of file Lookup.h.

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

◆ suppressAccessDiagnostics()

void clang::LookupResult::suppressAccessDiagnostics ( )
inline

Suppress the diagnostics that would normally fire because of this lookup due to access control violations.

Definition at line 641 of file Lookup.h.

Referenced by clang::Sema::AddMemberOperatorCandidates(), clang::Sema::BuildOverloadedArrowExpr(), and shouldAddReversedEqEq().

◆ suppressDiagnostics()

void clang::LookupResult::suppressDiagnostics ( )
inline

◆ wasNotFoundInCurrentInstantiation()

bool clang::LookupResult::wasNotFoundInCurrentInstantiation ( ) const
inline

Determine whether no result was found because we could not search into dependent base classes of the current instantiation.

Definition at line 495 of file Lookup.h.

References NotFoundInCurrentInstantiation.

Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildQualifiedDeclarationNameExpr(), clang::Sema::BuildQualifiedTemplateIdExpr(), clang::Sema::isTemplateName(), and LookupMemberExprInRecord().


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