clang 18.0.0git
|
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, Sema::RedeclarationKind Redecl=Sema::NotForRedeclaration) | |
LookupResult (Sema &SemaRef, DeclarationName Name, SourceLocation NameLoc, Sema::LookupNameKind LookupKind, Sema::RedeclarationKind Redecl=Sema::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 | |
LookupResult & | operator= (const LookupResult &)=delete |
LookupResult (LookupResult &&Other) | |
LookupResult & | operator= (LookupResult &&Other) |
~LookupResult () | |
const DeclarationNameInfo & | getLookupNameInfo () 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. | |
Sema::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 UnresolvedSetImpl & | asUnresolvedSet () const |
iterator | begin () const |
iterator | end () const |
bool | empty () const |
Return true if no decls were found. | |
CXXBasePaths * | getBasePaths () const |
Return the base paths structure that's associated with these results, or null if none is. | |
NamedDecl * | getAcceptableDecl (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. | |
CXXRecordDecl * | getNamingClass () 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 |
NamedDecl * | getFoundDecl () const |
Fetch the unique decl found by this lookup. | |
NamedDecl * | getRepresentativeDecl () 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 (Sema::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. | |
Sema & | getSema () 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. | |
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.
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: |
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: |
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
}
|
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. |
|
inline |
|
inline |
|
inline |
|
delete |
|
inline |
Definition at line 196 of file Lookup.h.
References clang::Other.
|
inline |
Add all the declarations from another set of lookup results.
Definition at line 485 of file Lookup.h.
References clang::UnresolvedSetImpl::append(), Found, and clang::Other.
Referenced by clang::Sema::CheckOverload(), and LookupQualifiedNameInUsingDirectives().
|
inline |
Add a declaration to these results with its natural access.
Does not test the acceptance criteria.
Definition at line 472 of file Lookup.h.
References addDecl(), and clang::Decl::getAccess().
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnUsingDirective(), clang::Sema::ActOnVarTemplateSpecialization(), addDecl(), attemptRecovery(), clang::Sema::BuildCXXNestedNameSpecifier(), BuildImplicitMemberInitializer(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckImplicitSpecialMemberDeclaration(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), InsertOCLBuiltinDeclarationsFromTable(), clang::Sema::LookupBuiltin(), LookupDirect(), clang::Sema::LookupInSuper(), clang::Sema::LookupName(), LookupPotentialTypoResult(), clang::Sema::LookupTemplateName(), clang::TreeTransform< Derived >::RebuildMemberExpr(), clang::TreeTransform< Derived >::TransformOverloadExprDecls(), and TryNamespaceTypoCorrection().
|
inline |
Add a declaration to these results with the given access.
Does not test the acceptance criteria.
Definition at line 478 of file Lookup.h.
References clang::UnresolvedSetImpl::addDecl(), and Found.
|
inline |
Definition at line 351 of file Lookup.h.
Referenced by clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildOperatorCoawaitLookupExpr(), and clang::Sema::ProduceCallSignatureHelp().
|
inline |
Definition at line 355 of file Lookup.h.
References clang::UnresolvedSetImpl::begin().
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnParamDeclarator(), clang::Sema::AddMemberOperatorCandidates(), clang::Sema::AddOverloadedCallCandidates(), clang::Sema::BuildDeclarationNameExpr(), buildDeclareReductionRef(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildOverloadedArrowExpr(), clang::Sema::BuildQualifiedDeclarationNameExpr(), BuildRecoveryCallExpr(), buildSingleCopyAssignRecursively(), clang::Sema::BuildTemplateIdExpr(), buildUserDefinedMapperRef(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckLookupAccess(), clang::Sema::CheckOverload(), clang::Sema::CheckQualifiedMemberReference(), clang::Sema::CheckUsingDeclRedeclaration(), ClassifyImplicitMemberAccess(), CXXRecordMembersNamed(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), clang::Sema::DiagnoseDependentMemberLookup(), DiagnoseInvalidRedeclaration(), clang::Sema::FindAllocationFunctions(), getFoundDecl(), getRepresentativeDecl(), clang::Sema::hasAnyAcceptableTemplateNames(), HasNoThrowOperator(), isResultTypeOrTemplate(), clang::Sema::isTemplateName(), clang::Sema::LookupOverloadedOperatorName(), print(), resolveAllocationOverload(), resolveBuiltinNewDeleteOverload(), and resolveDeallocationOverload().
|
inline |
Clears out any current state.
Definition at line 600 of file Lookup.h.
References clang::UnresolvedSetImpl::clear(), and NotFound.
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnUsingDirective(), clang::Sema::BuildCXXNestedNameSpecifier(), buildDeclareReductionRef(), clang::Sema::BuildMemInitializer(), BuildRecoveryCallExpr(), buildUserDefinedMapperRef(), clear(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), clang::Sema::FindAllocationFunctions(), LookupPotentialTypoResult(), LookupQualifiedNameInUsingDirectives(), clang::Sema::LookupTemplateName(), resolveAllocationOverload(), clang::TreeTransform< Derived >::TransformOverloadExprDecls(), and TryNamespaceTypoCorrection().
|
inline |
LLVM_DUMP_METHOD void LookupResult::dump | ( | ) |
Definition at line 689 of file SemaLookup.cpp.
References clang::Decl::dump(), clang::DeclarationName::getAsString(), and getLookupName().
Referenced by clang::Sema::ActOnPragmaDump().
|
inline |
Return true if no decls were found.
Definition at line 359 of file Lookup.h.
References clang::UnresolvedSetImpl::empty().
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnLambdaExpressionAfterIntroducer(), clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::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(), clang::Sema::CheckCountedByAttr(), ClassifyImplicitMemberAccess(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseInvalidRedeclaration(), DiagnoseTwoPhaseLookup(), doesUsualArrayDeleteWantSize(), emitReplacement(), clang::Sema::EvaluateStaticAssertMessageAsString(), clang::Sema::FindAllocationFunctions(), clang::Sema::FindDeallocationFunction(), getTupleLikeElementType(), clang::Sema::isDeductionGuideName(), clang::Sema::isTemplateName(), isTupleLike(), clang::Sema::LookupInObjCMethod(), clang::Sema::LookupInSuper(), clang::Sema::LookupIvarInObjCMethod(), LookupMemberExprInRecord(), clang::LookupNamed(), clang::LookupNamespace(), LookupPotentialTypoResult(), LookupQualifiedNameInUsingDirectives(), clang::Sema::LookupTemplateName(), clang::MultiplexExternalSemaSource::LookupUnqualified(), and resolveBuiltinNewDeleteOverload().
|
inline |
Definition at line 356 of file Lookup.h.
References clang::UnresolvedSetImpl::end().
Referenced by clang::Sema::AddMemberOperatorCandidates(), clang::Sema::AddOverloadedCallCandidates(), clang::Sema::BuildDeclarationNameExpr(), buildDeclareReductionRef(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildOverloadedArrowExpr(), buildSingleCopyAssignRecursively(), clang::Sema::BuildTemplateIdExpr(), buildUserDefinedMapperRef(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckLookupAccess(), clang::Sema::CheckOverload(), clang::Sema::CheckQualifiedMemberReference(), clang::Sema::CheckUsingDeclRedeclaration(), CXXRecordMembersNamed(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), DiagnoseInvalidRedeclaration(), clang::Sema::FindAllocationFunctions(), clang::Sema::hasAnyAcceptableTemplateNames(), HasNoThrowOperator(), isResultTypeOrTemplate(), clang::Sema::isTemplateName(), clang::Sema::LookupOverloadedOperatorName(), print(), resolveAllocationOverload(), resolveBuiltinNewDeleteOverload(), and resolveDeallocationOverload().
Retrieve the accepted (re)declaration of the given declaration, if there is one.
Definition at line 405 of file Lookup.h.
References getSema(), isAvailableForLookup(), isHiddenDeclarationVisible(), and clang::Decl::isInIdentifierNamespace().
Referenced by clang::Sema::CheckImplicitSpecialMemberDeclaration(), LookupDirect(), and clang::Sema::LookupName().
|
inline |
Definition at line 346 of file Lookup.h.
References isAmbiguous().
|
inline |
Definition at line 553 of file Lookup.h.
References Found, getFoundDecl(), and getResultKind().
Referenced by clang::Sema::ActOnCXXTypeid(), clang::Sema::ActOnEnumConstant(), clang::Sema::ActOnIdExpression(), clang::Sema::ActOnLambdaExpressionAfterIntroducer(), clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnPragmaUnused(), clang::Sema::ActOnUsingDirective(), clang::Sema::BuildBuiltinCallExpr(), clang::Sema::BuildBuiltinOffsetOf(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildDeclarationNameExpr(), buildMemcpyForAssignmentOp(), clang::Sema::BuildMemInitializer(), clang::Sema::BuildQualifiedDeclarationNameExpr(), clang::Sema::BuildQualifiedTemplateIdExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckCountedByAttr(), clang::Sema::CheckOverload(), clang::Sema::CheckUsingDeclQualifier(), getTupleLikeElementType(), clang::Sema::isDeductionGuideName(), clang::Sema::isTagName(), isTagTypeWithMissingTag(), clang::Sema::lookupOpenMPDeclareTargetName(), lookupPromiseType(), clang::Sema::LookupSingleName(), LookupStdSourceLocationImpl(), and clang::Sema::MergeTypedefNameDecl().
|
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 461 of file Lookup.h.
Referenced by clang::Sema::CheckLookupAccess().
|
inline |
|
inline |
|
inline |
Fetch the unique decl found by this lookup.
Asserts that one was found.
This is intended for users who have examined the result kind and are certain that there is only one result.
Definition at line 563 of file Lookup.h.
References begin(), Found, and getResultKind().
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnSizeofParameterPackExpr(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::BuildUsingDeclaration(), CheckObjCBridgeCFCast(), CheckObjCBridgeNSCast(), clang::Sema::checkObjCBridgeRelatedComponents(), emitReplacement(), clang::Sema::FindFirstQualifierInScope(), getAsSingle(), clang::Sema::getShadowedDeclaration(), isSingleTagDecl(), clang::Sema::LookupInlineAsmField(), clang::Sema::LookupInlineAsmVarDeclField(), clang::Sema::LookupIvarInObjCMethod(), clang::LookupNamed(), clang::LookupNamespace(), LookupPotentialTypoResult(), clang::Sema::LookupTemplateName(), and ShouldLookupResultBeMultiVersionOverload().
|
inline |
Returns the identifier namespace mask for this lookup.
Definition at line 423 of file Lookup.h.
Referenced by clang::Sema::LookupQualifiedName().
|
inline |
Gets the kind of lookup to perform.
Definition at line 273 of file Lookup.h.
Referenced by clang::Sema::ActOnSizeofParameterPackExpr(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildMemInitializer(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckOverload(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseInvalidRedeclaration(), clang::Sema::LookupBuiltin(), clang::Sema::LookupInSuper(), LookupMemberExprInRecord(), clang::Sema::LookupName(), clang::Sema::LookupQualifiedName(), clang::Sema::LookupTemplateName(), clang::Sema::resolveAssumedTemplateNameAsType(), resolveKind(), and TryNamespaceTypoCorrection().
|
inline |
Gets the name to look up.
Definition at line 263 of file Lookup.h.
References clang::DeclarationNameInfo::getName().
Referenced by clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildLiteralOperatorCall(), clang::Sema::CheckShadow(), clang::Sema::DiagnoseDependentMemberLookup(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), dump(), clang::Sema::LookupBuiltin(), LookupDirect(), clang::Sema::LookupLiteralOperator(), LookupMemberExpr(), LookupMemberExprInRecord(), clang::Sema::LookupName(), clang::Sema::LookupQualifiedName(), clang::Sema::LookupTemplateName(), resolveAllocationOverload(), clang::Sema::resolveAssumedTemplateNameAsType(), and resolveBuiltinNewDeleteOverload().
|
inline |
Gets the name info to look up.
Definition at line 253 of file Lookup.h.
Referenced by clang::Sema::ActOnSizeofParameterPackExpr(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildMemInitializer(), clang::Sema::BuildPossibleImplicitMemberExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckQualifiedMemberReference(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseInvalidRedeclaration(), clang::Sema::LookupInSuper(), LookupMemberExpr(), LookupMemberExprInRecord(), clang::Sema::LookupTemplateName(), clang::Sema::resolveAssumedTemplateNameAsType(), and TryNamespaceTypoCorrection().
|
inline |
Gets the location of the identifier.
This isn't always defined: sometimes we're doing lookups on synthesized names.
Definition at line 659 of file Lookup.h.
References clang::DeclarationNameInfo::getLoc().
Referenced by clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildImplicitMemberExpr(), clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildPossibleImplicitMemberExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::CheckLookupAccess(), clang::Sema::CheckShadow(), clang::Sema::DiagnoseDependentMemberLookup(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), clang::Sema::EvaluateStaticAssertMessageAsString(), InsertOCLBuiltinDeclarationsFromTable(), clang::Sema::LookupBuiltin(), LookupDirect(), clang::Sema::LookupInObjCMethod(), clang::Sema::LookupIvarInObjCMethod(), clang::Sema::LookupLiteralOperator(), LookupMemberExpr(), LookupMemberExprInRecord(), clang::Sema::LookupTemplateName(), resolveAllocationOverload(), clang::Sema::resolveAssumedTemplateNameAsType(), resolveBuiltinNewDeleteOverload(), resolveKind(), and shouldWarnIfShadowedDecl().
|
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 449 of file Lookup.h.
Referenced by clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::CheckLookupAccess(), ClassifyImplicitMemberAccess(), clang::Sema::DiagnoseDependentMemberLookup(), clang::Sema::FindAllocationFunctions(), clang::Sema::FindDeallocationFunction(), resolveAllocationOverload(), and resolveBuiltinNewDeleteOverload().
|
inline |
Fetches a representative decl. Useful for lazy diagnostics.
Definition at line 570 of file Lookup.h.
References begin(), and clang::UnresolvedSetImpl::empty().
Referenced by clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnUsingDirective(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildDeclarationNameExpr(), buildDeclareReductionRef(), clang::Sema::BuildPossibleImplicitMemberExpr(), buildUserDefinedMapperRef(), CheckAnonMemberRedeclaration(), clang::Sema::CheckQualifiedMemberReference(), clang::Sema::DiagnoseDependentMemberLookup(), getTupleLikeElementType(), clang::Sema::LookupTemplateName(), and clang::Sema::MergeTypedefNameDecl().
|
inline |
Definition at line 341 of file Lookup.h.
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnSizeofParameterPackExpr(), clang::Sema::BuildQualifiedDeclarationNameExpr(), clang::Sema::CheckMicrosoftIfExistsSymbol(), getAsSingle(), getFoundDecl(), isAmbiguous(), isOverloadedResult(), isSingleResult(), isSingleTagDecl(), clang::Sema::isTagName(), isUnresolvableResult(), clang::Sema::LookupLiteralOperator(), and shouldWarnIfShadowedDecl().
|
inline |
Get the Sema object that this lookup result is searching with.
Definition at line 665 of file Lookup.h.
Referenced by getAcceptableDecl(), isResultTypeOrTemplate(), LookupDirect(), LookupMemberExprInRecord(), and resolveKind().
|
inlinestatic |
Definition at line 373 of file Lookup.h.
References isReachable(), isVisible(), and clang::Sema::Visible.
|
inline |
Definition at line 321 of file Lookup.h.
References Ambiguous, and getResultKind().
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnLambdaExpressionAfterIntroducer(), clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnTemplateName(), clang::Sema::ActOnUsingDirective(), clang::Sema::BuildBuiltinOffsetOf(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildImplicitMemberExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildMemInitializer(), BuildNonArrayForRange(), clang::Sema::BuildOperatorCoawaitLookupExpr(), clang::Sema::BuildOverloadedArrowExpr(), clang::Sema::BuildQualifiedDeclarationNameExpr(), clang::Sema::BuildQualifiedTemplateIdExpr(), BuildRecoveryCallExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::BuildUsingDeclaration(), checkTupleLikeDecomposition(), DiagnoseInvalidRedeclaration(), doesUsualArrayDeleteWantSize(), clang::Sema::FindAllocationFunctions(), clang::Sema::FindDeallocationFunction(), clang::Sema::FindFirstQualifierInScope(), getAmbiguityKind(), clang::Sema::isDeductionGuideName(), clang::Sema::isTemplateName(), clang::Sema::lookupOpenMPDeclareTargetName(), clang::Sema::LookupOverloadedOperatorName(), lookupStdTypeTraitMember(), clang::Sema::LookupTemplateName(), print(), and resolveBuiltinNewDeleteOverload().
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:
Definition at line 2094 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().
|
inline |
Returns whether these results arose from performing a lookup into a class.
Definition at line 429 of file Lookup.h.
Referenced by resolveAllocationOverload().
|
inline |
True if this lookup is just looking for an existing declaration to link against a declaration with external linkage.
Definition at line 284 of file Lookup.h.
Referenced by isHiddenDeclarationVisible().
|
inline |
True if this lookup is just looking for an existing declaration.
Definition at line 278 of file Lookup.h.
Referenced by clang::Sema::LookupBuiltin(), LookupDirect(), and clang::Sema::LookupQualifiedName().
Determine whether this lookup is permitted to see hidden declarations, such as those in modules that have not yet been imported.
Definition at line 301 of file Lookup.h.
References clang::NamedDecl::isExternallyDeclarable(), and isForExternalRedeclaration().
Referenced by getAcceptableDecl().
|
inline |
Determines if the results are overloaded.
Definition at line 333 of file Lookup.h.
References FoundOverloaded, and getResultKind().
Referenced by clang::Sema::ActOnIdExpression(), attemptRecovery(), clang::Sema::BuildDeclarationNameExpr(), and clang::Sema::BuildMemberReferenceExpr().
Definition at line 2087 of file SemaLookup.cpp.
References clang::Decl::isUnconditionallyVisible(), and clang::Sema::Reachable.
Referenced by isAcceptable().
|
inline |
|
inline |
Determines if this names a single result which is not an unresolved value using decl.
If so, it is safe to call getFoundDecl().
Definition at line 328 of file Lookup.h.
References Found, and getResultKind().
Referenced by clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildMemberReferenceExpr(), emitReplacement(), clang::Sema::FindFirstQualifierInScope(), clang::Sema::LookupInlineAsmField(), clang::Sema::LookupIvarInObjCMethod(), clang::LookupNamed(), clang::Sema::lookupOpenMPDeclareTargetName(), LookupPotentialTypoResult(), clang::Sema::LookupTemplateName(), and ShouldLookupResultBeMultiVersionOverload().
|
inline |
Asks if the result is a single tag decl.
Definition at line 576 of file Lookup.h.
References Found, getFoundDecl(), and getResultKind().
Referenced by LookupQualifiedNameInUsingDirectives().
|
inline |
|
inline |
Determines whether this lookup is suppressing ambiguous lookup diagnostics.
Definition at line 643 of file Lookup.h.
Referenced by clang::Sema::LookupTemplateName().
|
inline |
Definition at line 319 of file Lookup.h.
Referenced by clang::Sema::LookupQualifiedName().
|
inline |
Definition at line 337 of file Lookup.h.
References FoundUnresolvedValue, and getResultKind().
Referenced by clang::Sema::ActOnIdExpression(), attemptRecovery(), clang::Sema::BuildMemberReferenceExpr(), and ClassifyImplicitMemberAccess().
Determine whether the given declaration is visible to the program.
Definition at line 2077 of file SemaLookup.cpp.
References clang::Decl::isUnconditionallyVisible(), and clang::Sema::Visible.
Referenced by checkCorrectionVisibility(), findAcceptableDecl(), clang::TypoCorrectionConsumer::FoundDecl(), isAcceptable(), isAvailableForLookup(), and clang::Sema::MergeCXXFunctionDecl().
|
inline |
Create a filter for this result set.
Definition at line 744 of file Lookup.h.
Referenced by clang::Sema::ActOnOpenMPDeclareMapperDirective(), clang::Sema::ActOnOpenMPDeclareReductionDirectiveStart(), buildSingleCopyAssignRecursively(), clang::Sema::FilterAcceptableTemplateNames(), clang::Sema::FilterLookupForScope(), clang::Sema::FindAllocationFunctions(), clang::Sema::LookupLiteralOperator(), and RemoveUsingDecls().
|
delete |
|
inline |
Definition at line 218 of file Lookup.h.
References clang::Other.
void LookupResult::print | ( | raw_ostream & | Out | ) |
Definition at line 678 of file SemaLookup.cpp.
References begin(), end(), isAmbiguous(), and clang::UnresolvedSetImpl::size().
|
inline |
Definition at line 288 of file Lookup.h.
References clang::Sema::ForExternalRedeclaration, clang::Sema::ForVisibleRedeclaration, and clang::Sema::NotForRedeclaration.
Referenced by LookupMemberExprInRecord().
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 483 of file SemaLookup.cpp.
References Ambiguous, AmbiguousReference, AmbiguousReferenceToPlaceholderVariable, clang::UnresolvedSetImpl::begin(), canHideTag(), clang::Sema::Context, clang::Sema::diagnoseEquivalentInternalLinkageDeclarations(), Found, FoundOverloaded, FoundUnresolvedValue, clang::Decl::getCanonicalDecl(), clang::ASTContext::getCanonicalType(), getContextForScopeMatching(), getLookupKind(), getNameLoc(), getSema(), clang::ASTContext::getTypeDeclType(), clang::Decl::isInvalidDecl(), clang::NamedDecl::isPlaceholderVar(), isPreferredLookupResult(), NotFound, NotFoundInCurrentInstantiation, clang::UnresolvedSetImpl::size(), 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().
|
inline |
Re-resolves the result kind of the lookup after a set of removals has been performed.
Definition at line 520 of file Lookup.h.
References Ambiguous, clang::UnresolvedSetImpl::empty(), Found, NotFound, NotFoundInCurrentInstantiation, and resolveKind().
|
inline |
Specify whether hidden declarations are visible, e.g., for recovery reasons.
Definition at line 295 of file Lookup.h.
Referenced by LookupPotentialTypoResult().
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 662 of file SemaLookup.cpp.
References AmbiguousBaseSubobjects, P, resolveKind(), and clang::CXXBasePaths::swap().
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 670 of file SemaLookup.cpp.
References AmbiguousBaseSubobjectTypes, P, resolveKind(), and clang::CXXBasePaths::swap().
|
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 595 of file Lookup.h.
References AmbiguousTagHiding.
Referenced by LookupQualifiedNameInUsingDirectives().
|
inline |
Sets the base object type for this lookup.
Definition at line 466 of file Lookup.h.
Referenced by clang::Sema::BuildMemberReferenceExpr(), and clang::Sema::BuildUsingDeclaration().
|
inline |
Sets a 'context' source range.
Definition at line 646 of file Lookup.h.
Referenced by clang::Sema::BuildCXXNestedNameSpecifier(), and clang::Sema::LookupParsedName().
|
inline |
Definition at line 748 of file Lookup.h.
References clang::Decl::IDNS_LocalExtern.
|
inline |
Sets whether tag declarations should be hidden by non-tag declarations during resolution.
The default is true.
Definition at line 308 of file Lookup.h.
Referenced by clang::Sema::ActOnPragmaDump(), and clang::Sema::BuildUsingDeclaration().
|
inline |
Sets the name to look up.
Definition at line 268 of file Lookup.h.
References clang::DeclarationNameInfo::setName().
Referenced by attemptRecovery(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildMemInitializer(), clang::Sema::DiagnoseEmptyLookup(), LookupPotentialTypoResult(), clang::Sema::LookupTemplateName(), and resolveAllocationOverload().
|
inline |
|
inline |
Sets the 'naming class' for this lookup.
Definition at line 454 of file Lookup.h.
Referenced by attemptRecovery(), clang::Sema::DiagnoseEmptyLookup(), clang::Sema::LookupInSuper(), and clang::Sema::LookupQualifiedName().
|
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 498 of file Lookup.h.
References clang::UnresolvedSetImpl::empty(), NotFound, and NotFoundInCurrentInstantiation.
Referenced by clang::Sema::LookupParsedName(), and clang::Sema::LookupQualifiedName().
|
inline |
Change this lookup's redeclaration kind.
Definition at line 618 of file Lookup.h.
References clang::Sema::ForExternalRedeclaration, and clang::Sema::NotForRedeclaration.
|
inline |
Note that we found and ignored a declaration while performing lookup.
Definition at line 509 of file Lookup.h.
Referenced by clang::Sema::LookupName().
|
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 315 of file Lookup.h.
Referenced by clang::Sema::LookupTemplateName().
|
inline |
Suppress the diagnostics that would normally fire because of this lookup due to access control violations.
Definition at line 636 of file Lookup.h.
Referenced by clang::Sema::AddMemberOperatorCandidates(), clang::Sema::BuildOverloadedArrowExpr(), and shouldAddReversedEqEq().
|
inline |
Suppress the diagnostics that would normally fire because of this lookup.
This happens during (e.g.) redeclaration lookups.
Definition at line 629 of file Lookup.h.
Referenced by clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnPragmaDump(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildDeclarationNameExpr(), buildDeclareReductionRef(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildMemInitializer(), BuildRecoveryCallExpr(), clang::Sema::BuildTemplateIdExpr(), buildUserDefinedMapperRef(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckImplicitSpecialMemberDeclaration(), clang::Sema::CheckMicrosoftIfExistsSymbol(), CXXRecordMembersNamed(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), doesUsualArrayDeleteWantSize(), emitReplacement(), clang::Sema::FindAllocationFunctions(), clang::Sema::FindDeallocationFunction(), getTupleLikeElementType(), HasNoThrowOperator(), clang::Sema::isDeductionGuideName(), clang::Sema::isTagName(), clang::Sema::isTemplateName(), lookupMember(), clang::LookupNamed(), clang::LookupNamespace(), clang::Sema::lookupOpenMPDeclareTargetName(), LookupPotentialTypoResult(), clang::Sema::ProduceCallSignatureHelp(), resolveBuiltinNewDeleteOverload(), and clang::TypoCorrectionConsumer::TypoCorrectionConsumer().
|
inline |
Determine whether no result was found because we could not search into dependent base classes of the current instantiation.
Definition at line 492 of file Lookup.h.
References NotFoundInCurrentInstantiation.
Referenced by clang::Sema::LookupTemplateName().