clang API Documentation
#include "clang/Sema/Lookup.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclLookups.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Lex/ModuleLoader.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/ExternalSemaSource.h"
#include "clang/Sema/Overload.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/TemplateDeduction.h"
#include "clang/Sema/TypoCorrection.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/ADT/edit_distance.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include "clang/AST/TypeNodes.def"
Go to the source code of this file.
Defines | |
#define | TYPE(Class, Base) |
#define | DEPENDENT_TYPE(Class, Base) case Type::Class: |
#define | NON_CANONICAL_TYPE(Class, Base) case Type::Class: |
#define | NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: |
#define | ABSTRACT_TYPE(Class, Base) |
Functions | |
static unsigned | getIDNS (Sema::LookupNameKind NameKind, bool CPlusPlus, bool Redeclaration) |
static DeclContext * | getContextForScopeMatching (Decl *D) |
static bool | LookupBuiltin (Sema &S, LookupResult &R) |
Lookup a builtin function, when name lookup would otherwise fail. | |
static bool | CanDeclareSpecialMemberFunction (const CXXRecordDecl *Class) |
Determine whether we can declare a special member function within the class at this point. | |
static bool | isImplicitlyDeclaredMemberFunctionName (DeclarationName Name) |
Determine whether this is the name of an implicitly-declared special member function. | |
static void | DeclareImplicitMemberFunctionsWithName (Sema &S, DeclarationName Name, const DeclContext *DC) |
If there are any implicit member functions with the given name that need to be declared in the given declaration context, do so. | |
static bool | LookupDirect (Sema &S, LookupResult &R, const DeclContext *DC) |
static bool | CppNamespaceLookup (Sema &S, LookupResult &R, ASTContext &Context, DeclContext *NS, UnqualUsingDirectiveSet &UDirs) |
static bool | isNamespaceOrTranslationUnitScope (Scope *S) |
static std::pair< DeclContext *, bool > | findOuterContext (Scope *S) |
static Decl * | getInstantiatedFrom (Decl *D, MemberSpecializationInfo *MSInfo) |
Find the declaration that a class temploid member specialization was instantiated from, or the member itself if it is an explicit specialization. | |
static Module * | getDefiningModule (Decl *Entity) |
Find the module in which the given declaration was defined. | |
static NamedDecl * | findAcceptableDecl (Sema &SemaRef, NamedDecl *D) |
Retrieve the visible declaration corresponding to D, if any. | |
static bool | LookupQualifiedNameInUsingDirectives (Sema &S, LookupResult &R, DeclContext *StartDC) |
Perform qualified name lookup in the namespaces nominated by using directives by the given context. | |
static bool | LookupAnyMember (const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *Name) |
Callback that looks for any member of a class with the given name. | |
template<typename InputIterator > | |
static bool | HasOnlyStaticMembers (InputIterator First, InputIterator Last) |
Determine whether the given set of member declarations contains only static members, nested types, and enumerators. | |
static void | addAssociatedClassesAndNamespaces (AssociatedLookup &Result, QualType T) |
static void | CollectEnclosingNamespace (Sema::AssociatedNamespaceSet &Namespaces, DeclContext *Ctx) |
static void | addAssociatedClassesAndNamespaces (AssociatedLookup &Result, const TemplateArgument &Arg) |
static void | addAssociatedClassesAndNamespaces (AssociatedLookup &Result, CXXRecordDecl *Class) |
static void | LookupVisibleDecls (DeclContext *Ctx, LookupResult &Result, bool QualifiedNameLookup, bool InBaseClass, VisibleDeclConsumer &Consumer, VisibleDeclsRecord &Visited) |
static void | LookupVisibleDecls (Scope *S, LookupResult &Result, UnqualUsingDirectiveSet &UDirs, VisibleDeclConsumer &Consumer, VisibleDeclsRecord &Visited) |
static bool | isCandidateViable (CorrectionCandidateCallback &CCC, TypoCorrection &Candidate) |
static void | LookupPotentialTypoResult (Sema &SemaRef, LookupResult &Res, IdentifierInfo *Name, Scope *S, CXXScopeSpec *SS, DeclContext *MemberContext, bool EnteringContext, bool isObjCIvarLookup, bool FindHidden) |
Perform name lookup for a possible result for typo correction. | |
static void | checkCorrectionVisibility (Sema &SemaRef, TypoCorrection &TC) |
Check whether the declarations found for a typo correction are visible, and if none of them are, convert the correction to an 'import a module' correction. | |
static void | getNestedNameSpecifierIdentifiers (NestedNameSpecifier *NNS, SmallVectorImpl< const IdentifierInfo * > &Identifiers) |
static void | AddKeywordsToConsumer (Sema &SemaRef, TypoCorrectionConsumer &Consumer, Scope *S, CorrectionCandidateCallback &CCC, bool AfterNestedNameSpecifier) |
Add keywords to the consumer as possible typo corrections. | |
static const NamedDecl * | getDefinitionToImport (const NamedDecl *D) |
Variables | |
static const unsigned | MaxTypoDistanceResultSets = 5 |
#define ABSTRACT_TYPE | ( | Class, | |
Base | |||
) |
#define DEPENDENT_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define NON_CANONICAL_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( | Class, | |
Base | |||
) | case Type::Class: |
static void addAssociatedClassesAndNamespaces | ( | AssociatedLookup & | Result, |
QualType | T | ||
) | [static] |
Definition at line 2108 of file SemaLookup.cpp.
References CollectEnclosingNamespace(), clang::Type::getCanonicalTypeInternal(), clang::MemberPointerType::getClass(), clang::Decl::getDeclContext(), getElementType(), clang::MemberPointerType::getPointeeType(), clang::FunctionType::getReturnType(), clang::Type::getTypeClass(), clang::QualType::getTypePtr(), clang::FunctionProtoType::param_types(), and Record.
Referenced by addAssociatedClassesAndNamespaces(), and clang::Sema::FindAssociatedClassesAndNamespaces().
static void addAssociatedClassesAndNamespaces | ( | AssociatedLookup & | Result, |
const TemplateArgument & | Arg | ||
) | [static] |
Definition at line 1963 of file SemaLookup.cpp.
References addAssociatedClassesAndNamespaces(), CollectEnclosingNamespace(), clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, clang::TemplateName::getAsTemplateDecl(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::TemplateArgument::getKind(), clang::TemplateArgument::Integral, clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::pack_elements(), clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, and clang::TemplateArgument::Type.
static void addAssociatedClassesAndNamespaces | ( | AssociatedLookup & | Result, |
CXXRecordDecl * | Class | ||
) | [static] |
Definition at line 2014 of file SemaLookup.cpp.
References addAssociatedClassesAndNamespaces(), clang::CXXRecordDecl::bases(), clang::CXXRecordDecl::bases_begin(), clang::CXXRecordDecl::bases_end(), CollectEnclosingNamespace(), clang::RecordType::getDecl(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::CXXRecordDecl::hasDefinition(), and clang::TemplateArgumentList::size().
static void AddKeywordsToConsumer | ( | Sema & | SemaRef, |
TypoCorrectionConsumer & | Consumer, | ||
Scope * | S, | ||
CorrectionCandidateCallback & | CCC, | ||
bool | AfterNestedNameSpecifier | ||
) | [static] |
Add keywords to the consumer as possible typo corrections.
Definition at line 3844 of file SemaLookup.cpp.
References clang::TypoCorrectionConsumer::addKeywordResult(), clang::Sema::CurContext, clang::Scope::getBreakParent(), clang::Scope::getContinueParent(), clang::Sema::getCurBlock(), clang::Sema::getCurFunction(), clang::Sema::getCurFunctionOrMethodDecl(), clang::Sema::getLangOpts(), clang::Scope::isClassScope(), clang::sema::FunctionScopeInfo::SwitchStack, clang::CorrectionCandidateCallback::WantCXXNamedCasts, clang::CorrectionCandidateCallback::WantExpressionKeywords, clang::CorrectionCandidateCallback::WantFunctionLikeCasts, clang::CorrectionCandidateCallback::WantObjCSuper, clang::CorrectionCandidateCallback::WantRemainingKeywords, and clang::CorrectionCandidateCallback::WantTypeSpecifiers.
static bool CanDeclareSpecialMemberFunction | ( | const CXXRecordDecl * | Class | ) | [static] |
Determine whether we can declare a special member function within the class at this point.
Definition at line 554 of file SemaLookup.cpp.
References clang::CXXRecordDecl::getDefinition(), clang::TagDecl::isBeingDefined(), and clang::DeclContext::isDependentContext().
Referenced by DeclareImplicitMemberFunctionsWithName(), clang::Sema::ForceDeclarationOfImplicitMembers(), clang::Sema::LookupConstructors(), and clang::Sema::LookupSpecialMember().
static void checkCorrectionVisibility | ( | Sema & | SemaRef, |
TypoCorrection & | TC | ||
) | [static] |
Check whether the declarations found for a typo correction are visible, and if none of them are, convert the correction to an 'import a module' correction.
Definition at line 3284 of file SemaLookup.cpp.
References clang::TypoCorrection::begin(), clang::TypoCorrection::end(), findAcceptableDecl(), clang::LookupResult::isVisible(), clang::TypoCorrection::setCorrectionDecls(), and clang::TypoCorrection::setRequiresImport().
Referenced by clang::TypoCorrectionConsumer::addCorrection(), and clang::Sema::CorrectTypo().
static void CollectEnclosingNamespace | ( | Sema::AssociatedNamespaceSet & | Namespaces, |
DeclContext * | Ctx | ||
) | [static] |
Definition at line 1942 of file SemaLookup.cpp.
References clang::DeclContext::getParent(), clang::DeclContext::getPrimaryContext(), clang::DeclContext::isFileContext(), clang::DeclContext::isInlineNamespace(), clang::DeclContext::isRecord(), and clang::DeclContext::isTransparentContext().
Referenced by addAssociatedClassesAndNamespaces().
static bool CppNamespaceLookup | ( | Sema & | S, |
LookupResult & | R, | ||
ASTContext & | Context, | ||
DeclContext * | NS, | ||
UnqualUsingDirectiveSet & | UDirs | ||
) | [static] |
Definition at line 758 of file SemaLookup.cpp.
References clang::DeclContext::isFileContext(), LookupDirect(), and clang::LookupResult::resolveKind().
static void DeclareImplicitMemberFunctionsWithName | ( | Sema & | S, |
DeclarationName | Name, | ||
const DeclContext * | DC | ||
) | [static] |
If there are any implicit member functions with the given name that need to be declared in the given declaration context, do so.
Definition at line 614 of file SemaLookup.cpp.
References CanDeclareSpecialMemberFunction(), clang::DeclarationName::CXXConstructorName, clang::DeclarationName::CXXDestructorName, clang::DeclarationName::CXXOperatorName, clang::Sema::DeclareImplicitCopyAssignment(), clang::Sema::DeclareImplicitCopyConstructor(), clang::Sema::DeclareImplicitDefaultConstructor(), clang::Sema::DeclareImplicitDestructor(), clang::Sema::DeclareImplicitMoveAssignment(), clang::Sema::DeclareImplicitMoveConstructor(), clang::DeclarationName::getCXXOverloadedOperator(), clang::Sema::getLangOpts(), clang::DeclarationName::getNameKind(), and Record.
Referenced by LookupDirect().
static NamedDecl* findAcceptableDecl | ( | Sema & | SemaRef, |
NamedDecl * | D | ||
) | [static] |
Retrieve the visible declaration corresponding to D, if any.
This routine determines whether the declaration D is visible in the current module, with the current imports. If not, it checks whether any redeclaration of D is visible, and if so, returns that declaration.
Definition at line 1254 of file SemaLookup.cpp.
References clang::LookupResult::isVisible(), and clang::Decl::redecls().
Referenced by checkCorrectionVisibility(), and clang::TypoCorrectionConsumer::FoundDecl().
static std::pair<DeclContext *, bool> findOuterContext | ( | Scope * | S | ) | [static] |
Definition at line 793 of file SemaLookup.cpp.
References clang::DeclContext::Encloses(), clang::DeclContext::Equals(), clang::Scope::getEntity(), clang::Scope::getParent(), clang::DeclContext::getParent(), clang::DeclContext::isFileContext(), and clang::Scope::isTemplateParamScope().
Referenced by LookupVisibleDecls().
static DeclContext* getContextForScopeMatching | ( | Decl * | D | ) | [static] |
Get a representative context for a declaration such that two declarations will have the same context if they were found within the same scope.
Definition at line 340 of file SemaLookup.cpp.
References clang::Decl::getDeclContext(), clang::Decl::getLexicalDeclContext(), clang::DeclContext::getRedeclContext(), and clang::DeclContext::isFunctionOrMethod().
Referenced by clang::LookupResult::resolveKind().
static Module* getDefiningModule | ( | Decl * | Entity | ) | [static] |
Find the module in which the given declaration was defined.
Definition at line 1171 of file SemaLookup.cpp.
References Context, clang::Decl::getDeclContext(), getInstantiatedFrom(), clang::Decl::getOwningModule(), clang::CXXRecordDecl::getTemplateInstantiationPattern(), clang::FunctionDecl::getTemplateInstantiationPattern(), and clang::DeclContext::isFileContext().
Referenced by clang::Sema::getLookupModules().
static const NamedDecl* getDefinitionToImport | ( | const NamedDecl * | D | ) | [static] |
Find which declaration we should import to provide the definition of the given declaration.
Definition at line 4509 of file SemaLookup.cpp.
Referenced by clang::Sema::diagnoseTypo().
static unsigned getIDNS | ( | Sema::LookupNameKind | NameKind, |
bool | CPlusPlus, | ||
bool | Redeclaration | ||
) | [inline, static] |
Definition at line 207 of file SemaLookup.cpp.
References clang::Decl::IDNS_Label, clang::Decl::IDNS_LocalExtern, clang::Decl::IDNS_Member, clang::Decl::IDNS_Namespace, clang::Decl::IDNS_NonMemberOperator, clang::Decl::IDNS_ObjCProtocol, clang::Decl::IDNS_Ordinary, clang::Decl::IDNS_OrdinaryFriend, clang::Decl::IDNS_Tag, clang::Decl::IDNS_TagFriend, clang::Decl::IDNS_Type, clang::Decl::IDNS_Using, clang::Sema::LookupAnyName, clang::Sema::LookupLabel, clang::Sema::LookupLocalFriendName, clang::Sema::LookupMemberName, clang::Sema::LookupNamespaceName, clang::Sema::LookupNestedNameSpecifierName, clang::Sema::LookupObjCImplicitSelfParam, clang::Sema::LookupObjCProtocolName, clang::Sema::LookupOperatorName, clang::Sema::LookupOrdinaryName, clang::Sema::LookupRedeclarationWithLinkage, clang::Sema::LookupTagName, and clang::Sema::LookupUsingDeclName.
static Decl* getInstantiatedFrom | ( | Decl * | D, |
MemberSpecializationInfo * | MSInfo | ||
) | [static] |
Find the declaration that a class temploid member specialization was instantiated from, or the member itself if it is an explicit specialization.
Definition at line 1166 of file SemaLookup.cpp.
References clang::MemberSpecializationInfo::getInstantiatedFrom(), and clang::MemberSpecializationInfo::isExplicitSpecialization().
Referenced by getDefiningModule().
static void getNestedNameSpecifierIdentifiers | ( | NestedNameSpecifier * | NNS, |
SmallVectorImpl< const IdentifierInfo * > & | Identifiers | ||
) | [static] |
Definition at line 3327 of file SemaLookup.cpp.
References clang::NestedNameSpecifier::getAsIdentifier(), clang::NestedNameSpecifier::getAsNamespace(), clang::NestedNameSpecifier::getAsNamespaceAlias(), clang::NestedNameSpecifier::getAsType(), clang::NamedDecl::getIdentifier(), clang::NestedNameSpecifier::getKind(), clang::NestedNameSpecifier::getPrefix(), clang::NestedNameSpecifier::Global, clang::NestedNameSpecifier::Identifier, clang::NamespaceDecl::isAnonymousNamespace(), clang::NestedNameSpecifier::Namespace, clang::NestedNameSpecifier::NamespaceAlias, clang::NestedNameSpecifier::Super, clang::NestedNameSpecifier::TypeSpec, and clang::NestedNameSpecifier::TypeSpecWithTemplate.
static bool HasOnlyStaticMembers | ( | InputIterator | First, |
InputIterator | Last | ||
) | [static] |
Determine whether the given set of member declarations contains only static members, nested types, and enumerators.
Definition at line 1532 of file SemaLookup.cpp.
References clang::NamedDecl::getUnderlyingDecl(), and clang::LangAS::Last.
Referenced by clang::Sema::LookupQualifiedName().
static bool isCandidateViable | ( | CorrectionCandidateCallback & | CCC, |
TypoCorrection & | Candidate | ||
) | [static] |
Definition at line 3266 of file SemaLookup.cpp.
References clang::TypoCorrection::getEditDistance(), clang::TypoCorrection::InvalidDistance, clang::CorrectionCandidateCallback::RankCandidate(), and clang::TypoCorrection::setCallbackDistance().
Referenced by clang::TypoCorrectionConsumer::addCorrection(), and clang::Sema::CorrectTypo().
static bool isImplicitlyDeclaredMemberFunctionName | ( | DeclarationName | Name | ) | [static] |
Determine whether this is the name of an implicitly-declared special member function.
Definition at line 596 of file SemaLookup.cpp.
References clang::DeclarationName::CXXConstructorName, clang::DeclarationName::CXXDestructorName, clang::DeclarationName::CXXOperatorName, clang::DeclarationName::getCXXOverloadedOperator(), and clang::DeclarationName::getNameKind().
static bool isNamespaceOrTranslationUnitScope | ( | Scope * | S | ) | [static] |
Definition at line 780 of file SemaLookup.cpp.
References clang::Scope::getEntity(), and clang::DeclContext::isFileContext().
Referenced by clang::Sema::LookupName(), and clang::Sema::LookupVisibleDecls().
static bool LookupAnyMember | ( | const CXXBaseSpecifier * | Specifier, |
CXXBasePath & | Path, | ||
void * | Name | ||
) | [static] |
Callback that looks for any member of a class with the given name.
Definition at line 1519 of file SemaLookup.cpp.
References clang::CXXBasePath::Decls, clang::Type::getAs(), clang::DeclarationName::getFromOpaquePtr(), clang::CXXBaseSpecifier::getType(), and clang::DeclContext::lookup().
Referenced by clang::Sema::LookupQualifiedName().
static bool LookupBuiltin | ( | Sema & | S, |
LookupResult & | R | ||
) | [static] |
Lookup a builtin function, when name lookup would otherwise fail.
Definition at line 512 of file SemaLookup.cpp.
References clang::LookupResult::addDecl(), clang::ASTContext::BuiltinInfo, clang::Sema::Context, clang::DeclarationName::getAsIdentifierInfo(), clang::Sema::getASTContext(), clang::IdentifierInfo::getBuiltinID(), clang::Sema::getFloat128Identifier(), clang::ASTContext::getFloat128StubType(), clang::Sema::getLangOpts(), clang::LookupResult::getLookupKind(), clang::LookupResult::getLookupName(), clang::LookupResult::getNameLoc(), clang::LookupResult::isForRedeclaration(), clang::Builtin::Context::isPredefinedLibFunction(), clang::Sema::LazilyCreateBuiltin(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupRedeclarationWithLinkage, and clang::Sema::TUScope.
Referenced by LookupDirect(), and clang::Sema::LookupName().
static bool LookupDirect | ( | Sema & | S, |
LookupResult & | R, | ||
const DeclContext * | DC | ||
) | [static] |
Definition at line 665 of file SemaLookup.cpp.
References clang::LookupResult::addDecl(), clang::CC_C, clang::Sema::Context, clang::CXXRecordDecl::conversion_begin(), clang::CXXRecordDecl::conversion_end(), clang::DeclarationName::CXXConversionFunctionName, DeclareImplicitMemberFunctionsWithName(), clang::Sema::DeduceTemplateArguments(), clang::EST_None, clang::FunctionProtoType::ExtProtoInfo::ExceptionSpec, clang::ExpectedType, clang::FunctionProtoType::ExtProtoInfo::ExtInfo, clang::LookupResult::getAcceptableDecl(), clang::Type::getAs(), clang::DeclarationName::getCXXNameType(), clang::FunctionProtoType::getExtProtoInfo(), clang::ASTContext::getFunctionType(), clang::Sema::getLangOpts(), clang::LookupResult::getLookupName(), clang::DeclarationName::getNameKind(), clang::LookupResult::getNameLoc(), clang::LookupResult::getSema(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::ValueDecl::getType(), clang::TagDecl::isCompleteDefinition(), clang::Type::isDependentType(), clang::LookupResult::isForRedeclaration(), clang::DeclContext::isTranslationUnit(), clang::DeclContext::lookup(), LookupBuiltin(), Record, clang::Sema::TDK_Success, and clang::FunctionType::ExtInfo::withCallingConv().
Referenced by CppNamespaceLookup(), clang::Sema::LookupQualifiedName(), and LookupQualifiedNameInUsingDirectives().
static void LookupPotentialTypoResult | ( | Sema & | SemaRef, |
LookupResult & | Res, | ||
IdentifierInfo * | Name, | ||
Scope * | S, | ||
CXXScopeSpec * | SS, | ||
DeclContext * | MemberContext, | ||
bool | EnteringContext, | ||
bool | isObjCIvarLookup, | ||
bool | FindHidden | ||
) | [static] |
Perform name lookup for a possible result for typo correction.
Definition at line 3791 of file SemaLookup.cpp.
References clang::LookupResult::addDecl(), clang::LookupResult::clear(), clang::LookupResult::empty(), clang::Sema::getCurMethodDecl(), clang::LookupResult::getFoundDecl(), clang::Decl::isDefinedOutsideFunctionOrMethod(), clang::LookupResult::isSingleResult(), clang::Sema::LookupParsedName(), clang::Sema::LookupQualifiedName(), clang::LookupResult::resolveKind(), clang::LookupResult::setAllowHidden(), clang::LookupResult::setLookupName(), and clang::LookupResult::suppressDiagnostics().
static bool LookupQualifiedNameInUsingDirectives | ( | Sema & | S, |
LookupResult & | R, | ||
DeclContext * | StartDC | ||
) | [static] |
Perform qualified name lookup in the namespaces nominated by using directives by the given context.
C++98 [namespace.qual]p2: Given X::m (where X is a user-declared namespace), or given ::m (where X is the global namespace), let S be the set of all declarations of m in X and in the transitive closure of all namespaces nominated by using-directives in X and its used namespaces, except that using-directives are ignored in any namespace, including X, directly containing one or more declarations of m. No namespace is searched more than once in the lookup of a name. If S is the empty set, the program is ill-formed. Otherwise, if S has exactly one member, or if the context of the reference is a using-declaration (namespace.udecl), S is the required set of declarations of m. Otherwise if the use of m is not one that allows a unique declaration to be chosen from S, the program is ill-formed.
C++98 [namespace.qual]p5: During the lookup of a qualified namespace member name, if the lookup finds more than one declaration of the member, and if one declaration introduces a class name or enumeration name and the other declarations either introduce the same object, the same enumerator or a set of functions, the non-type name hides the class or enumeration name if and only if the declarations are from the same namespace; otherwise (the declarations are from different namespaces), the program is ill-formed.
Definition at line 1436 of file SemaLookup.cpp.
References clang::LookupResult::addAllDecls(), clang::LookupResult::clear(), clang::LookupResult::empty(), clang::DeclContext::isFileContext(), clang::LookupResult::isSingleTagDecl(), LookupDirect(), clang::LookupResult::resolveKind(), clang::LookupResult::setAmbiguousQualifiedTagHiding(), clang::LookupResult::Temporary, and clang::DeclContext::using_directives().
Referenced by clang::Sema::LookupQualifiedName().
static void LookupVisibleDecls | ( | DeclContext * | Ctx, |
LookupResult & | Result, | ||
bool | QualifiedNameLookup, | ||
bool | InBaseClass, | ||
VisibleDeclConsumer & | Consumer, | ||
VisibleDeclsRecord & | Visited | ||
) | [static] |
Definition at line 2972 of file SemaLookup.cpp.
References clang::Sema::ForceDeclarationOfImplicitMembers(), clang::VisibleDeclConsumer::FoundDecl(), clang::LookupResult::getAcceptableDecl(), clang::Type::getAs(), clang::RecordType::getDecl(), clang::DeclContext::getPrimaryContext(), clang::LookupResult::getSema(), clang::Type::isDependentType(), clang::DeclContext::lookups(), Record, and clang::DeclContext::using_directives().
Referenced by clang::Sema::CodeCompleteAfterIf(), clang::Sema::CodeCompleteDeclSpec(), clang::Sema::CodeCompleteExpression(), clang::Sema::CodeCompleteMemberReferenceExpr(), clang::Sema::CodeCompleteNamespaceAliasDecl(), clang::Sema::CodeCompleteObjCMessageReceiver(), clang::Sema::CodeCompleteObjCPassingType(), clang::Sema::CodeCompleteOrdinaryName(), clang::Sema::CodeCompleteQualifiedId(), clang::Sema::CodeCompleteTag(), clang::Sema::CodeCompleteUsing(), clang::Sema::CodeCompleteUsingDirective(), clang::Sema::GatherGlobalCodeCompletions(), clang::Sema::LookupVisibleDecls(), and LookupVisibleDecls().
static void LookupVisibleDecls | ( | Scope * | S, |
LookupResult & | Result, | ||
UnqualUsingDirectiveSet & | UDirs, | ||
VisibleDeclConsumer & | Consumer, | ||
VisibleDeclsRecord & | Visited | ||
) | [static] |
Definition at line 3103 of file SemaLookup.cpp.
References clang::Sema::Context, clang::Scope::decls(), clang::DeclContext::Equals(), findOuterContext(), clang::VisibleDeclConsumer::FoundDecl(), clang::LookupResult::getAcceptableDecl(), clang::Scope::getEntity(), clang::LookupResult::getLookupName(), clang::DeclContext::getLookupParent(), clang::LookupResult::getNameLoc(), clang::Scope::getParent(), clang::LookupResult::getSema(), clang::ASTContext::getTranslationUnitDecl(), isFunctionOrMethod(), clang::DeclContext::isFunctionOrMethod(), clang::Sema::LookupMemberName, and LookupVisibleDecls().
const unsigned MaxTypoDistanceResultSets = 5 [static] |
Definition at line 3420 of file SemaLookup.cpp.
Referenced by clang::TypoCorrectionConsumer::addCorrection().