39#include "llvm/ADT/STLExtras.h"
40#include "llvm/ADT/STLForwardCompat.h"
41#include "llvm/ADT/SmallPtrSet.h"
42#include "llvm/ADT/TinyPtrVector.h"
43#include "llvm/ADT/edit_distance.h"
44#include "llvm/Support/Casting.h"
45#include "llvm/Support/ErrorHandling.h"
54#include "OpenCLBuiltins.inc"
60 class UnqualUsingEntry {
67 : Nominated(Nominated), CommonAncestor(CommonAncestor) {
71 return CommonAncestor;
80 bool operator()(
const UnqualUsingEntry &L,
const UnqualUsingEntry &R) {
81 return L.getCommonAncestor() < R.getCommonAncestor();
84 bool operator()(
const UnqualUsingEntry &
E,
const DeclContext *DC) {
85 return E.getCommonAncestor() < DC;
88 bool operator()(
const DeclContext *DC,
const UnqualUsingEntry &
E) {
89 return DC <
E.getCommonAncestor();
96 class UnqualUsingDirectiveSet {
105 UnqualUsingDirectiveSet(
Sema &SemaRef) : SemaRef(SemaRef) {}
107 void visitScopeChain(
Scope *S,
Scope *InnermostFileScope) {
115 for (; S; S = S->getParent()) {
120 if (Ctx && Ctx->isFileContext()) {
122 }
else if (!Ctx || Ctx->isFunctionOrMethod()) {
123 for (
auto *I : S->using_directives())
125 visit(I, InnermostFileDC);
138 if (!visited.insert(DC).second)
141 addUsingDirectives(DC, EffectiveDC);
149 if (!visited.insert(NS).second)
152 addUsingDirective(UD, EffectiveDC);
153 addUsingDirectives(NS, EffectiveDC);
164 if (SemaRef.
isVisible(UD) && visited.insert(NS).second) {
165 addUsingDirective(UD, EffectiveDC);
173 DC = queue.pop_back_val();
188 while (!Common->
Encloses(EffectiveDC))
195 void done() { llvm::sort(list, UnqualUsingEntry::Comparator()); }
197 typedef ListTy::const_iterator const_iterator;
199 const_iterator begin()
const {
return list.begin(); }
200 const_iterator end()
const {
return list.end(); }
202 llvm::iterator_range<const_iterator>
204 return llvm::make_range(std::equal_range(begin(), end(),
206 UnqualUsingEntry::Comparator()));
215 bool Redeclaration) {
236 assert(!Redeclaration &&
"cannot do redeclaration operator lookup");
275 assert(Redeclaration &&
"should only be used for redecl lookup");
302void LookupResult::configure() {
313 case OO_Array_Delete:
324 if (
unsigned BuiltinID =
Id->getBuiltinID()) {
331bool LookupResult::checkDebugAssumptions()
const {
334 assert(ResultKind !=
Found || Decls.
size() == 1);
336 (Decls.
size() == 1 &&
337 isa<FunctionTemplateDecl>((*
begin())->getUnderlyingDecl())));
342 assert((Paths !=
nullptr) == (ResultKind ==
Ambiguous &&
376 !isa<UsingShadowDecl>(Existing))
379 const auto *DUnderlying =
D->getUnderlyingDecl();
390 if (DUnderlying->getCanonicalDecl() != EUnderlying->getCanonicalDecl()) {
391 assert(isa<TypeDecl>(DUnderlying) && isa<TypeDecl>(EUnderlying));
392 bool HaveTag = isa<TagDecl>(EUnderlying);
395 return HaveTag != WantTag;
402 if (
const auto *DFD = dyn_cast<FunctionDecl>(DUnderlying)) {
403 const auto *EFD = cast<FunctionDecl>(EUnderlying);
404 unsigned DMin = DFD->getMinRequiredArguments();
405 unsigned EMin = EFD->getMinRequiredArguments();
414 if (
const auto *DTD = dyn_cast<TemplateDecl>(DUnderlying)) {
415 const auto *ETD = cast<TemplateDecl>(EUnderlying);
416 unsigned DMin = DTD->getTemplateParameters()->getMinRequiredArguments();
417 unsigned EMin = ETD->getTemplateParameters()->getMinRequiredArguments();
426 for (
unsigned I = DMin, N = DTD->getTemplateParameters()->size();
429 ETD->getTemplateParameters()->getParam(I)) &&
431 DTD->getTemplateParameters()->getParam(I)))
438 if (
const auto *DVD = dyn_cast<VarDecl>(DUnderlying)) {
439 const auto *EVD = cast<VarDecl>(EUnderlying);
440 if (EVD->getType()->isIncompleteType() &&
441 !DVD->getType()->isIncompleteType()) {
449 if (!isa<FunctionDecl>(DUnderlying) && !isa<VarDecl>(DUnderlying)) {
458 if (Prev == EUnderlying)
477 D =
D->getUnderlyingDecl();
478 return isa<VarDecl>(
D) || isa<EnumConstantDecl>(
D) || isa<FunctionDecl>(
D) ||
479 isa<FunctionTemplateDecl>(
D) || isa<FieldDecl>(
D) ||
480 isa<UnresolvedUsingValueDecl>(
D);
485 unsigned N = Decls.
size();
498 if (isa<FunctionTemplateDecl>(
D))
500 else if (isa<UnresolvedUsingValueDecl>(
D))
508 llvm::SmallDenseMap<const NamedDecl *, unsigned, 16> Unique;
509 llvm::SmallDenseMap<QualType, unsigned, 16> UniqueTypes;
512 bool ReferenceToPlaceHolderVariable =
false;
513 bool HasTag =
false, HasFunction =
false;
514 bool HasFunctionTemplate =
false, HasUnresolved =
false;
515 const NamedDecl *HasNonFunction =
nullptr;
518 llvm::BitVector RemovedDecls(N);
520 for (
unsigned I = 0; I < N; I++) {
521 const NamedDecl *
D = Decls[I]->getUnderlyingDecl();
527 N - RemovedDecls.count() > 1) {
539 if (HideTags && isa<TagDecl>(
D)) {
541 for (
auto *OtherDecl : Decls) {
542 if (
canHideTag(OtherDecl) && !OtherDecl->isInvalidDecl() &&
554 std::optional<unsigned> ExistingI;
560 if (
const auto *TD = dyn_cast<TypeDecl>(
D)) {
562 auto UniqueResult = UniqueTypes.insert(
564 if (!UniqueResult.second) {
566 ExistingI = UniqueResult.first->second;
573 auto UniqueResult = Unique.insert(std::make_pair(
D, I));
574 if (!UniqueResult.second) {
576 ExistingI = UniqueResult.first->second;
585 Decls[*ExistingI] = Decls[I];
592 if (isa<UnresolvedUsingValueDecl>(
D)) {
593 HasUnresolved =
true;
594 }
else if (isa<TagDecl>(
D)) {
598 }
else if (isa<FunctionTemplateDecl>(
D)) {
600 HasFunctionTemplate =
true;
601 }
else if (isa<FunctionDecl>(
D)) {
604 if (HasNonFunction) {
609 if (
getSema().isEquivalentInternalLinkageDeclaration(HasNonFunction,
611 EquivalentNonFunctions.push_back(
D);
615 if (
D->isPlaceholderVar(
getSema().getLangOpts()) &&
618 ReferenceToPlaceHolderVariable =
true;
628 if (!EquivalentNonFunctions.empty() && !
Ambiguous)
630 getNameLoc(), HasNonFunction, EquivalentNonFunctions);
635 for (
int I = RemovedDecls.find_last(); I >= 0; I = RemovedDecls.find_prev(I))
636 Decls[I] = Decls[--N];
639 if ((HasNonFunction && (HasFunction || HasUnresolved)) ||
640 (HideTags && HasTag && (HasFunction || HasNonFunction || HasUnresolved)))
643 if (
Ambiguous && ReferenceToPlaceHolderVariable)
647 else if (HasUnresolved)
649 else if (N > 1 || HasFunctionTemplate)
655void LookupResult::addDeclsFromBasePaths(
const CXXBasePaths &
P) {
657 for (I =
P.begin(),
E =
P.end(); I !=
E; ++I)
666 addDeclsFromBasePaths(*Paths);
674 addDeclsFromBasePaths(*Paths);
680 Out << Decls.
size() <<
" result(s)";
682 if (Paths) Out <<
", base paths present";
699 llvm::StringRef Name) {
701 << TypeClass << Name;
743 Sema &S,
const OpenCLBuiltinStruct &OpenCLBuiltin,
unsigned &GenTypeMaxCnt,
747 unsigned Sig = SignatureTable[OpenCLBuiltin.SigTableIndex];
748 OCL2Qual(S, TypeTable[Sig], RetTypes);
749 GenTypeMaxCnt = RetTypes.size();
753 for (
unsigned Index = 1; Index < OpenCLBuiltin.NumTypes; Index++) {
755 OCL2Qual(S, TypeTable[SignatureTable[OpenCLBuiltin.SigTableIndex + Index]],
757 GenTypeMaxCnt = (Ty.size() > GenTypeMaxCnt) ? Ty.size() : GenTypeMaxCnt;
758 ArgTypes.push_back(std::move(Ty));
781 if (RetTypes.size() == 0)
785 for (
unsigned IGenType = 0; IGenType < GenTypeMaxCnt; IGenType++) {
788 for (
unsigned A = 0; A < ArgTypes.size(); A++) {
790 if (ArgTypes[A].size() == 0)
796 assert(GenTypeMaxCnt % ArgTypes[A].size() == 0 &&
797 "argument type count not compatible with gentype type count");
798 unsigned Idx = IGenType % ArgTypes[A].size();
799 ArgList.push_back(ArgTypes[A][Idx]);
803 RetTypes[(RetTypes.size() != 1) ? IGenType : 0], ArgList, PI));
818 const unsigned FctIndex,
819 const unsigned Len) {
821 bool HasGenType =
false;
825 unsigned GenTypeMaxCnt;
829 for (
unsigned SignatureIndex = 0; SignatureIndex < Len; SignatureIndex++) {
830 const OpenCLBuiltinStruct &OpenCLBuiltin =
831 BuiltinTable[FctIndex + SignatureIndex];
835 if (!isOpenCLVersionContainedInMask(Context.
getLangOpts(),
836 OpenCLBuiltin.Versions))
842 StringRef Extensions = FunctionExtensionTable[OpenCLBuiltin.Extension];
843 if (!Extensions.empty()) {
845 Extensions.split(ExtVec,
" ");
846 bool AllExtensionsDefined =
true;
847 for (StringRef Ext : ExtVec) {
849 AllExtensionsDefined =
false;
853 if (!AllExtensionsDefined)
863 if (GenTypeMaxCnt > 1) {
868 std::vector<QualType> FunctionList;
876 for (
const auto &FTy : FunctionList) {
880 FTy->isFunctionProtoType());
885 const auto *FP = cast<FunctionProtoType>(FTy);
887 for (
unsigned IParm = 0, e = FP->getNumParams(); IParm != e; ++IParm) {
890 nullptr, FP->getParamType(IParm),
nullptr,
SC_None,
nullptr);
892 ParmList.push_back(Parm);
894 NewOpenCLBuiltin->setParams(ParmList);
897 if (OpenCLBuiltin.IsPure)
898 NewOpenCLBuiltin->
addAttr(PureAttr::CreateImplicit(Context));
899 if (OpenCLBuiltin.IsConst)
900 NewOpenCLBuiltin->
addAttr(ConstAttr::CreateImplicit(Context));
901 if (OpenCLBuiltin.IsConv)
902 NewOpenCLBuiltin->
addAttr(ConvergentAttr::CreateImplicit(Context));
905 NewOpenCLBuiltin->
addAttr(OverloadableAttr::CreateImplicit(Context));
912 if (Len > 1 || HasGenType)
943 auto Index = isOpenCLBuiltin(II->
getName());
951 if (
RISCV().DeclareRVVBuiltins ||
RISCV().DeclareSiFiveVectorBuiltins) {
952 if (!
RISCV().IntrinsicManager)
957 if (
RISCV().IntrinsicManager->CreateIntrinsicIfFound(R, II,
PP))
996 if (ID == Builtin::BIobjc_msgSendSuper)
1004 if (!
Class->getDefinition() ||
Class->isDependentContext())
1008 return !
Class->isBeingDefined();
1016 if (
Class->needsImplicitDefaultConstructor())
1020 if (
Class->needsImplicitCopyConstructor())
1024 if (
Class->needsImplicitCopyAssignment())
1029 if (
Class->needsImplicitMoveConstructor())
1033 if (
Class->needsImplicitMoveAssignment())
1038 if (
Class->needsImplicitDestructor())
1045 switch (Name.getNameKind()) {
1051 return Name.getCXXOverloadedOperator() == OO_Equal;
1069 switch (Name.getNameKind()) {
1074 if (
Record->needsImplicitDefaultConstructor())
1076 if (
Record->needsImplicitCopyConstructor())
1079 Record->needsImplicitMoveConstructor())
1086 if (
Record->getDefinition() &&
Record->needsImplicitDestructor() &&
1092 if (Name.getCXXOverloadedOperator() != OO_Equal)
1098 if (
Record->needsImplicitCopyAssignment())
1101 Record->needsImplicitMoveAssignment())
1141 !isa<CXXRecordDecl>(DC))
1149 if (!
Record->isCompleteDefinition())
1155 auto *ContainedDeducedType =
1159 ContainedDeducedType && ContainedDeducedType->isUndeducedType())
1163 UEnd =
Record->conversion_end();
U != UEnd; ++
U) {
1193 assert(ConvProto &&
"Nonsensical conversion function template type");
1220 UnqualUsingDirectiveSet &UDirs) {
1222 assert(NS && NS->
isFileContext() &&
"CppNamespaceLookup() requires namespace!");
1229 for (
const UnqualUsingEntry &UUE : UDirs.getNamespacesFor(NS))
1240 return Ctx->isFileContext();
1248 for (
Scope *OuterS = S->getParent(); OuterS; OuterS = OuterS->getParent())
1257struct FindLocalExternScope {
1259 : R(R), OldFindLocalExtern(R.getIdentifierNamespace() &
1260 Decl::IDNS_LocalExtern) {
1267 ~FindLocalExternScope() {
1271 bool OldFindLocalExtern;
1296 Name.getCXXNameType()->isDependentType()) {
1327 UnqualUsingDirectiveSet UDirs(*
this);
1328 bool VisitedUsingDirectives =
false;
1329 bool LeftStartingScope =
false;
1332 FindLocalExternScope FindLocals(R);
1335 bool SearchNamespaceScope =
true;
1337 for (; I != IEnd && S->isDeclScope(*I); ++I) {
1340 !(*I)->isTemplateParameter()) {
1346 if (!LeftStartingScope && !Initial->
isDeclScope(*I))
1347 LeftStartingScope =
true;
1351 if (LeftStartingScope && !((*I)->hasLinkage())) {
1358 SearchNamespaceScope =
false;
1363 if (!SearchNamespaceScope) {
1365 if (S->isClassScope())
1366 if (
auto *
Record = dyn_cast_if_present<CXXRecordDecl>(S->getEntity()))
1382 for (; Ctx && !Ctx->Equals(OuterCtx); Ctx = Ctx->getLookupParent()) {
1386 if (Ctx->isTransparentContext())
1392 if (Ctx->isFunctionOrMethod()) {
1396 if (Method->isInstanceMethod() && Name.getAsIdentifierInfo())
1400 Name.getAsIdentifierInfo(),
1416 if (Ctx->isFileContext()) {
1418 if (!VisitedUsingDirectives) {
1421 if (UCtx->isTransparentContext())
1424 UDirs.visit(UCtx, UCtx);
1429 Scope *InnermostFileScope = S;
1430 while (InnermostFileScope &&
1432 InnermostFileScope = InnermostFileScope->
getParent();
1433 UDirs.visitScopeChain(Initial, InnermostFileScope);
1437 VisitedUsingDirectives =
true;
1462 if (!S)
return false;
1473 if (!VisitedUsingDirectives) {
1474 UDirs.visitScopeChain(Initial, S);
1481 FindLocals.restore();
1487 for (; S; S = S->getParent()) {
1490 for (; I != IEnd && S->isDeclScope(*I); ++I) {
1501 if (
Found && S->isTemplateParamScope()) {
1509 for (; Ctx && !Ctx->Equals(OuterCtx); Ctx = Ctx->getLookupParent()) {
1513 if (Ctx->isTransparentContext())
1519 if (!(
Found && S->isTemplateParamScope())) {
1520 assert(Ctx->isFileContext() &&
1521 "We should have been looking only at file context here already.");
1554 if (
auto *TD = dyn_cast<TemplateDecl>(ND))
1555 for (
auto *Param : *TD->getTemplateParameters())
1561 if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(Entity)) {
1566 }
else if (
CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Entity)) {
1569 }
else if (
EnumDecl *ED = dyn_cast<EnumDecl>(Entity)) {
1570 if (
auto *Pattern = ED->getTemplateInstantiationPattern())
1572 }
else if (
VarDecl *VD = dyn_cast<VarDecl>(Entity)) {
1580 if (Context->isFileContext())
1599bool Sema::isUsableModule(
const Module *M) {
1600 assert(M &&
"We shouldn't check nullness for module here");
1602 if (UsableModuleUnitsCache.count(M))
1610 if (M == TheGlobalModuleFragment || M == TheImplicitGlobalModuleFragment) {
1611 UsableModuleUnitsCache.insert(M);
1629 if (Current->isImplicitGlobalModule())
1630 Current = Current->getTopLevelModule();
1640 if (llvm::count_if(ModuleScopes,
1641 [&M](
const ModuleScope &MS) {
return MS.Module == M; }) ||
1643 UsableModuleUnitsCache.insert(M);
1659 if (isUsableModule(Merged))
1664template <
typename ParmDecl>
1669 if (!
D->hasDefaultArgument())
1674 auto &DefaultArg =
D->getDefaultArgStorage();
1678 if (!DefaultArg.isInherited() && Modules) {
1679 auto *NonConstD =
const_cast<ParmDecl*
>(
D);
1685 D = DefaultArg.getInheritedFrom();
1693 if (
auto *
P = dyn_cast<TemplateTypeParmDecl>(
D))
1694 return ::hasAcceptableDefaultArgument(*
this,
P, Modules, Kind);
1696 if (
auto *
P = dyn_cast<NonTypeTemplateParmDecl>(
D))
1697 return ::hasAcceptableDefaultArgument(*
this,
P, Modules, Kind);
1699 return ::hasAcceptableDefaultArgument(
1700 *
this, cast<TemplateTemplateParmDecl>(
D), Modules, Kind);
1715template <
typename Filter>
1720 bool HasFilteredRedecls =
false;
1722 for (
auto *Redecl :
D->
redecls()) {
1723 auto *R = cast<NamedDecl>(Redecl);
1730 HasFilteredRedecls =
true;
1733 Modules->push_back(R->getOwningModule());
1737 if (HasFilteredRedecls)
1750 if (
auto *RD = dyn_cast<CXXRecordDecl>(
D))
1751 return RD->getTemplateSpecializationKind() ==
1753 if (
auto *FD = dyn_cast<FunctionDecl>(
D))
1754 return FD->getTemplateSpecializationKind() ==
1756 if (
auto *VD = dyn_cast<VarDecl>(
D))
1757 return VD->getTemplateSpecializationKind() ==
1759 llvm_unreachable(
"unknown explicit specialization kind");
1766 return ::hasAcceptableExplicitSpecialization(*
this,
D, Modules,
1772 return ::hasAcceptableExplicitSpecialization(*
this,
D, Modules,
1781 "not a member specialization");
1822 "should not call this: not in slow case");
1825 assert(DeclModule &&
"hidden decl has no owning module");
1835 auto IsEffectivelyFileContext = [](
const DeclContext *DC) {
1837 isa<ExportDecl>(DC);
1843 if (DC && !IsEffectivelyFileContext(DC)) {
1851 bool AcceptableWithinParent;
1853 bool SearchDefinitions =
true;
1854 if (
const auto *DCD = dyn_cast<Decl>(DC)) {
1855 if (
const auto *TD = DCD->getDescribedTemplate()) {
1858 SearchDefinitions = Index >= TPL->
size() || TPL->
getParam(Index) !=
D;
1861 if (SearchDefinitions)
1862 AcceptableWithinParent =
1865 AcceptableWithinParent =
1867 }
else if (isa<ParmVarDecl>(
D) ||
1868 (isa<FunctionDecl>(DC) && !SemaRef.
getLangOpts().CPlusPlus))
1869 AcceptableWithinParent =
isAcceptable(SemaRef, cast<NamedDecl>(DC), Kind);
1873 AcceptableWithinParent =
false;
1876 AcceptableWithinParent =
true;
1880 }
while (!IsEffectivelyFileContext(DC));
1882 AcceptableWithinParent =
1894 return AcceptableWithinParent;
1901 "Additional Sema::AcceptableKind?");
1902 return isReachableSlow(SemaRef,
D);
1908 if (ModulePrivate && isUsableModule(M))
1913 if (!ModulePrivate && VisibleModules.
isVisible(M))
1921 if (LookupModules.empty())
1925 if (LookupModules.count(M))
1939 return llvm::any_of(LookupModules, [&](
const Module *LookupM) {
1947 assert(!
isVisible(SemaRef,
D) &&
"Shouldn't call the slow case.\n");
1950 assert(DeclModule &&
"hidden decl has no owning module");
2019 assert(
D->isExternallyDeclarable() &&
2020 "should not have hidden, non-externally-declarable result here");
2059 auto ND = cast<NamedDecl>(RD);
2063 if (ND->isInIdentifierNamespace(IDNS) &&
2075 *
this,
D, Modules, [](
const NamedDecl *) {
return true; },
2083 *
this,
D, Modules, [](
const NamedDecl *) {
return true; },
2088 if (
auto *ND = dyn_cast<NamespaceDecl>(
D)) {
2096 if (
auto *Acceptable =
getSema().VisibleNamespaceCache.lookup(Key))
2150 if (
auto *FD = dyn_cast<FunctionDecl>(ND);
2151 FD && FD->isReservedGlobalPlacementOperator())
2180 if (
auto *TD = dyn_cast<TagDecl>(DC))
2187 bool ForceNoCPlusPlus) {
2189 if (!Name)
return false;
2199 (S->getEntity() && S->getEntity()->isTransparentContext()))
2204 FindLocalExternScope FindLocals(R);
2210 bool LeftStartingScope =
false;
2219 if (!LeftStartingScope && !S->isDeclScope(*I))
2220 LeftStartingScope =
true;
2224 if (LeftStartingScope && !((*I)->hasLinkage())) {
2230 !isa<ImplicitParamDecl>(*I))
2240 while (S && !S->isDeclScope(
D))
2255 for (++LastI; LastI != IEnd; ++LastI) {
2258 if (!S->isDeclScope(*LastI))
2280 if (CppLookupName(R, S))
2326 assert(StartDC->
isFileContext() &&
"start context is not a file context");
2339 NamespaceDecl *ND = I->getNominatedNamespace()->getFirstDecl();
2341 Queue.push_back(ND);
2348 bool FoundTag =
false;
2349 bool FoundNonTag =
false;
2354 while (!Queue.empty()) {
2359 bool UseLocal = !R.
empty();
2389 Queue.push_back(Nom);
2394 if (FoundTag && FoundNonTag)
2404 bool InUnqualifiedLookup) {
2405 assert(LookupCtx &&
"Sema::LookupQualifiedName requires a lookup context");
2411 assert((!isa<TagDecl>(LookupCtx) ||
2413 cast<TagDecl>(LookupCtx)->isCompleteDefinition() ||
2414 cast<TagDecl>(LookupCtx)->isBeingDefined()) &&
2415 "Declaration context must already be complete!");
2417 struct QualifiedLookupInScope {
2425 ~QualifiedLookupInScope() {
2426 Context->setUseQualifiedLookup(oldVal);
2430 CXXRecordDecl *LookupRec = dyn_cast<CXXRecordDecl>(LookupCtx);
2445 Name.getCXXNameType()->isDependentType()) {
2510 if ((*
Path.Decls)->isInIdentifierNamespace(IDNS))
2517 Paths.setOrigin(LookupRec);
2530 int SubobjectNumber = 0;
2536 if ((*I)->isInIdentifierNamespace(IDNS) && (*I)->isCXXInstanceMember())
2548 using Result =
const void *;
2550 auto Next = [&](Iterator &It, Iterator End) ->
Result {
2564 if (TemplateNameLookup)
2573 return T.getCanonicalType().getAsOpaquePtr();
2583 Iterator AIt = A, BIt = B, AEnd, BEnd;
2585 Result AResult = Next(AIt, AEnd);
2586 Result BResult = Next(BIt, BEnd);
2587 if (!AResult && !BResult)
2589 if (!AResult || !BResult)
2591 if (AResult != BResult) {
2594 llvm::SmallDenseMap<Result, bool, 32> AResults;
2595 for (; AResult; AResult = Next(AIt, AEnd))
2596 AResults.insert({AResult,
false});
2598 for (; BResult; BResult = Next(BIt, BEnd)) {
2599 auto It = AResults.find(BResult);
2600 if (It == AResults.end())
2607 return AResults.size() ==
Found;
2618 SubobjectAccess = std::min(SubobjectAccess,
Path->Access);
2621 if (SubobjectType.isNull()) {
2628 if (SubobjectType !=
2636 if (HasOnlyStaticMembers(
Path->Decls) &&
2637 HasSameDeclarations(Paths.begin()->Decls,
Path->Decls))
2640 R.setAmbiguousBaseSubobjectTypes(Paths);
2654 if (HasOnlyStaticMembers(
Path->Decls))
2659 R.setAmbiguousBaseSubobjects(Paths);
2670 if (
NamedDecl *ND = R.getAcceptableDecl(*I))
2688 QualType ObjectType,
bool AllowBuiltinCreation,
2689 bool EnteringContext) {
2696 bool IsDependent =
false;
2697 if (!ObjectType.
isNull()) {
2700 assert((!SS || SS->
isEmpty()) &&
2701 "ObjectType and scope specifier cannot coexist");
2707 "Caller should have completed object type");
2726 return LookupName(R, S, AllowBuiltinCreation);
2733 else if (IsDependent)
2746 for (
const auto &BaseSpec :
Class->bases()) {
2761 Result.suppressDiagnostics();
2771 assert(
Result.isAmbiguous() &&
"Lookup result must be ambiguous");
2777 switch (
Result.getAmbiguityKind()) {
2780 QualType SubobjectType = Paths->front().back().Base->getType();
2781 Diag(NameLoc, diag::err_ambiguous_member_multiple_subobjects)
2786 while (isa<CXXMethodDecl>(*
Found) &&
2787 cast<CXXMethodDecl>(*Found)->isStatic())
2790 Diag((*Found)->getLocation(), diag::note_ambiguous_member_found);
2795 Diag(NameLoc, diag::err_ambiguous_member_multiple_subobject_types)
2796 << Name << LookupRange;
2799 std::set<const NamedDecl *> DeclsPrinted;
2801 PathEnd = Paths->end();
2806 if (DeclsPrinted.insert(
D).second) {
2807 if (
const auto *TD = dyn_cast<TypedefNameDecl>(
D->getUnderlyingDecl()))
2809 << TD->getUnderlyingType();
2810 else if (
const auto *TD = dyn_cast<TypeDecl>(
D->getUnderlyingDecl()))
2821 Diag(NameLoc, diag::err_ambiguous_tag_hiding) << Name << LookupRange;
2826 if (
TagDecl *TD = dyn_cast<TagDecl>(
D)) {
2827 TagDecls.insert(TD);
2828 Diag(TD->getLocation(), diag::note_hidden_tag);
2832 if (!isa<TagDecl>(
D))
2838 if (TagDecls.count(F.
next()))
2846 Diag(NameLoc, diag::err_using_placeholder_variable) << Name << LookupRange;
2858 Diag(NameLoc, diag::err_ambiguous_reference) << Name << LookupRange;
2868 struct AssociatedLookup {
2872 : S(S), Namespaces(Namespaces), Classes(Classes),
2873 InstantiationLoc(InstantiationLoc) {
2878 return ClassesTransitive.insert(RD);
2914 while (!Ctx->isFileContext() || Ctx->isInlineNamespace())
2915 Ctx = Ctx->getParent();
2920 DeclContext *PrimaryCtx = Ctx->getPrimaryContext();
2921 Decl *PrimaryD = cast<Decl>(PrimaryCtx);
2922 Decl *
D = cast<Decl>(Ctx);
2965 Namespaces.insert(Ctx);
2967 Namespaces.insert(PrimaryCtx);
2996 DeclContext *Ctx = ClassTemplate->getDeclContext();
2997 if (
CXXRecordDecl *EnclosingClass = dyn_cast<CXXRecordDecl>(Ctx))
2998 Result.Classes.insert(EnclosingClass);
3028 if (
Class->getDeclName() ==
Result.S.VAListTagName)
3041 if (
CXXRecordDecl *EnclosingClass = dyn_cast<CXXRecordDecl>(Ctx))
3042 Result.Classes.insert(EnclosingClass);
3057 = dyn_cast<ClassTemplateSpecializationDecl>(
Class)) {
3058 DeclContext *Ctx = Spec->getSpecializedTemplate()->getDeclContext();
3059 if (
CXXRecordDecl *EnclosingClass = dyn_cast<CXXRecordDecl>(Ctx))
3060 Result.Classes.insert(EnclosingClass);
3065 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
3082 Bases.push_back(
Class);
3083 while (!Bases.empty()) {
3085 Class = Bases.pop_back_val();
3088 for (
const auto &
Base :
Class->bases()) {
3099 if (
Result.addClassTransitive(BaseDecl)) {
3106 Bases.push_back(BaseDecl);
3134#define TYPE(Class, Base)
3135#define DEPENDENT_TYPE(Class, Base) case Type::Class:
3136#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3137#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
3138#define ABSTRACT_TYPE(Class, Base)
3139#include "clang/AST/TypeNodes.inc"
3152 case Type::ConstantArray:
3153 case Type::IncompleteArray:
3154 case Type::VariableArray:
3155 T = cast<ArrayType>(
T)->getElementType().getTypePtr();
3168 case Type::Record: {
3170 cast<CXXRecordDecl>(cast<RecordType>(
T)->getDecl());
3183 if (
CXXRecordDecl *EnclosingClass = dyn_cast<CXXRecordDecl>(Ctx))
3184 Result.Classes.insert(EnclosingClass);
3195 case Type::FunctionProto: {
3198 Queue.push_back(Arg.getTypePtr());
3202 case Type::FunctionNoProto: {
3217 case Type::MemberPointer: {
3221 Queue.push_back(MemberPtr->
getClass());
3229 case Type::BlockPointer:
3235 case Type::LValueReference:
3236 case Type::RValueReference:
3242 case Type::ExtVector:
3243 case Type::ConstantMatrix:
3250 case Type::DeducedTemplateSpecialization:
3256 case Type::ObjCObject:
3257 case Type::ObjCInterface:
3258 case Type::ObjCObjectPointer:
3259 Result.Namespaces.insert(
Result.S.Context.getTranslationUnitDecl());
3265 T = cast<AtomicType>(
T)->getValueType().getTypePtr();
3268 T = cast<PipeType>(
T)->getElementType().getTypePtr();
3272 case Type::ArrayParameter:
3275 case Type::HLSLAttributedResource:
3276 T = cast<HLSLAttributedResourceType>(
T)->getWrappedType().getTypePtr();
3281 T = Queue.pop_back_val();
3289 AssociatedNamespaces.clear();
3290 AssociatedClasses.clear();
3292 AssociatedLookup
Result(*
this, InstantiationLoc,
3293 AssociatedNamespaces, AssociatedClasses);
3302 for (
unsigned ArgIdx = 0; ArgIdx != Args.size(); ++ArgIdx) {
3303 Expr *Arg = Args[ArgIdx];
3351 assert(!Operators.
isAmbiguous() &&
"Operator lookup cannot be ambiguous");
3357 bool ConstArg,
bool VolatileArg,
bool RValueThis,
3358 bool ConstThis,
bool VolatileThis) {
3360 "doing special member lookup into record that isn't fully complete");
3362 if (RValueThis || ConstThis || VolatileThis)
3365 "constructors and destructors always have unqualified lvalue this");
3366 if (ConstArg || VolatileArg)
3369 "parameter-less special members can't have qualified arguments");
3374 llvm::FoldingSetNodeID ID;
3376 ID.AddInteger(llvm::to_underlying(
SM));
3377 ID.AddInteger(ConstArg);
3378 ID.AddInteger(VolatileArg);
3379 ID.AddInteger(RValueThis);
3380 ID.AddInteger(ConstThis);
3381 ID.AddInteger(VolatileThis);
3398 DeclareImplicitDestructor(RD);
3413 Expr *Arg =
nullptr;
3424 DeclareImplicitDefaultConstructor(RD);
3433 DeclareImplicitCopyConstructor(RD);
3438 DeclareImplicitMoveConstructor(RD);
3445 DeclareImplicitCopyAssignment(RD);
3450 DeclareImplicitMoveAssignment(RD);
3503 "lookup for a constructor or assignment operator was empty");
3504 Result->setMethod(
nullptr);
3513 for (
NamedDecl *CandDecl : Candidates) {
3514 if (CandDecl->isInvalidDecl())
3540 CtorInfo.FoundDecl,
nullptr,
3546 assert(isa<UsingDecl>(Cand.
getDecl()) &&
3547 "illegal Kind of operator = Decl");
3554 Result->setMethod(cast<CXXMethodDecl>(Best->Function));
3559 Result->setMethod(cast<CXXMethodDecl>(Best->Function));
3564 Result->setMethod(
nullptr);
3569 Result->setMethod(
nullptr);
3580 false,
false,
false,
false,
false);
3582 return cast_or_null<CXXConstructorDecl>(
Result.getMethod());
3588 "non-const, non-volatile qualifiers for copy ctor arg");
3593 return cast_or_null<CXXConstructorDecl>(
Result.getMethod());
3602 return cast_or_null<CXXConstructorDecl>(
Result.getMethod());
3609 if (Class->needsImplicitDefaultConstructor())
3610 DeclareImplicitDefaultConstructor(Class);
3611 if (Class->needsImplicitCopyConstructor())
3612 DeclareImplicitCopyConstructor(Class);
3613 if (getLangOpts().CPlusPlus11 && Class->needsImplicitMoveConstructor())
3614 DeclareImplicitMoveConstructor(Class);
3620 return Class->lookup(Name);
3624 unsigned Quals,
bool RValueThis,
3625 unsigned ThisQuals) {
3627 "non-const, non-volatile qualifiers for copy assignment arg");
3629 "non-const, non-volatile qualifiers for copy assignment this");
3635 return Result.getMethod();
3641 unsigned ThisQuals) {
3643 "non-const, non-volatile qualifiers for copy assignment this");
3649 return Result.getMethod();
3653 return cast_or_null<CXXDestructorDecl>(
3655 false,
false,
false)
3662 bool AllowTemplate,
bool AllowStringTemplatePack,
3666 "literal operator lookup can't be ambiguous");
3671 bool AllowCooked =
true;
3672 bool FoundRaw =
false;
3673 bool FoundTemplate =
false;
3674 bool FoundStringTemplatePack =
false;
3675 bool FoundCooked =
false;
3680 D = USD->getTargetDecl();
3689 bool IsTemplate =
false;
3690 bool IsStringTemplatePack =
false;
3691 bool IsCooked =
false;
3694 if (FD->getNumParams() == 1 &&
3695 FD->getParamDecl(0)->getType()->getAs<
PointerType>())
3697 else if (FD->getNumParams() == ArgTys.size()) {
3699 for (
unsigned ArgIdx = 0; ArgIdx != ArgTys.size(); ++ArgIdx) {
3700 QualType ParamTy = FD->getParamDecl(ArgIdx)->getType();
3710 if (Params->
size() == 1) {
3733 IsStringTemplatePack =
true;
3737 if (AllowTemplate && StringLit && IsTemplate) {
3738 FoundTemplate =
true;
3740 AllowCooked =
false;
3741 AllowStringTemplatePack =
false;
3742 if (FoundRaw || FoundCooked || FoundStringTemplatePack) {
3744 FoundRaw = FoundCooked = FoundStringTemplatePack =
false;
3746 }
else if (AllowCooked && IsCooked) {
3749 AllowTemplate = StringLit;
3750 AllowStringTemplatePack =
false;
3751 if (FoundRaw || FoundTemplate || FoundStringTemplatePack) {
3755 FoundRaw = FoundTemplate = FoundStringTemplatePack =
false;
3757 }
else if (AllowRaw && IsRaw) {
3759 }
else if (AllowTemplate && IsTemplate) {
3760 FoundTemplate =
true;
3761 }
else if (AllowStringTemplatePack && IsStringTemplatePack) {
3762 FoundStringTemplatePack =
true;
3772 if (StringLit && FoundTemplate)
3783 if (FoundRaw && FoundTemplate) {
3796 if (FoundStringTemplatePack)
3800 if (DiagnoseMissing) {
3803 << (ArgTys.size() == 2 ? ArgTys[1] :
QualType()) << AllowRaw
3804 << (AllowTemplate || AllowStringTemplatePack);
3816 if (Old ==
nullptr || Old == New) {
3827 Cursor = Cursor->getPreviousDecl();
3831 if (!Cursor)
return;
3834 if (Cursor == OldFD)
break;
3849 AssociatedNamespaces,
3863 for (
auto *
NS : AssociatedNamespaces) {
3883 auto *Underlying =
D;
3884 if (
auto *USD = dyn_cast<UsingShadowDecl>(
D))
3885 Underlying = USD->getTargetDecl();
3887 if (!isa<FunctionDecl>(Underlying) &&
3888 !isa<FunctionTemplateDecl>(Underlying))
3918 llvm::any_of(AssociatedClasses, [&](
auto *
E) {
3922 if (E->getOwningModule() != FM)
3926 DeclContext *Ctx = E->getDeclContext();
3927 while (!Ctx->isFileContext() || Ctx->isInlineNamespace())
3928 Ctx = Ctx->getParent();
3955 Result.insert(Underlying);
3969class ShadowContextRAII;
3971class VisibleDeclsRecord {
3976 typedef llvm::TinyPtrVector<NamedDecl*> ShadowMapEntry;
3981 typedef llvm::DenseMap<DeclarationName, ShadowMapEntry> ShadowMap;
3984 std::list<ShadowMap> ShadowMaps;
3989 friend class ShadowContextRAII;
3995 return !VisitedContexts.insert(Ctx).second;
3999 return VisitedContexts.count(Ctx);
4011 ShadowMaps.back()[ND->
getDeclName()].push_back(ND);
4016class ShadowContextRAII {
4017 VisibleDeclsRecord &Visible;
4019 typedef VisibleDeclsRecord::ShadowMap ShadowMap;
4022 ShadowContextRAII(VisibleDeclsRecord &Visible) : Visible(Visible) {
4023 Visible.ShadowMaps.emplace_back();
4026 ~ShadowContextRAII() {
4027 Visible.ShadowMaps.pop_back();
4035 std::list<ShadowMap>::reverse_iterator
SM = ShadowMaps.rbegin();
4036 for (std::list<ShadowMap>::reverse_iterator SMEnd = ShadowMaps.rend();
4037 SM != SMEnd; ++
SM) {
4039 if (Pos ==
SM->end())
4042 for (
auto *
D : Pos->second) {
4060 SM == ShadowMaps.rbegin())
4065 if (isa<UsingShadowDecl>(ND) && isa<UsingDecl>(
D) &&
4066 cast<UsingShadowDecl>(ND)->getIntroducer() ==
D)
4078class LookupVisibleHelper {
4082 : Consumer(Consumer), IncludeDependentBases(IncludeDependentBases),
4083 LoadExternal(LoadExternal) {}
4086 bool IncludeGlobalScope) {
4090 UnqualUsingDirectiveSet UDirs(SemaRef);
4096 UDirs.visitScopeChain(Initial, S);
4102 Result.setAllowHidden(Consumer.includeHiddenDecls());
4103 if (!IncludeGlobalScope)
4105 ShadowContextRAII Shadow(
Visited);
4106 lookupInScope(Initial, Result, UDirs);
4112 Result.setAllowHidden(Consumer.includeHiddenDecls());
4113 if (!IncludeGlobalScope)
4116 ShadowContextRAII Shadow(
Visited);
4117 lookupInDeclContext(Ctx, Result,
true,
4123 bool QualifiedNameLookup,
bool InBaseClass) {
4128 if (
Visited.visitedContext(Ctx->getPrimaryContext()))
4131 Consumer.EnteredContext(Ctx);
4134 if (isa<TranslationUnitDecl>(Ctx) &&
4136 auto &S = Result.getSema();
4142 Idents.getExternalIdentifierLookup()) {
4143 std::unique_ptr<IdentifierIterator>
Iter(
External->getIdentifiers());
4144 for (StringRef Name =
Iter->Next(); !Name.empty();
4145 Name =
Iter->Next())
4150 for (
const auto &Ident : Idents) {
4155 if (
NamedDecl *ND = Result.getAcceptableDecl(*I)) {
4156 Consumer.FoundDecl(ND,
Visited.checkHidden(ND), Ctx, InBaseClass);
4167 Result.getSema().ForceDeclarationOfImplicitMembers(Class);
4171 bool Load = LoadExternal ||
4172 !(isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx));
4175 Load ? Ctx->lookups()
4176 : Ctx->noload_lookups(
false))
4183 DeclsToVisit.push_back(
D);
4185 for (
auto *
D : DeclsToVisit)
4186 if (
auto *ND = Result.getAcceptableDecl(
D)) {
4187 Consumer.FoundDecl(ND,
Visited.checkHidden(ND), Ctx, InBaseClass);
4191 DeclsToVisit.clear();
4194 if (QualifiedNameLookup) {
4195 ShadowContextRAII Shadow(
Visited);
4196 for (
auto *I : Ctx->using_directives()) {
4197 if (!Result.getSema().isVisible(I))
4199 lookupInDeclContext(I->getNominatedNamespace(), Result,
4200 QualifiedNameLookup, InBaseClass);
4206 if (!
Record->hasDefinition())
4209 for (
const auto &B :
Record->bases()) {
4214 if (!IncludeDependentBases) {
4227 RD = TD->getTemplatedDecl();
4255 ShadowContextRAII Shadow(
Visited);
4256 lookupInDeclContext(RD, Result, QualifiedNameLookup,
4264 for (
auto *Cat : IFace->visible_categories()) {
4265 ShadowContextRAII Shadow(
Visited);
4266 lookupInDeclContext(Cat, Result, QualifiedNameLookup,
4271 for (
auto *I : IFace->all_referenced_protocols()) {
4272 ShadowContextRAII Shadow(
Visited);
4273 lookupInDeclContext(I, Result, QualifiedNameLookup,
4278 if (IFace->getSuperClass()) {
4279 ShadowContextRAII Shadow(
Visited);
4280 lookupInDeclContext(IFace->getSuperClass(), Result, QualifiedNameLookup,
4286 if (IFace->getImplementation()) {
4287 ShadowContextRAII Shadow(
Visited);
4288 lookupInDeclContext(IFace->getImplementation(), Result,
4289 QualifiedNameLookup, InBaseClass);
4292 for (
auto *I :
Protocol->protocols()) {
4293 ShadowContextRAII Shadow(
Visited);
4294 lookupInDeclContext(I, Result, QualifiedNameLookup,
4298 for (
auto *I :
Category->protocols()) {
4299 ShadowContextRAII Shadow(
Visited);
4300 lookupInDeclContext(I, Result, QualifiedNameLookup,
4305 if (
Category->getImplementation()) {
4306 ShadowContextRAII Shadow(
Visited);
4307 lookupInDeclContext(
Category->getImplementation(), Result,
4308 QualifiedNameLookup,
true);
4314 UnqualUsingDirectiveSet &UDirs) {
4317 assert(!IncludeDependentBases &&
"Unsupported flag for lookupInScope");
4322 if (!S->getEntity() ||
4323 (!S->getParent() && !
Visited.alreadyVisitedContext(S->getEntity())) ||
4324 (S->getEntity())->isFunctionOrMethod()) {
4325 FindLocalExternScope FindLocals(Result);
4329 for (
Decl *
D : ScopeDecls) {
4331 if ((ND = Result.getAcceptableDecl(ND))) {
4332 Consumer.FoundDecl(ND,
Visited.checkHidden(ND),
nullptr,
false);
4345 for (
DeclContext *Ctx = Entity; Ctx && !Ctx->Equals(OuterCtx);
4346 Ctx = Ctx->getLookupParent()) {
4348 if (Method->isInstanceMethod()) {
4350 LookupResult IvarResult(Result.getSema(), Result.getLookupName(),
4351 Result.getNameLoc(),
4354 lookupInDeclContext(IFace, IvarResult,
4366 if (Ctx->isFunctionOrMethod())
4369 lookupInDeclContext(Ctx, Result,
false,
4372 }
else if (!S->getParent()) {
4384 lookupInDeclContext(Entity, Result,
false,
4391 for (
const UnqualUsingEntry &UUE : UDirs.getNamespacesFor(Entity))
4392 lookupInDeclContext(
4393 const_cast<DeclContext *
>(UUE.getNominatedNamespace()), Result,
4399 ShadowContextRAII Shadow(
Visited);
4400 lookupInScope(S->getParent(), Result, UDirs);
4406 bool IncludeDependentBases;
4413 bool IncludeGlobalScope,
bool LoadExternal) {
4414 LookupVisibleHelper H(
Consumer,
false,
4416 H.lookupVisibleDecls(*
this, S, Kind, IncludeGlobalScope);
4421 bool IncludeGlobalScope,
4422 bool IncludeDependentBases,
bool LoadExternal) {
4423 LookupVisibleHelper H(
Consumer, IncludeDependentBases, LoadExternal);
4424 H.lookupVisibleDecls(*
this, Ctx, Kind, IncludeGlobalScope);
4435 Scope *S = CurScope;
4437 return cast<LabelDecl>(Res);
4442 RedeclarationKind::NotForRedeclaration);
4451 assert(S &&
"Not in a function?");
4454 return cast<LabelDecl>(Res);
4472 bool EnteringContext,
4473 bool isObjCIvarLookup,
4482 for (; DI != DE; ++DI)
4492 bool AnyVisibleDecls = !NewDecls.empty();
4494 for (; DI != DE; ++DI) {
4496 if (!AnyVisibleDecls) {
4498 AnyVisibleDecls =
true;
4501 NewDecls.push_back(*DI);
4502 }
else if (!AnyVisibleDecls && !(*DI)->isModulePrivate())
4503 NewDecls.push_back(*DI);
4506 if (NewDecls.empty())
4523 Identifiers.clear();
4553 Identifiers.push_back(II);
4580 addName(Name,
nullptr);
4586 addName(Keyword,
nullptr,
nullptr,
true);
4589void TypoCorrectionConsumer::addName(StringRef Name,
NamedDecl *ND,
4593 StringRef TypoStr = Typo->
getName();
4594 unsigned MinED =
abs((
int)Name.size() - (
int)TypoStr.size());
4595 if (MinED && TypoStr.size() / MinED < 3)
4600 unsigned UpperBound = (TypoStr.size() + 2) / 3;
4601 unsigned ED = TypoStr.edit_distance(Name,
true, UpperBound);
4602 if (ED > UpperBound)
return;
4605 if (isKeyword) TC.makeKeyword();
4606 TC.setCorrectionRange(
nullptr, Result.getLookupNameInfo());
4613 StringRef TypoStr = Typo->
getName();
4619 if (TypoStr.size() < 3 &&
4620 (Name != TypoStr || Correction.
getEditDistance(
true) > TypoStr.size()))
4633 if (!CList.empty() && !CList.back().isResolved())
4636 auto RI = llvm::find_if(CList, [NewND](
const TypoCorrection &TypoCorr) {
4639 if (RI != CList.end()) {
4643 auto IsDeprecated = [](
Decl *
D) {
4654 std::pair<bool, std::string> NewKey = {
4658 std::pair<bool, std::string> PrevKey = {
4659 IsDeprecated(RI->getFoundDecl()),
4662 if (NewKey < PrevKey)
4667 if (CList.empty() || Correction.
isResolved())
4668 CList.push_back(Correction);
4671 CorrectionResults.erase(std::prev(CorrectionResults.end()));
4675 const llvm::MapVector<NamespaceDecl *, bool> &KnownNamespaces) {
4676 SearchNamespaces =
true;
4678 for (
auto KNPair : KnownNamespaces)
4679 Namespaces.addNameSpecifier(KNPair.first);
4681 bool SSIsTemplate =
false;
4683 (SS && SS->isValid()) ? SS->getScopeRep() :
nullptr) {
4685 SSIsTemplate =
T->
getTypeClass() == Type::TemplateSpecialization;
4691 for (
unsigned I = 0; I != Types.size(); ++I) {
4692 const auto *TI = Types[I];
4694 CD = CD->getCanonicalDecl();
4695 if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() &&
4696 !CD->isUnion() && CD->getIdentifier() &&
4697 (SSIsTemplate || !isa<ClassTemplateSpecializationDecl>(CD)) &&
4698 (CD->isBeingDefined() || CD->isCompleteDefinition()))
4699 Namespaces.addNameSpecifier(CD);
4705 if (++CurrentTCIndex < ValidatedCorrections.size())
4706 return ValidatedCorrections[CurrentTCIndex];
4708 CurrentTCIndex = ValidatedCorrections.size();
4709 while (!CorrectionResults.empty()) {
4710 auto DI = CorrectionResults.begin();
4711 if (DI->second.empty()) {
4712 CorrectionResults.erase(DI);
4716 auto RI = DI->second.begin();
4717 if (RI->second.empty()) {
4718 DI->second.erase(RI);
4719 performQualifiedLookups();
4725 ValidatedCorrections.push_back(TC);
4726 return ValidatedCorrections[CurrentTCIndex];
4729 return ValidatedCorrections[0];
4732bool TypoCorrectionConsumer::resolveCorrection(
TypoCorrection &Candidate) {
4739 CorrectionValidator->IsObjCIvarLookup,
4741 switch (Result.getResultKind()) {
4751 if (TempMemberContext) {
4754 TempMemberContext =
nullptr;
4757 if (SearchNamespaces)
4758 QualifiedResults.push_back(Candidate);
4768 for (
auto *TRD : Result)
4772 if (SearchNamespaces)
4773 QualifiedResults.push_back(Candidate);
4782void TypoCorrectionConsumer::performQualifiedLookups() {
4783 unsigned TypoLen = Typo->
getName().size();
4785 for (
const auto &NSI : Namespaces) {
4787 const Type *NSType = NSI.NameSpecifier->getAsType();
4795 if (NSDecl->getIdentifier() == QR.getCorrectionAsIdentifierInfo())
4800 TC.ClearCorrectionDecls();
4801 TC.setCorrectionSpecifier(NSI.NameSpecifier);
4802 TC.setQualifierDistance(NSI.EditDistance);
4803 TC.setCallbackDistance(0);
4808 unsigned TmpED = TC.getEditDistance(
true);
4809 if (QR.getCorrectionAsIdentifierInfo() != Typo && TmpED &&
4810 TypoLen / TmpED < 3)
4814 Result.setLookupName(QR.getCorrectionAsIdentifierInfo());
4820 switch (Result.getResultKind()) {
4823 if (SS && SS->isValid()) {
4824 std::string NewQualified = TC.getAsString(SemaRef.
getLangOpts());
4825 std::string OldQualified;
4826 llvm::raw_string_ostream OldOStream(OldQualified);
4828 OldOStream << Typo->
getName();
4832 if (OldOStream.str() == NewQualified)
4836 TRD != TRDEnd; ++TRD) {
4841 TC.addCorrectionDecl(*TRD);
4843 if (TC.isResolved()) {
4844 TC.setCorrectionRange(SS.get(), Result.getLookupNameInfo());
4857 QualifiedResults.clear();
4860TypoCorrectionConsumer::NamespaceSpecifierSet::NamespaceSpecifierSet(
4862 : Context(Context), CurContextChain(buildContextChain(CurContext)) {
4864 CurScopeSpec ? CurScopeSpec->
getScopeRep() :
nullptr) {
4865 llvm::raw_string_ostream SpecifierOStream(CurNameSpecifier);
4873 for (
DeclContext *
C : llvm::reverse(CurContextChain)) {
4874 if (
auto *ND = dyn_cast_or_null<NamespaceDecl>(
C))
4881 DistanceMap[1].push_back(SI);
4884auto TypoCorrectionConsumer::NamespaceSpecifierSet::buildContextChain(
4886 assert(Start &&
"Building a context chain from a null context");
4887 DeclContextList Chain;
4899TypoCorrectionConsumer::NamespaceSpecifierSet::buildNestedNameSpecifier(
4901 unsigned NumSpecifiers = 0;
4903 if (
auto *ND = dyn_cast_or_null<NamespaceDecl>(
C)) {
4906 }
else if (
auto *RD = dyn_cast_or_null<RecordDecl>(
C)) {
4912 return NumSpecifiers;
4915void TypoCorrectionConsumer::NamespaceSpecifierSet::addNameSpecifier(
4918 unsigned NumSpecifiers = 0;
4919 DeclContextList NamespaceDeclChain(buildContextChain(Ctx));
4920 DeclContextList FullNamespaceDeclChain(NamespaceDeclChain);
4923 for (
DeclContext *
C : llvm::reverse(CurContextChain)) {
4924 if (NamespaceDeclChain.empty() || NamespaceDeclChain.back() !=
C)
4926 NamespaceDeclChain.pop_back();
4930 NumSpecifiers = buildNestedNameSpecifier(NamespaceDeclChain, NNS);
4933 if (NamespaceDeclChain.empty()) {
4937 buildNestedNameSpecifier(FullNamespaceDeclChain, NNS);
4939 dyn_cast_or_null<NamedDecl>(NamespaceDeclChain.back())) {
4941 bool SameNameSpecifier =
false;
4942 if (llvm::is_contained(CurNameSpecifierIdentifiers, Name)) {
4943 std::string NewNameSpecifier;
4944 llvm::raw_string_ostream SpecifierOStream(NewNameSpecifier);
4948 SameNameSpecifier = NewNameSpecifier == CurNameSpecifier;
4950 if (SameNameSpecifier || llvm::is_contained(CurContextIdentifiers, Name)) {
4954 buildNestedNameSpecifier(FullNamespaceDeclChain, NNS);
4962 if (NNS && !CurNameSpecifierIdentifiers.empty()) {
4966 llvm::ComputeEditDistance(
llvm::ArrayRef(CurNameSpecifierIdentifiers),
4970 SpecifierInfo SI = {Ctx, NNS, NumSpecifiers};
4971 DistanceMap[NumSpecifiers].push_back(SI);
4980 bool EnteringContext,
4981 bool isObjCIvarLookup,
4987 if (MemberContext) {
4989 if (isObjCIvarLookup) {
5011 false, EnteringContext);
5016 if (Method->isInstanceMethod() && Method->getClassInterface() &&
5021 = Method->getClassInterface()->lookupInstanceVariable(Name)) {
5033 bool AfterNestedNameSpecifier) {
5034 if (AfterNestedNameSpecifier) {
5047 static const char *
const CTypeSpecs[] = {
5048 "char",
"const",
"double",
"enum",
"float",
"int",
"long",
"short",
5049 "signed",
"struct",
"union",
"unsigned",
"void",
"volatile",
5052 "extern",
"inline",
"static",
"typedef"
5055 for (
const auto *CTS : CTypeSpecs)
5085 static const char *
const CastableTypeSpecs[] = {
5086 "char",
"double",
"float",
"int",
"long",
"short",
5087 "signed",
"unsigned",
"void"
5089 for (
auto *kw : CastableTypeSpecs)
5108 static const char *
const CXXExprs[] = {
5109 "delete",
"new",
"operator",
"throw",
"typeid"
5111 for (
const auto *CE : CXXExprs)
5114 if (isa<CXXMethodDecl>(SemaRef.
CurContext) &&
5115 cast<CXXMethodDecl>(SemaRef.
CurContext)->isInstance())
5134 static const char *
const CStmts[] = {
5135 "do",
"else",
"for",
"goto",
"if",
"return",
"switch",
"while" };
5136 for (
const auto *CS : CStmts)
5144 if (S && S->getBreakParent())
5147 if (S && S->getContinueParent())
5161 if (S && S->isClassScope()) {
5181std::unique_ptr<TypoCorrectionConsumer> Sema::makeTypoCorrectionConsumer(
5219 locs->second.count(TypoName.
getLoc()))
5249 std::unique_ptr<CorrectionCandidateCallback> ClonedCCC = CCC.
clone();
5250 auto Consumer = std::make_unique<TypoCorrectionConsumer>(
5251 *
this, TypoName, LookupKind, S, SS, std::move(ClonedCCC), MemberContext,
5255 bool IsUnqualifiedLookup =
false;
5257 if (MemberContext) {
5262 for (
auto *I : OPT->
quals())
5265 }
else if (SS && SS->
isSet()) {
5272 IsUnqualifiedLookup =
true;
5277 bool SearchNamespaces
5279 (IsUnqualifiedLookup || (SS && SS->
isSet()));
5281 if (IsUnqualifiedLookup || SearchNamespaces) {
5292 std::unique_ptr<IdentifierIterator>
Iter(
External->getIdentifiers());
5294 StringRef Name =
Iter->Next();
5304 *
Consumer->getCorrectionValidator(),
5309 if (SearchNamespaces) {
5313 LoadedExternalKnownNamespaces =
true;
5315 for (
auto *N : ExternalKnownNamespaces)
5316 KnownNamespaces[N] =
true;
5319 Consumer->addNamespaces(KnownNamespaces);
5331 bool EnteringContext,
5333 bool RecordFailure) {
5339 MemberContext, EnteringContext, OPT))
5350 auto Consumer = makeTypoCorrectionConsumer(TypoName, LookupKind, S, SS, CCC,
5351 MemberContext, EnteringContext,
5359 return FailedCorrection(Typo, TypoName.
getLoc(), RecordFailure);
5363 unsigned ED =
Consumer->getBestEditDistance(
true);
5364 unsigned TypoLen = Typo->getName().size();
5365 if (ED > 0 && TypoLen / ED < 3)
5366 return FailedCorrection(Typo, TypoName.
getLoc(), RecordFailure);
5371 return FailedCorrection(Typo, TypoName.
getLoc(), RecordFailure);
5375 if (TypoLen >= 3 && ED > 0 && TypoLen / ED < 3) {
5379 return FailedCorrection(Typo, TypoName.
getLoc(), RecordFailure);
5383 if (!SecondBestTC ||
5389 if (ED == 0 &&
Result.isKeyword())
5390 return FailedCorrection(Typo, TypoName.
getLoc(), RecordFailure);
5396 }
else if (SecondBestTC && ObjCMessageReceiver) {
5402 BestTC = SecondBestTC;
5403 else if ((*
Consumer)[
"super"].front().isKeyword())
5404 BestTC = (*Consumer)[
"super"].front();
5410 return FailedCorrection(Typo, TypoName.
getLoc(), RecordFailure);
5419 return FailedCorrection(Typo, TypoName.
getLoc(), RecordFailure && !SecondBestTC);
5428 auto Consumer = makeTypoCorrectionConsumer(TypoName, LookupKind, S, SS, CCC,
5429 MemberContext, EnteringContext,
5436 TypoName, LookupKind, S, SS, *
Consumer->getCorrectionValidator(),
5437 MemberContext, EnteringContext, OPT);
5439 Consumer->addCorrection(ExternalTypo);
5447 unsigned ED =
Consumer->getBestEditDistance(
true);
5449 if (!ExternalTypo && ED > 0 && Typo->getName().size() / ED < 3)
5452 return createDelayedTypo(std::move(
Consumer), std::move(TDG), std::move(TRC),
5460 CorrectionDecls.clear();
5462 CorrectionDecls.push_back(CDecl);
5464 if (!CorrectionName)
5469 if (CorrectionNameSpec) {
5470 std::string tmpBuffer;
5471 llvm::raw_string_ostream PrefixOStream(tmpBuffer);
5473 PrefixOStream << CorrectionName;
5474 return PrefixOStream.str();
5489 bool HasNonType =
false;
5490 bool HasStaticMethod =
false;
5491 bool HasNonStaticMethod =
false;
5492 for (
Decl *
D : candidate) {
5494 D = FTD->getTemplatedDecl();
5496 if (Method->isStatic())
5497 HasStaticMethod =
true;
5499 HasNonStaticMethod =
true;
5501 if (!isa<TypeDecl>(
D))
5513 bool HasExplicitTemplateArgs,
5515 : NumArgs(NumArgs), HasExplicitTemplateArgs(HasExplicitTemplateArgs),
5516 CurContext(SemaRef.CurContext), MemberFn(ME) {
5519 !HasExplicitTemplateArgs && NumArgs == 1;
5528 for (
auto *
C : candidate) {
5532 FD = FTD->getTemplatedDecl();
5533 if (!HasExplicitTemplateArgs && !FD) {
5534 if (!(FD = dyn_cast<FunctionDecl>(ND)) && isa<ValueDecl>(ND)) {
5538 QualType ValType = cast<ValueDecl>(ND)->getType();
5544 if (FPT->getNumParams() == NumArgs)
5551 : isa<TypeDecl>(ND)) &&
5554 return NumArgs <= 1 || HasExplicitTemplateArgs || isa<CXXRecordDecl>(ND);
5566 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
5567 if (MemberFn || !MD->isStatic()) {
5570 ? dyn_cast_if_present<CXXMethodDecl>(MemberFn->
getMemberDecl())
5571 : dyn_cast_if_present<CXXMethodDecl>(CurContext);
5573 CurMD ? CurMD->
getParent()->getCanonicalDecl() :
nullptr;
5586 bool ErrorRecovery) {
5594 if (
const auto *VD = dyn_cast<VarDecl>(
D))
5595 return VD->getDefinition();
5596 if (
const auto *FD = dyn_cast<FunctionDecl>(
D))
5597 return FD->getDefinition();
5598 if (
const auto *TD = dyn_cast<TagDecl>(
D))
5599 return TD->getDefinition();
5600 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(
D))
5601 return ID->getDefinition();
5602 if (
const auto *PD = dyn_cast<ObjCProtocolDecl>(
D))
5603 return PD->getDefinition();
5604 if (
const auto *TD = dyn_cast<TemplateDecl>(
D))
5605 if (
const NamedDecl *TTD = TD->getTemplatedDecl())
5619 assert(Owner &&
"definition of hidden declaration is not in a module");
5622 OwningModules.push_back(Owner);
5624 OwningModules.insert(OwningModules.end(), Merged.begin(), Merged.end());
5633 llvm::StringRef IncludingFile) {
5634 bool IsAngled =
false;
5636 E, IncludingFile, &IsAngled);
5637 return (IsAngled ?
'<' :
'"') +
Path + (IsAngled ?
'>' :
'"');
5644 assert(!Modules.empty());
5648 if (isa<NamespaceDecl>(
Decl))
5651 auto NotePrevious = [&] {
5655 Diag(DeclLoc, diag::note_unreachable_entity) << (
int)MIK;
5660 llvm::SmallDenseSet<Module*, 8> UniqueModuleSet;
5661 for (
auto *M : Modules) {
5664 if (UniqueModuleSet.insert(M).second)
5665 UniqueModules.push_back(M);
5669 std::string HeaderName;
5680 if (!HeaderName.empty() || UniqueModules.empty()) {
5683 Diag(UseLoc, diag::err_module_unimported_use_header)
5684 << (
int)MIK <<
Decl << !HeaderName.empty() << HeaderName;
5692 Modules = UniqueModules;
5694 auto GetModuleNameForDiagnostic = [
this](
const Module *M) -> std::string {
5710 if (Modules.size() > 1) {
5711 std::string ModuleList;
5713 for (
const auto *M : Modules) {
5714 ModuleList +=
"\n ";
5715 if (++N == 5 && N != Modules.size()) {
5716 ModuleList +=
"[...]";
5719 ModuleList += GetModuleNameForDiagnostic(M);
5722 Diag(UseLoc, diag::err_module_unimported_use_multiple)
5723 << (
int)MIK <<
Decl << ModuleList;
5726 Diag(UseLoc, diag::err_module_unimported_use)
5727 << (
int)MIK <<
Decl << GetModuleNameForDiagnostic(Modules[0]);
5740 bool ErrorRecovery) {
5749 assert(
Decl &&
"import required but no declaration to import");
5757 << CorrectedQuotedStr << (ErrorRecovery ? FixTypo :
FixItHint());
5764 if (
const auto *FD = dyn_cast_if_present<FunctionDecl>(ChosenDecl);
5765 FD && FD->getBuiltinID() &&
5766 PrevNote.
getDiagID() == diag::note_previous_decl &&
5768 ChosenDecl =
nullptr;
5772 Diag(ChosenDecl->getLocation(), PrevNote)
5773 << CorrectedQuotedStr << (ErrorRecovery ?
FixItHint() : FixTypo);
5780TypoExpr *Sema::createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
5781 TypoDiagnosticGenerator TDG,
5782 TypoRecoveryCallback TRC,
5784 assert(TCC &&
"createDelayedTypo requires a valid TypoCorrectionConsumer");
5786 auto &State = DelayedTypos[TE];
5787 State.Consumer = std::move(TCC);
5788 State.DiagHandler = std::move(TDG);
5789 State.RecoveryHandler = std::move(TRC);
5796 auto Entry = DelayedTypos.find(TE);
5797 assert(Entry != DelayedTypos.end() &&
5798 "Failed to get the state for a TypoExpr!");
5799 return Entry->second;
5803 DelayedTypos.erase(TE);
5809 RedeclarationKind::NotForRedeclaration);
5825 if (cast<Decl>(
CurContext)->getOwningModuleForLinkage())
5826 return RedeclarationKind::ForVisibleRedeclaration;
5827 return RedeclarationKind::ForExternalRedeclaration;
Defines the clang::ASTContext interface.
Defines enum values for all the target-independent builtin functions.
enum clang::sema::@1727::IndirectLocalPathEntry::EntryKind Kind
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::DenseSet< const void * > Visited
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
Defines the clang::Preprocessor interface.
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
static Module * getDefiningModule(Sema &S, Decl *Entity)
Find the module in which the given declaration was defined.
static bool isPreferredLookupResult(Sema &S, Sema::LookupNameKind Kind, const NamedDecl *D, const NamedDecl *Existing)
Determine whether D is a better lookup result than Existing, given that they declare the same entity.
static bool CanDeclareSpecialMemberFunction(const CXXRecordDecl *Class)
Determine whether we can declare a special member function within the class at this point.
static bool canHideTag(const NamedDecl *D)
Determine whether D can hide a tag declaration.
static std::string getHeaderNameForHeader(Preprocessor &PP, FileEntryRef E, llvm::StringRef IncludingFile)
Get a "quoted.h" or <angled.h> include path to use in a diagnostic suggesting the addition of a #incl...
static void addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType T)
static QualType getOpenCLTypedefType(Sema &S, llvm::StringRef Name)
Lookup an OpenCL typedef type.
static DeclContext * findOuterContext(Scope *S)
Find the outer declaration context from this scope.
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.
static bool isNamespaceOrTranslationUnitScope(Scope *S)
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 LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC)
static QualType getOpenCLEnumType(Sema &S, llvm::StringRef Name)
Lookup an OpenCL enum type.
static void CollectEnclosingNamespace(Sema::AssociatedNamespaceSet &Namespaces, DeclContext *Ctx)
static bool hasAcceptableDefaultArgument(Sema &S, const ParmDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
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, SourceLocation Loc, const DeclContext *DC)
If there are any implicit member functions with the given name that need to be declared in the given ...
static void AddKeywordsToConsumer(Sema &SemaRef, TypoCorrectionConsumer &Consumer, Scope *S, CorrectionCandidateCallback &CCC, bool AfterNestedNameSpecifier)
Add keywords to the consumer as possible typo corrections.
static void GetQualTypesForOpenCLBuiltin(Sema &S, const OpenCLBuiltinStruct &OpenCLBuiltin, unsigned &GenTypeMaxCnt, SmallVector< QualType, 1 > &RetTypes, SmallVector< SmallVector< QualType, 1 >, 5 > &ArgTypes)
Get the QualType instances of the return type and arguments for an OpenCL builtin function signature.
static QualType diagOpenCLBuiltinTypeError(Sema &S, llvm::StringRef TypeClass, llvm::StringRef Name)
Diagnose a missing builtin type.
static bool hasAcceptableMemberSpecialization(Sema &S, const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
static bool hasAcceptableDeclarationImpl(Sema &S, const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Filter F, Sema::AcceptableKind Kind)
static bool isCandidateViable(CorrectionCandidateCallback &CCC, TypoCorrection &Candidate)
static const DeclContext * getContextForScopeMatching(const Decl *D)
Get a representative context for a declaration such that two declarations will have the same context ...
static NamedDecl * findAcceptableDecl(Sema &SemaRef, NamedDecl *D, unsigned IDNS)
Retrieve the visible declaration corresponding to D, if any.
static void GetOpenCLBuiltinFctOverloads(ASTContext &Context, unsigned GenTypeMaxCnt, std::vector< QualType > &FunctionList, SmallVector< QualType, 1 > &RetTypes, SmallVector< SmallVector< QualType, 1 >, 5 > &ArgTypes)
Create a list of the candidate function overloads for an OpenCL builtin function.
static const unsigned MaxTypoDistanceResultSets
static const NamedDecl * getDefinitionToImport(const NamedDecl *D)
Find which declaration we should import to provide the definition of the given declaration.
static void getNestedNameSpecifierIdentifiers(NestedNameSpecifier *NNS, SmallVectorImpl< const IdentifierInfo * > &Identifiers)
static bool hasAcceptableExplicitSpecialization(Sema &S, const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
static unsigned getIDNS(Sema::LookupNameKind NameKind, bool CPlusPlus, bool Redeclaration)
static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR, IdentifierInfo *II, const unsigned FctIndex, const unsigned Len)
When trying to resolve a function name, if isOpenCLBuiltin() returns a non-null <Index,...
static void LookupPredefedObjCSuperType(Sema &Sema, Scope *S)
Looks up the declaration of "struct objc_super" and saves it for later use in building builtin declar...
static bool CppNamespaceLookup(Sema &S, LookupResult &R, ASTContext &Context, const DeclContext *NS, UnqualUsingDirectiveSet &UDirs)
This file declares semantic analysis functions specific to RISC-V.
const NestedNameSpecifier * Specifier
__DEVICE__ long long abs(long long __n)
A class for storing results from argument-dependent lookup.
void insert(NamedDecl *D)
Adds a new ADL candidate to this map.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
const SmallVectorImpl< Type * > & getTypes() const
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
DeclarationNameTable DeclarationNames
QualType getRecordType(const RecordDecl *Decl) const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
QualType getEnumType(const EnumDecl *Decl) const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Builtin::Context & BuiltinInfo
const LangOptions & getLangOpts() const
void setObjCSuperType(QualType ST)
const clang::PrintingPolicy & getPrintingPolicy() const
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Underlying=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
bool isInSameModule(const Module *M1, const Module *M2)
If the two module M1 and M2 are in the same module.
bool isPredefinedLibFunction(unsigned ID) const
Determines whether this builtin is a predefined libc/libm function, such as "malloc",...
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
std::list< CXXBasePath >::iterator paths_iterator
std::list< CXXBasePath >::const_iterator const_paths_iterator
void swap(CXXBasePaths &Other)
Swap this data structure's contents with another CXXBasePaths object.
Represents a base class of a C++ class.
QualType getType() const
Retrieves the type of the base class.
Represents a C++ constructor within a class.
Represents a C++ destructor within a class.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
base_class_iterator bases_end()
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
bool needsImplicitDefaultConstructor() const
Determine if we need to declare a default constructor for this class.
bool needsImplicitMoveConstructor() const
Determine whether this class should get an implicit move constructor or if any existing special membe...
CXXRecordDecl * getDefinition() const
static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, AccessSpecifier DeclAccess)
Calculates the access of a decl that is reached along a path.
const CXXRecordDecl * getTemplateInstantiationPattern() const
Retrieve the record declaration from which this record could be instantiated.
bool lookupInBases(BaseMatchesCallback BaseMatches, CXXBasePaths &Paths, bool LookupInDependent=false) const
Look for entities within the base classes of this C++ class, transitively searching all base class su...
base_class_iterator bases_begin()
bool needsImplicitCopyConstructor() const
Determine whether this class needs an implicit copy constructor to be lazily declared.
bool needsImplicitDestructor() const
Determine whether this class needs an implicit destructor to be lazily declared.
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
bool needsImplicitMoveAssignment() const
Determine whether this class should get an implicit move assignment operator or if any existing speci...
bool needsImplicitCopyAssignment() const
Determine whether this class needs an implicit copy assignment operator to be lazily declared.
bool isDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is derived from the class Base.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
SourceRange getRange() const
bool isSet() const
Deprecated.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
bool isEmpty() const
No scope specifier.
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
bool WantExpressionKeywords
virtual unsigned RankCandidate(const TypoCorrection &candidate)
Method used by Sema::CorrectTypo to assign an "edit distance" rank to a candidate (where a lower valu...
virtual bool ValidateCandidate(const TypoCorrection &candidate)
Simple predicate used by the default RankCandidate to determine whether to return an edit distance of...
bool WantFunctionLikeCasts
bool WantRemainingKeywords
virtual std::unique_ptr< CorrectionCandidateCallback > clone()=0
Clone this CorrectionCandidateCallback.
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
NamedDecl * getDecl() const
The results of name lookup within a DeclContext.
DeclListNode::iterator iterator
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
udir_range using_directives() const
Returns iterator range [First, Last) of UsingDirectiveDecls stored within this context.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC.
bool isFileContext() const
bool isTransparentContext() const
isTransparentContext - Determines whether this context is a "transparent" context,...
ASTContext & getParentASTContext() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool shouldUseQualifiedLookup() const
void setUseQualifiedLookup(bool use=true) const
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
bool isInlineNamespace() const
bool isFunctionOrMethod() const
DeclContext * getLookupParent()
Find the parent context of this context that will be used for unqualified name lookup.
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
bool isTemplateDecl() const
returns true if this declaration is a template
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
bool isFunctionOrFunctionTemplate() const
Whether this declaration is a function or function template.
ASTContext & getASTContext() const LLVM_READONLY
bool isInNamedModule() const
Whether this declaration comes from a named module.
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
bool isInIdentifierNamespace(unsigned NS) const
bool isInvisibleOutsideTheOwningModule() const
bool isInExportDeclContext() const
Whether this declaration was exported in a lexical context.
bool isInAnotherModuleUnit() const
Whether this declaration comes from another module unit.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool isTemplateParameter() const
isTemplateParameter - Determines whether this declaration is a template parameter.
bool isInvalidDecl() const
unsigned getIdentifierNamespace() const
SourceLocation getLocation() const
@ IDNS_NonMemberOperator
This declaration is a C++ operator declared in a non-class context.
@ IDNS_TagFriend
This declaration is a friend class.
@ IDNS_Ordinary
Ordinary names.
@ IDNS_Type
Types, declared with 'struct foo', typedefs, etc.
@ IDNS_OMPReduction
This declaration is an OpenMP user defined reduction construction.
@ IDNS_Label
Labels, declared with 'x:' and referenced with 'goto x'.
@ IDNS_Member
Members, declared with object declarations within tag definitions.
@ IDNS_OMPMapper
This declaration is an OpenMP user defined mapper.
@ IDNS_ObjCProtocol
Objective C @protocol.
@ IDNS_Namespace
Namespaces, declared with 'namespace foo {}'.
@ IDNS_OrdinaryFriend
This declaration is a friend function.
@ IDNS_Using
This declaration is a using declaration.
@ IDNS_LocalExtern
This declaration is a function-local extern declaration of a variable or function.
@ IDNS_Tag
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
bool isDeprecated(std::string *Message=nullptr) const
Determine whether this declaration is marked 'deprecated'.
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack.
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
bool isDefinedOutsideFunctionOrMethod() const
isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside...
DeclContext * getDeclContext()
TranslationUnitDecl * getTranslationUnitDecl()
bool hasTagIdentifierNamespace() const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible.
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
std::string getAsString() const
Retrieve the human-readable string for this name.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
@ CXXConversionFunctionName
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
NameKind getNameKind() const
Determine what kind of name this is.
DiagnosticOptions & getDiagnosticOptions() const
Retrieve the diagnostic options.
bool hasFatalErrorOccurred() const
The return type of classify().
This represents one expression.
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
bool isFPConstrained() const
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
Cached information about one file (either on disk or in the virtual file system).
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
bool ValidateCandidate(const TypoCorrection &candidate) override
Simple predicate used by the default RankCandidate to determine whether to return an edit distance of...
FunctionCallFilterCCC(Sema &SemaRef, unsigned NumArgs, bool HasExplicitTemplateArgs, MemberExpr *ME=nullptr)
Represents a function declaration or definition.
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isDeleted() const
Whether this function has been deleted.
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin=false, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, Expr *TrailingRequiresClause=nullptr)
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > param_types() const
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
ExtInfo withCallingConv(CallingConv cc) const
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getReturnType() const
Provides lookups to, and iteration over, IdentiferInfo objects.
One of these records is kept for each identifier that is lexed.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
StringRef getName() const
Return the actual identifier string.
iterator - Iterate over the decls of a specified declaration name.
iterator begin(DeclarationName Name)
Returns an iterator over decls with the name 'Name'.
iterator end()
Returns the end iterator.
bool isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
IdentifierInfoLookup * getExternalIdentifierLookup() const
Retrieve the external identifier lookup object, if any.
Represents the declaration of a label.
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A class for iterating through a result set and possibly filtering out results.
void restart()
Restart the iteration.
void erase()
Erase the last element returned from this iterator.
Represents the results of name lookup.
void addAllDecls(const LookupResult &Other)
Add all the declarations from another set of lookup results.
@ 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.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
@ Found
Name lookup found a single declaration that met the criteria.
void setShadowed()
Note that we found and ignored a declaration while performing lookup.
static bool isAvailableForLookup(Sema &SemaRef, NamedDecl *ND)
Determine whether this lookup is permitted to see the declaration.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void setFindLocalExtern(bool FindLocalExtern)
void setAllowHidden(bool AH)
Specify whether hidden declarations are visible, e.g., for recovery reasons.
DeclClass * getAsSingle() const
void setContextRange(SourceRange SR)
Sets a 'context' source range.
static bool isAcceptable(Sema &SemaRef, NamedDecl *D, Sema::AcceptableKind Kind)
void setAmbiguousQualifiedTagHiding()
Make these results show that the name was found in different contexts and a tag decl was hidden by an...
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
bool isTemplateNameLookup() const
void setAmbiguousBaseSubobjects(CXXBasePaths &P)
Make these results show that the name was found in distinct base classes of the same type.
bool isSingleTagDecl() const
Asks if the result is a single tag decl.
void setLookupName(DeclarationName Name)
Sets the name to look up.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
SourceLocation getNameLoc() const
Gets the location of the identifier.
void setAmbiguousBaseSubobjectTypes(CXXBasePaths &P)
Make these results show that the name was found in base classes of different types.
Filter makeFilter()
Create a filter for this result set.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
void setHideTags(bool Hide)
Sets whether tag declarations should be hidden by non-tag declarations during resolution.
NamedDecl * getAcceptableDecl(NamedDecl *D) const
Retrieve the accepted (re)declaration of the given declaration, if there is one.
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
unsigned getIdentifierNamespace() const
Returns the identifier namespace mask for this lookup.
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
Sema & getSema() const
Get the Sema object that this lookup result is searching with.
void setNamingClass(CXXRecordDecl *Record)
Sets the 'naming class' for this lookup.
LookupResultKind getResultKind() const
void print(raw_ostream &)
static bool isReachable(Sema &SemaRef, NamedDecl *D)
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
bool isForRedeclaration() const
True if this lookup is just looking for an existing declaration.
DeclarationName getLookupName() const
Gets the name to look up.
@ AmbiguousTagHiding
Name lookup results in an ambiguity because an entity with a tag name was hidden by an entity with an...
@ AmbiguousBaseSubobjectTypes
Name lookup results in an ambiguity because multiple entities that meet the lookup criteria were foun...
@ AmbiguousReferenceToPlaceholderVariable
Name lookup results in an ambiguity because multiple placeholder variables were found in the same sco...
@ AmbiguousReference
Name lookup results in an ambiguity because multiple definitions of entity that meet the lookup crite...
@ AmbiguousBaseSubobjects
Name lookup results in an ambiguity because multiple nonstatic entities that meet the lookup criteria...
void setNotFoundInCurrentInstantiation()
Note that while no result was found in the current instantiation, there were dependent base classes t...
static bool isVisible(Sema &SemaRef, NamedDecl *D)
Determine whether the given declaration is visible to the program.
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getPointeeType() const
const Type * getClass() const
virtual bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc)=0
Check global module index for missing imports.
Describes a module or submodule.
StringRef getTopLevelModuleName() const
Retrieve the name of the top-level module.
bool isPrivateModule() const
bool isModuleVisible(const Module *M) const
Determine whether the specified module would be visible to a lookup at the end of this module.
bool isModuleInterfaceUnit() const
bool isModuleMapModule() const
bool isHeaderLikeModule() const
Is this module have similar semantics as headers.
StringRef getPrimaryModuleInterfaceName() const
Get the primary module interface name from a partition.
bool isExplicitGlobalModule() const
bool isGlobalModule() const
Does this Module scope describe a fragment of the global module within some C++ module.
bool isImplicitGlobalModule() const
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
bool isNamedModule() const
Does this Module is a named module of a standard named module?
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
bool isExternallyDeclarable() const
Determine whether this declaration can be redeclared in a different translation unit.
Represent a C++ namespace.
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
ObjCCategoryDecl - Represents a category declaration.
Represents an ObjC class declaration.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a pointer to an Objective C object.
Represents one property declaration in an Objective-C interface.
Represents an Objective-C protocol declaration.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
@ CSK_Normal
Normal lookup.
SmallVectorImpl< OverloadCandidate >::iterator iterator
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
llvm::iterator_range< decls_iterator > decls() const
Represents a parameter to a function.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
unsigned getDiagID() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
bool isMacroDefined(StringRef Id)
HeaderSearch & getHeaderSearchInfo() const
OptionalFileEntryRef getHeaderToIncludeForDiagnostics(SourceLocation IncLoc, SourceLocation MLoc)
We want to produce a diagnostic at location IncLoc concerning an unreachable effect at location MLoc ...
A (possibly-)qualified type.
const IdentifierInfo * getBaseTypeIdentifier() const
Retrieves a pointer to the name of the base type.
void addConst()
Add the const type qualifier to this QualType.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
void addVolatile()
Add the volatile type qualifier to this QualType.
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Scope - A scope is a transient data structure that is used while parsing the program.
const Scope * getFnParent() const
getFnParent - Return the closest scope that is a function body.
bool isDeclScope(const Decl *D) const
isDeclScope - Return true if this is the scope that the specified decl is declared in.
DeclContext * getEntity() const
Get the entity corresponding to this scope.
const Scope * getParent() const
getParent - Return the scope that this is nested in.
@ DeclScope
This is a scope that can contain a declaration.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
std::unique_ptr< sema::RISCVIntrinsicManager > IntrinsicManager
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
SpecialMemberOverloadResult - The overloading result for a special member function.
Sema - This implements semantic analysis and AST building for C.
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
llvm::DenseSet< Module * > LookupModulesCache
Cache of additional modules that should be used for name lookup within the current template instantia...
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
llvm::DenseSet< Module * > & getLookupModules()
Get the set of additional modules that should be checked during name lookup.
LookupNameKind
Describes the kind of name lookup to perform.
@ LookupLabel
Label name lookup.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupUsingDeclName
Look up all declarations in a scope with the given name, including resolved using declarations.
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
@ LookupOMPReductionName
Look up the name of an OpenMP user-defined reduction operation.
@ LookupLocalFriendName
Look up a friend of a local class.
@ LookupObjCProtocolName
Look up the name of an Objective-C protocol.
@ LookupRedeclarationWithLinkage
Look up an ordinary name that is going to be redeclared as a name with linkage.
@ LookupOperatorName
Look up of an operator name (e.g., operator+) for use with operator overloading.
@ LookupObjCImplicitSelfParam
Look up implicit 'self' parameter of an objective-c method.
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupDestructorName
Look up a name following ~ in a destructor name.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
@ LookupOMPMapperName
Look up the name of an OpenMP user-defined mapper.
@ LookupAnyName
Look up any declaration with any name.
bool hasReachableDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
MissingImportKind
Kinds of missing import.
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
bool hasVisibleDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules)
void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID)
bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class)
Perform qualified name lookup into all base classes of the given class.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
Preprocessor & getPreprocessor() const
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
static NamedDecl * getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates=true, bool AllowDependent=true)
Try to interpret the lookup result D as a template-name.
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate, bool DiagnoseMissing, StringLiteral *StringLit=nullptr)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal,...
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Look up a name, looking for a single declaration.
IdentifierInfo * getSuperIdentifier() const
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
llvm::DenseMap< NamedDecl *, NamedDecl * > VisibleNamespaceCache
Map from the most recent declaration of a namespace to the most recent visible declaration of that na...
bool hasMergedDefinitionInCurrentModule(const NamedDecl *Def)
IdentifierSourceLocations TypoCorrectionFailures
A cache containing identifiers for which typo correction failed and their locations,...
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions={}, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false, bool HasMatchedPackOnParmToNonPackOnArg=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
DiagnosticsEngine & getDiagnostics() const
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, UnresolvedSetImpl &Functions)
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
NamedDecl * LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S, bool ForRedeclaration, SourceLocation Loc)
LazilyCreateBuiltin - The specified Builtin-ID was first used at file scope.
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
unsigned TyposCorrected
The number of typos corrected by CorrectTypo.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
Module * getOwningModule(const Decl *Entity)
Get the module owning an entity.
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, ArrayRef< Expr * > Args, AssociatedNamespaceSet &AssociatedNamespaces, AssociatedClassSet &AssociatedClasses)
Find the associated classes and namespaces for argument-dependent lookup for a call with the given se...
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, OverloadCandidateParamOrder PO={})
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
FPOptions & getCurFPFeatures()
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
const LangOptions & getLangOpts() const
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true, bool LoadExternal=true)
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, QualType ObjectType, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
bool isReachable(const NamedDecl *D)
Determine whether a declaration is reachable.
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
NamedDecl * getCurFunctionOrMethodDecl() const
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
sema::FunctionScopeInfo * getCurFunction() const
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Module * getCurrentModule() const
Get the module unit whose scope we are currently within.
void NoteOverloadCandidate(const NamedDecl *Found, const FunctionDecl *Fn, OverloadCandidateRewriteKind RewriteKind=OverloadCandidateRewriteKind(), QualType DestType=QualType(), bool TakingAddress=false)
bool hasReachableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a reachable default argument.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
std::function< void(const TypoCorrection &)> TypoDiagnosticGenerator
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
llvm::SmallVector< TypoExpr *, 2 > TypoExprs
Holds TypoExprs that are created from createDelayedTypo.
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
bool isAcceptable(const NamedDecl *D, AcceptableKind Kind)
Determine whether a declaration is acceptable (visible/reachable).
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
bool isModuleVisible(const Module *M, bool ModulePrivate=false)
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false, OverloadCandidateParamOrder PO={})
AddMethodCandidate - Adds a named decl (which is some kind of method) as a method candidate to the gi...
bool hasVisibleMergedDefinition(const NamedDecl *Def)
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
llvm::FoldingSet< SpecialMemberOverloadResultEntry > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
void diagnoseMissingImport(SourceLocation Loc, const NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
bool hasReachableMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is a member specialization declaration (as op...
RedeclarationKind forRedeclarationInCurContext() const
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
void DiagnoseAmbiguousLookup(LookupResult &Result)
Produce a diagnostic describing the ambiguity that resulted from name lookup.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
void makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location.
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
SourceManager & SourceMgr
bool hasReachableExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is an explicit specialization declaration for...
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
DiagnosticsEngine & Diags
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMemberKind SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
bool hasAcceptableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
Determine if the template parameter D has a reachable default argument.
AccessResult CheckMemberAccess(SourceLocation UseLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found)
Checks access to a member.
SmallVector< Module *, 16 > CodeSynthesisContextLookupModules
Extra modules inspected when performing a lookup during a template instantiation.
llvm::BumpPtrAllocator BumpAlloc
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, ArrayRef< TemplateArgument > TemplateArgs, sema::TemplateDeductionInfo &Info)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, AcceptableKind Kind, bool OnlyNeedComplete=false)
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
LiteralOperatorLookupResult
The possible outcomes of name lookup for a literal operator.
@ LOLR_ErrorNoDiagnostic
The lookup found no match but no diagnostic was issued.
@ LOLR_Raw
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
@ LOLR_Error
The lookup resulted in an error.
@ LOLR_Cooked
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
@ LOLR_StringTemplatePack
The lookup found an overload set of literal operator templates, which expect the character type and c...
@ LOLR_Template
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II)
Called on #pragma clang __debug dump II.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
IdentifierResolver IdResolver
const TypoExprState & getTypoExprState(TypoExpr *TE) const
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, Module *Mod)
Create an implicit import of the given module at the given source location, for error recovery,...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
StringLiteral - This represents a string literal expression, e.g.
Represents the declaration of a struct/union/class/enum.
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getAsType() const
Retrieve the type for a type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
Represents a type template specialization; the template must be a class template, a type alias templa...
Represents a declaration of a type.
const Type * getTypeForDecl() const
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
QualType getCanonicalTypeInternal() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isAnyPointerType() const
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, bool InBaseClass) override
Invoked each time Sema::LookupVisibleDecls() finds a declaration visible from the current scope or co...
void addKeywordResult(StringRef Keyword)
void addCorrection(TypoCorrection Correction)
const TypoCorrection & getNextCorrection()
Return the next typo correction that passes all internal filters and is deemed valid by the consumer'...
void FoundName(StringRef Name)
void addNamespaces(const llvm::MapVector< NamespaceDecl *, bool > &KnownNamespaces)
Set-up method to add to the consumer the set of namespaces to use in performing corrections to nested...
Simple class containing the result of Sema::CorrectTypo.
IdentifierInfo * getCorrectionAsIdentifierInfo() const
ArrayRef< PartialDiagnostic > getExtraDiagnostics() const
static const unsigned InvalidDistance
void addCorrectionDecl(NamedDecl *CDecl)
Add the given NamedDecl to the list of NamedDecls that are the declarations associated with the Decla...
void setCorrectionDecls(ArrayRef< NamedDecl * > Decls)
Clears the list of NamedDecls and adds the given set.
std::string getAsString(const LangOptions &LO) const
bool requiresImport() const
Returns whether this typo correction is correcting to a declaration that was declared in a module tha...
void setCorrectionRange(CXXScopeSpec *SS, const DeclarationNameInfo &TypoName)
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
SourceRange getCorrectionRange() const
void WillReplaceSpecifier(bool ForceReplacement)
void setCallbackDistance(unsigned ED)
DeclarationName getCorrection() const
Gets the DeclarationName of the typo correction.
unsigned getEditDistance(bool Normalized=true) const
Gets the "edit distance" of the typo correction from the typo.
NestedNameSpecifier * getCorrectionSpecifier() const
Gets the NestedNameSpecifier needed to use the typo correction.
SmallVectorImpl< NamedDecl * >::iterator decl_iterator
void setRequiresImport(bool Req)
std::string getQuoted(const LangOptions &LO) const
NamedDecl * getFoundDecl() const
Get the correction declaration found by name lookup (before we looked through using shadow declaratio...
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
A set of unresolved declarations.
void append(iterator I, iterator E)
void truncate(unsigned N)
The iterator over UnresolvedSets.
Represents C++ using-directive.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represents a variable declaration or definition.
VarDecl * getTemplateInstantiationPattern() const
Retrieve the variable declaration from which this variable could be instantiated, if it is an instant...
Consumes visible declarations found when searching for all visible names within a given scope or cont...
virtual bool includeHiddenDecls() const
Determine whether hidden declarations (from unimported modules) should be given to this consumer.
virtual ~VisibleDeclConsumer()
Destroys the visible declaration consumer.
bool isVisible(const Module *M) const
Determine whether a module is visible.
SmallVector< SwitchInfo, 8 > SwitchStack
SwitchStack - This is the current set of active switch statements in the block.
Provides information about an attempted template argument deduction, whose success or failure was des...
bool Load(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ OR_Deleted
Succeeded, but refers to a deleted function.
@ OR_Success
Overload resolution succeeded.
@ OR_Ambiguous
Ambiguous candidates found.
@ OR_No_Viable_Function
No viable function found.
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
std::unique_ptr< sema::RISCVIntrinsicManager > CreateRISCVIntrinsicManager(Sema &S)
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
TemplateDecl * getAsTypeTemplateDecl(Decl *D)
@ Result
The result type of a method or function.
std::pair< unsigned, unsigned > getDepthAndIndex(const NamedDecl *ND)
Retrieve the depth and index of a template parameter.
CXXSpecialMemberKind
Kinds of C++ special members.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
@ Success
Template argument deduction was successful.
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
ConstructorInfo getConstructorInfo(NamedDecl *ND)
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ EST_None
no exception specification
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Represents an element in a path from a derived class to a base class.
int SubobjectNumber
Identifies which base class subobject (of type Base->getType()) this base path element refers to.
const CXXBaseSpecifier * Base
The base specifier that states the link from a derived class to a base class, which will be followed ...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionType::ExtInfo ExtInfo
OverloadExpr * Expression
Describes how types, statements, expressions, and declarations should be printed.