clang 20.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, 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 | |
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. | |
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 (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 198 of file Lookup.h.
References clang::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().
|
inline |
Add a declaration to these results with its natural access.
Does not test the acceptance criteria.
Definition at line 475 of file Lookup.h.
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnUsingDirective(), addDecl(), attemptRecovery(), 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::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 481 of file Lookup.h.
References clang::UnresolvedSetImpl::addDecl(), D, and Found.
|
inline |
Definition at line 354 of file Lookup.h.
Referenced by clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildOperatorCoawaitLookupExpr(), and clang::SemaCodeCompletion::ProduceCallSignatureHelp().
|
inline |
Definition at line 358 of file Lookup.h.
References clang::UnresolvedSetImpl::begin().
Referenced by clang::Sema::ActOnParamDeclarator(), clang::Sema::AddMemberOperatorCandidates(), clang::Sema::AddOverloadedCallCandidates(), clang::Sema::BuildDeclarationNameExpr(), buildDeclareReductionRef(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildOverloadedArrowExpr(), clang::Sema::BuildPossibleImplicitMemberExpr(), 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(), hasUserDefinedMapper(), clang::Sema::isPotentialImplicitMemberAccess(), isResultTypeOrTemplate(), clang::Sema::isTemplateName(), clang::Sema::LookupOverloadedOperatorName(), print(), resolveAllocationOverload(), resolveBuiltinNewDeleteOverload(), and resolveDeallocationOverload().
|
inline |
Clears out any current state.
Definition at line 605 of file Lookup.h.
References clang::UnresolvedSetImpl::clear(), and NotFound.
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnUsingDirective(), buildDeclareReductionRef(), clang::Sema::BuildMemInitializer(), BuildRecoveryCallExpr(), buildUserDefinedMapperRef(), clear(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), clang::Sema::FindAllocationFunctions(), hasUserDefinedMapper(), LookupPotentialTypoResult(), LookupQualifiedNameInUsingDirectives(), clang::Sema::LookupTemplateName(), resolveAllocationOverload(), clang::TreeTransform< Derived >::TransformOverloadExprDecls(), and TryNamespaceTypoCorrection().
|
inline |
LLVM_DUMP_METHOD void LookupResult::dump | ( | ) |
Definition at line 691 of file SemaLookup.cpp.
References D, clang::Decl::dump(), clang::DeclarationName::getAsString(), and getLookupName().
Referenced by clang::Sema::ActOnPragmaDump().
|
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().
|
inline |
Definition at line 359 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(), clang::Sema::BuildPossibleImplicitMemberExpr(), 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(), hasUserDefinedMapper(), 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 408 of file Lookup.h.
References D, getSema(), isAvailableForLookup(), and isHiddenDeclarationVisible().
Referenced by clang::Sema::CheckImplicitSpecialMemberDeclaration(), LookupDirect(), and clang::Sema::LookupName().
|
inline |
Definition at line 349 of file Lookup.h.
References isAmbiguous().
|
inline |
Definition at line 558 of file Lookup.h.
References Found, getFoundDecl(), and getResultKind().
Referenced by clang::Sema::ActOnCXXTypeid(), clang::Sema::ActOnEnumConstant(), clang::Sema::ActOnIdExpression(), clang::Sema::ActOnLambdaExpressionAfterIntroducer(), clang::SemaOpenMP::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::BuildTemplateIdExpr(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckOverload(), clang::Sema::CheckUsingDeclQualifier(), getTupleLikeElementType(), clang::Sema::isDeductionGuideName(), clang::Sema::isTagName(), isTagTypeWithMissingTag(), clang::SemaOpenMP::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 464 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 568 of file Lookup.h.
References begin(), Found, and getResultKind().
Referenced by clang::Sema::ActOnIdExpression(), clang::SemaObjC::ActOnMethodDeclaration(), clang::Sema::ActOnNamespaceAliasDef(), clang::SemaOpenMP::ActOnOpenMPIdExpression(), clang::Sema::ActOnSizeofParameterPackExpr(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildTemplateIdExpr(), clang::Sema::BuildUsingDeclaration(), CheckObjCBridgeCFCast(), CheckObjCBridgeNSCast(), clang::SemaObjC::checkObjCBridgeRelatedComponents(), emitReplacement(), getAsSingle(), clang::Sema::getShadowedDeclaration(), clang::Sema::isPotentialImplicitMemberAccess(), isSingleTagDecl(), clang::Sema::LookupInlineAsmField(), clang::Sema::LookupInlineAsmVarDeclField(), clang::SemaObjC::LookupIvarInObjCMethod(), clang::LookupNamed(), clang::LookupNamespace(), LookupPotentialTypoResult(), clang::Sema::LookupTemplateName(), and ShouldLookupResultBeMultiVersionOverload().
|
inline |
Returns the identifier namespace mask for this lookup.
Definition at line 426 of file Lookup.h.
Referenced by clang::Sema::LookupQualifiedName().
|
inline |
Gets the kind of lookup to perform.
Definition at line 275 of file Lookup.h.
Referenced by clang::Sema::ActOnSizeofParameterPackExpr(), 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::resolveAssumedTemplateNameAsType(), resolveKind(), and TryNamespaceTypoCorrection().
|
inline |
Gets the name to look up.
Definition at line 265 of file Lookup.h.
References clang::DeclarationNameInfo::getName().
Referenced by clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildMemberReferenceExpr(), 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(), resolveAllocationOverload(), clang::Sema::resolveAssumedTemplateNameAsType(), resolveBuiltinNewDeleteOverload(), and clang::TreeTransform< Derived >::TransformOverloadExprDecls().
|
inline |
Gets the name info to look up.
Definition at line 255 of file Lookup.h.
Referenced by clang::Sema::ActOnSizeofParameterPackExpr(), 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::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 664 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::SemaObjC::LookupInObjCMethod(), clang::SemaObjC::LookupIvarInObjCMethod(), clang::Sema::LookupLiteralOperator(), LookupMemberExpr(), LookupMemberExprInRecord(), resolveAllocationOverload(), clang::Sema::resolveAssumedTemplateNameAsType(), resolveBuiltinNewDeleteOverload(), resolveKind(), shouldWarnIfShadowedDecl(), and clang::TreeTransform< Derived >::TransformOverloadExprDecls().
|
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().
|
inline |
Fetches a representative decl. Useful for lazy diagnostics.
Definition at line 575 of file Lookup.h.
References begin(), and clang::UnresolvedSetImpl::empty().
Referenced by clang::Sema::ActOnNamespaceAliasDef(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnUsingDirective(), clang::Sema::BuildDeclarationNameExpr(), buildDeclareReductionRef(), clang::Sema::BuildPossibleImplicitMemberExpr(), clang::Sema::BuildTemplateIdExpr(), buildUserDefinedMapperRef(), CheckAnonMemberRedeclaration(), clang::Sema::CheckQualifiedMemberReference(), clang::Sema::DiagnoseDependentMemberLookup(), getTupleLikeElementType(), hasUserDefinedMapper(), clang::Sema::MergeTypedefNameDecl(), and clang::TreeTransform< Derived >::TransformOverloadExprDecls().
|
inline |
Definition at line 344 of file Lookup.h.
Referenced by clang::Sema::ActOnSizeofParameterPackExpr(), 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 670 of file Lookup.h.
Referenced by getAcceptableDecl(), isResultTypeOrTemplate(), LookupDirect(), LookupMemberExprInRecord(), and resolveKind().
|
inlinestatic |
Definition at line 376 of file Lookup.h.
References D, isReachable(), isVisible(), Kind, and clang::Sema::Visible.
|
inline |
Definition at line 324 of file Lookup.h.
References Ambiguous, and getResultKind().
Referenced by clang::Sema::ActOnIdExpression(), clang::Sema::ActOnLambdaExpressionAfterIntroducer(), clang::Sema::ActOnNamespaceAliasDef(), clang::SemaOpenMP::ActOnOpenMPIdExpression(), clang::Sema::ActOnTemplateName(), clang::Sema::ActOnUsingDirective(), clang::Sema::BuildBuiltinOffsetOf(), 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(), getAmbiguityKind(), clang::Sema::isDeductionGuideName(), clang::Sema::isTemplateName(), clang::SemaOpenMP::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 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().
|
inline |
Returns whether these results arose from performing a lookup into a class.
Definition at line 432 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 286 of file Lookup.h.
Referenced by isHiddenDeclarationVisible().
|
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().
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().
|
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().
Definition at line 2108 of file SemaLookup.cpp.
References D, 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 331 of file Lookup.h.
References Found, and getResultKind().
Referenced by clang::SemaObjC::ActOnMethodDeclaration(), clang::Sema::ActOnNamespaceAliasDef(), clang::SemaOpenMP::ActOnOpenMPIdExpression(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildTemplateIdExpr(), emitReplacement(), clang::Sema::LookupInlineAsmField(), clang::SemaObjC::LookupIvarInObjCMethod(), clang::LookupNamed(), clang::SemaOpenMP::lookupOpenMPDeclareTargetName(), LookupPotentialTypoResult(), clang::Sema::LookupTemplateName(), and ShouldLookupResultBeMultiVersionOverload().
|
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().
|
inline |
|
inline |
|
inline |
Definition at line 322 of file Lookup.h.
Referenced by clang::Sema::LookupQualifiedName().
|
inline |
Definition at line 340 of file Lookup.h.
References FoundUnresolvedValue, and getResultKind().
Referenced by clang::Sema::BuildMemberReferenceExpr(), ClassifyImplicitMemberAccess(), and clang::Sema::isPotentialImplicitMemberAccess().
Determine whether the given declaration is visible to the program.
Definition at line 2098 of file SemaLookup.cpp.
References D, 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 749 of file Lookup.h.
Referenced by clang::SemaOpenMP::ActOnOpenMPDeclareMapperDirective(), clang::SemaOpenMP::ActOnOpenMPDeclareReductionDirectiveStart(), buildSingleCopyAssignRecursively(), clang::Sema::FilterAcceptableTemplateNames(), clang::Sema::FilterLookupForScope(), clang::Sema::FindAllocationFunctions(), clang::Sema::LookupLiteralOperator(), RemoveLookupResult(), and RemoveUsingDecls().
|
delete |
|
inline |
Definition at line 220 of file Lookup.h.
References clang::Other.
void LookupResult::print | ( | raw_ostream & | Out | ) |
Definition at line 680 of file SemaLookup.cpp.
References begin(), E, end(), isAmbiguous(), and clang::UnresolvedSetImpl::size().
|
inline |
Definition at line 290 of file Lookup.h.
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 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().
|
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().
|
inline |
Specify whether hidden declarations are visible, e.g., for recovery reasons.
Definition at line 298 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 664 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 672 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 600 of file Lookup.h.
References AmbiguousTagHiding.
Referenced by LookupQualifiedNameInUsingDirectives().
|
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().
|
inline |
Sets a 'context' source range.
Definition at line 651 of file Lookup.h.
Referenced by clang::Sema::LookupParsedName().
|
inline |
Definition at line 753 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 311 of file Lookup.h.
Referenced by clang::Sema::ActOnPragmaDump(), and clang::Sema::BuildUsingDeclaration().
|
inline |
Sets the name to look up.
Definition at line 270 of file Lookup.h.
References clang::DeclarationNameInfo::setName().
Referenced by attemptRecovery(), clang::Sema::BuildMemInitializer(), clang::Sema::DiagnoseEmptyLookup(), LookupPotentialTypoResult(), and resolveAllocationOverload().
|
inline |
|
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().
|
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().
|
inline |
|
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().
|
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().
|
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().
|
inline |
Suppress the diagnostics that would normally fire because of this lookup.
This happens during (e.g.) redeclaration lookups.
Definition at line 634 of file Lookup.h.
Referenced by clang::SemaOpenMP::ActOnOpenMPIdExpression(), clang::Sema::ActOnPragmaDump(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildDeclarationNameExpr(), buildDeclareReductionRef(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::BuildMemInitializer(), clang::Sema::BuildPossibleImplicitMemberExpr(), 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(), getTupleLikeElementType(), HasNoThrowOperator(), hasUserDefinedMapper(), clang::Sema::isDeductionGuideName(), clang::Sema::isTagName(), clang::Sema::isTemplateName(), lookupMember(), clang::LookupNamed(), clang::LookupNamespace(), clang::SemaOpenMP::lookupOpenMPDeclareTargetName(), LookupPotentialTypoResult(), clang::SemaCodeCompletion::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 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().