28 using namespace clang;
36 return cast<CXXRecordDecl>(DC)->isLocalClass();
41 template<
typename DeclT>
44 if (!OldDecl->getQualifierLoc())
47 assert((NewDecl->getFriendObjectKind() ||
48 !OldDecl->getLexicalDeclContext()->isDependentContext()) &&
49 "non-friend with qualified name defined in dependent context");
52 const_cast<DeclContext *>(NewDecl->getFriendObjectKind()
53 ? NewDecl->getLexicalDeclContext()
54 : OldDecl->getLexicalDeclContext()));
63 NewDecl->setQualifierInfo(NewQualifierLoc);
78 #include "clang/Sema/AttrTemplateInstantiate.inc" 82 const AlignedAttr *Aligned,
Decl *New,
bool IsPackExpansion) {
83 if (Aligned->isAlignmentExpr()) {
90 Aligned->getSpellingListIndex(), IsPackExpansion);
93 TemplateArgs, Aligned->getLocation(),
97 Aligned->getSpellingListIndex(), IsPackExpansion);
103 const AlignedAttr *Aligned,
Decl *New) {
104 if (!Aligned->isPackExpansion()) {
110 if (Aligned->isAlignmentExpr())
116 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
119 bool Expand =
true, RetainExpansion =
false;
124 Unexpanded, TemplateArgs, Expand,
125 RetainExpansion, NumExpansions))
132 for (
unsigned I = 0; I != *NumExpansions; ++I) {
141 const AssumeAlignedAttr *Aligned,
Decl *New) {
146 Expr *E, *OE =
nullptr;
152 if (Aligned->getOffset()) {
153 Result = S.
SubstExpr(Aligned->getOffset(), TemplateArgs);
160 Aligned->getSpellingListIndex());
165 const AlignValueAttr *Aligned,
Decl *New) {
172 Aligned->getSpellingListIndex());
177 const AllocAlignAttr *Align,
Decl *New) {
180 llvm::APInt(64, Align->getParamIndex().getSourceIndex()),
183 Align->getSpellingListIndex());
189 Expr *Cond =
nullptr;
203 Cond = Converted.
get();
209 S.
Diag(A->
getLocation(), diag::err_attr_cond_never_constant_expr) << A;
210 for (
const auto &
P : Diags)
211 S.
Diag(
P.first,
P.second);
221 S, TemplateArgs, EIA, EIA->getCond(), Tmpl, New);
225 EIA->getLocation(), S.
getASTContext(), Cond, EIA->getMessage(),
226 EIA->getSpellingListIndex()));
233 S, TemplateArgs, DIA, DIA->getCond(), Tmpl, New);
237 DIA->getLocation(), S.
getASTContext(), Cond, DIA->getMessage(),
238 DIA->getDiagnosticType(), DIA->getArgDependent(), New,
239 DIA->getSpellingListIndex()));
246 const CUDALaunchBoundsAttr &
Attr,
Decl *New) {
256 Expr *MinBlocks =
nullptr;
257 if (Attr.getMinBlocks()) {
258 Result = S.
SubstExpr(Attr.getMinBlocks(), TemplateArgs);
265 Attr.getSpellingListIndex());
272 S.
AddModeAttr(Attr.getRange(), New, Attr.getMode(),
273 Attr.getSpellingListIndex(),
true);
279 const OMPDeclareSimdDeclAttr &
Attr,
Decl *New) {
281 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
282 New = FTD->getTemplatedDecl();
283 auto *FD = cast<FunctionDecl>(New);
284 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
289 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
290 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
293 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
295 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
299 FD->isCXXInstanceMember());
304 if (
auto *E = Attr.getSimdlen())
307 if (Attr.uniforms_size() > 0) {
308 for(
auto *E : Attr.uniforms()) {
312 Uniforms.push_back(Inst.
get());
316 auto AI = Attr.alignments_begin();
317 for (
auto *E : Attr.aligneds()) {
321 Aligneds.push_back(Inst.
get());
325 Alignments.push_back(Inst.
get());
329 auto SI = Attr.steps_begin();
330 for (
auto *E : Attr.linears()) {
334 Linears.push_back(Inst.
get());
338 Steps.push_back(Inst.
get());
341 LinModifiers.append(Attr.modifiers_begin(), Attr.modifiers_end());
344 Uniforms, Aligneds, Alignments, Linears, LinModifiers, Steps,
352 if (
NamedDecl *ND = dyn_cast<NamedDecl>(New)) {
353 for (
const auto *TmplAttr : Tmpl->
attrs()) {
357 *
this, dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext()),
358 0, ND->isCXXInstanceMember());
361 TmplAttr, Context, *
this, TemplateArgs);
372 for (
const auto *TmplAttr : Tmpl->
attrs()) {
374 const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
375 if (Aligned && Aligned->isAlignmentDependent()) {
380 const AssumeAlignedAttr *AssumeAligned = dyn_cast<AssumeAlignedAttr>(TmplAttr);
386 const AlignValueAttr *AlignValue = dyn_cast<AlignValueAttr>(TmplAttr);
392 if (
const auto *AllocAlign = dyn_cast<AllocAlignAttr>(TmplAttr)) {
398 if (
const auto *EnableIf = dyn_cast<EnableIfAttr>(TmplAttr)) {
400 cast<FunctionDecl>(New));
404 if (
const auto *DiagnoseIf = dyn_cast<DiagnoseIfAttr>(TmplAttr)) {
406 cast<FunctionDecl>(New));
410 if (
const CUDALaunchBoundsAttr *CUDALaunchBounds =
411 dyn_cast<CUDALaunchBoundsAttr>(TmplAttr)) {
413 *CUDALaunchBounds, New);
417 if (
const ModeAttr *Mode = dyn_cast<ModeAttr>(TmplAttr)) {
422 if (
const auto *OMPAttr = dyn_cast<OMPDeclareSimdDeclAttr>(TmplAttr)) {
428 if (TmplAttr->getKind() == attr::DLLExport ||
429 TmplAttr->getKind() == attr::DLLImport) {
430 if (New->
hasAttr<DLLExportAttr>() || New->
hasAttr<DLLImportAttr>()) {
435 if (
auto ABIAttr = dyn_cast<ParameterABIAttr>(TmplAttr)) {
436 AddParameterABIAttr(ABIAttr->getRange(), New, ABIAttr->getABI(),
437 ABIAttr->getSpellingListIndex());
441 if (isa<NSConsumedAttr>(TmplAttr) || isa<CFConsumedAttr>(TmplAttr)) {
442 AddNSConsumedAttr(TmplAttr->getRange(), New,
443 TmplAttr->getSpellingListIndex(),
444 isa<NSConsumedAttr>(TmplAttr),
449 assert(!TmplAttr->isPackExpansion());
450 if (TmplAttr->isLateParsed() && LateAttrs) {
454 if (CurrentInstantiationScope)
455 Saved = CurrentInstantiationScope->
cloneScopes(OuterMostScope);
466 *
this, TemplateArgs);
477 template<
typename DeclT>
479 DeclT *
Result = D->getPreviousDecl();
484 if (Result && isa<CXXRecordDecl>(D->getDeclContext()) &&
485 D->getLexicalDeclContext() != Result->getLexicalDeclContext())
493 llvm_unreachable(
"Translation units cannot be instantiated");
498 llvm_unreachable(
"pragma comment cannot be instantiated");
501 Decl *TemplateDeclInstantiator::VisitPragmaDetectMismatchDecl(
503 llvm_unreachable(
"pragma comment cannot be instantiated");
508 llvm_unreachable(
"extern \"C\" context cannot be instantiated");
512 TemplateDeclInstantiator::VisitLabelDecl(
LabelDecl *D) {
520 TemplateDeclInstantiator::VisitNamespaceDecl(
NamespaceDecl *D) {
521 llvm_unreachable(
"Namespaces cannot be instantiated");
540 bool Invalid =
false;
584 TagDecl *oldTag = oldTagType->getDecl();
603 Typedef->setPreviousDecl(InstPrevTypedef);
641 if (getPreviousDeclForInstantiation<TypedefNameDecl>(Pattern)) {
643 if (!Found.
empty()) {
656 AliasInst->setDescribedAliasTemplate(Inst);
657 if (PrevAliasTemplate)
662 if (!PrevAliasTemplate)
682 NewBindings.push_back(cast<BindingDecl>(VisitBindingDecl(OldBD)));
685 auto *NewDD = cast_or_null<DecompositionDecl>(
688 if (!NewDD || NewDD->isInvalidDecl())
689 for (
auto *NewBD : NewBindings)
690 NewBD->setInvalidDecl();
700 bool InstantiatingVarTemplate,
711 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
741 StartingScope, InstantiatingVarTemplate);
744 QualType ReturnType = cast<FunctionDecl>(DC)->getReturnType();
746 Var->setNRVOVariable(
true);
762 Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
763 bool Invalid =
false;
779 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
796 = SemaRef.
SubstExpr(BitWidth, TemplateArgs);
801 BitWidth = InstantiatedBitWidth.
getAs<
Expr>();
806 cast<RecordDecl>(Owner),
815 cast<Decl>(Owner)->setInvalidDecl();
821 if (Field->hasAttrs())
825 Field->setInvalidDecl();
827 if (!Field->getDeclName()) {
832 if (
Parent->isAnonymousStructOrUnion() &&
833 Parent->getRedeclContext()->isFunctionOrMethod())
845 bool Invalid =
false;
849 SemaRef.
Diag(D->
getLocation(), diag::err_property_is_variably_modified)
865 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
894 for (
auto *PI : D->
chain()) {
900 NamedChain[i++] = Next;
903 QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
914 return IndirectField;
929 InstTy = SemaRef.
SubstType(Ty, TemplateArgs,
947 assert(ND &&
"friend decl must be a decl or a type!");
954 if (!NewND)
return nullptr;
973 = SemaRef.
SubstExpr(AssertExpr, TemplateArgs);
978 InstantiatedAssertExpr.
get(),
984 Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
990 if (!Prev)
return nullptr;
991 PrevDecl = cast<EnumDecl>(Prev);
1009 Enum->setIntegerTypeSourceInfo(NewTI);
1012 &&
"Dependent type without type source info");
1035 if (Def && Def != D) {
1042 SemaRef.
SubstType(TI->getType(), TemplateArgs,
1045 DefnUnderlying,
true, Enum);
1077 if (
Expr *UninstValue = EC->getInitExpr()) {
1082 Value = SemaRef.
SubstExpr(UninstValue, TemplateArgs);
1108 Enumerators.push_back(EnumConst);
1109 LastEnumConst = EnumConst;
1125 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
1130 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
1162 if (!Found.
empty()) {
1164 if (PrevClassTemplate)
1177 SS.
Adopt(QualifierLoc);
1179 if (!DC)
return nullptr;
1193 if (R.isSingleResult()) {
1195 if (PrevClassTemplate)
1199 if (!PrevClassTemplate && QualifierLoc) {
1206 bool AdoptedPreviousTemplateParams =
false;
1207 if (PrevClassTemplate) {
1208 bool Complain =
true;
1220 cast<NamespaceDecl>(DC)->
getIdentifier()->isStr(
"__detail")) {
1224 cast<NamespaceDecl>(DCParent)->
getIdentifier()->isStr(
"tr1")) {
1225 if (cast<Decl>(DCParent)->isInStdNamespace())
1240 AdoptedPreviousTemplateParams =
true;
1241 InstParams = PrevParams;
1246 if (!AdoptedPreviousTemplateParams &&
1271 if (PrevClassTemplate)
1281 if (!PrevClassTemplate)
1304 if (!PrevClassTemplate) {
1310 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1311 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1312 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[I]));
1319 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
1332 if (!InstClassTemplate)
1344 "Only static data member templates are allowed.");
1360 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
1366 if (!VarInst)
return nullptr;
1377 if (!PrevVarTemplate)
1387 if (!PrevVarTemplate) {
1393 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1394 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1395 OutOfLineVarPartialSpecs.push_back(
1396 std::make_pair(Inst, PartialSpecs[I]));
1402 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
1405 "Only static data member templates are allowed.");
1411 assert(!Found.
empty() &&
"Instantiation found nothing?");
1414 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
1417 InstVarTemplate->findPartialSpecInstantiatedFromMember(D))
1451 = Instantiated->getDescribedFunctionTemplate();
1453 assert(InstTemplate &&
1454 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
1472 return InstTemplate;
1478 PrevDecl = cast<CXXRecordDecl>(Owner);
1483 if (!Prev)
return nullptr;
1484 PrevDecl = cast<CXXRecordDecl>(Prev);
1508 Record->setObjectOfFriendDecl();
1512 Record->setAnonymousStructOrUnion(
true);
1544 if (!D->isCXXClassMember())
1550 LocalInstantiations.
perform();
1571 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
1577 NewFunc->getParamTypes(), NewEPI);
1590 if (FunctionTemplate && !TemplateParams) {
1593 void *InsertPos =
nullptr;
1603 if (FunctionTemplate)
1608 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1610 !(isa<Decl>(Owner) &&
1611 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1635 }
else if (isFriend && QualifierLoc) {
1637 SS.
Adopt(QualifierLoc);
1639 if (!DC)
return nullptr;
1649 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
1653 if (DGuide->isCopyDeductionCandidate())
1682 for (
unsigned P = 0;
P < Params.size(); ++
P)
1684 Params[
P]->setOwningFunction(Function);
1685 Function->setParams(Params);
1687 if (TemplateParams) {
1705 TemplateParams, Function);
1714 }
else if (FunctionTemplate) {
1717 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1731 bool isExplicitSpecialization =
false;
1742 assert(isFriend &&
"non-friend has dependent specialization info?");
1749 Info->getRAngleLoc());
1750 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
1751 ExplicitArgs, TemplateArgs))
1755 for (
unsigned I = 0, E = Info->getNumTemplates(); I != E; ++I) {
1757 Info->getTemplate(I),
1759 if (!Temp)
return nullptr;
1761 Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
1769 isExplicitSpecialization =
true;
1771 }
else if (TemplateParams || !FunctionTemplate) {
1789 isExplicitSpecialization);
1791 NamedDecl *PrincipalDecl = (TemplateParams
1792 ? cast<NamedDecl>(FunctionTemplate)
1801 bool QueuedInstantiation =
false;
1812 for (
auto R : Function->
redecls()) {
1818 if (!QueuedInstantiation && R->isUsed(
false)) {
1821 if (MSInfo->getPointOfInstantiation().isInvalid()) {
1823 MSInfo->setPointOfInstantiation(Loc);
1825 std::make_pair(Function, Loc));
1826 QueuedInstantiation =
true;
1855 assert(!D->
isDefaulted() &&
"only methods should be defaulted");
1862 bool IsClassScopeSpecialization) {
1864 if (FunctionTemplate && !TemplateParams) {
1870 void *InsertPos =
nullptr;
1880 if (FunctionTemplate)
1885 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1886 !(isa<Decl>(Owner) &&
1887 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1892 unsigned NumTempParamLists = 0;
1894 TempParamLists.resize(NumTempParamLists);
1895 for (
unsigned I = 0; I != NumTempParamLists; ++I) {
1900 TempParamLists[I] = InstParams;
1922 SS.
Adopt(QualifierLoc);
1932 if (!DC)
return nullptr;
1944 StartLoc, NameInfo, T, TInfo,
1945 Constructor->isExplicit(),
1946 Constructor->isInlineSpecified(),
1947 false, Constructor->isConstexpr());
1951 StartLoc, NameInfo, T, TInfo,
1952 Destructor->isInlineSpecified(),
1957 StartLoc, NameInfo, T, TInfo,
1958 Conversion->isInlineSpecified(),
1959 Conversion->isExplicit(),
1960 Conversion->isConstexpr(),
1961 Conversion->getLocEnd());
1965 StartLoc, NameInfo, T, TInfo,
1974 Method->setQualifierInfo(QualifierLoc);
1976 if (TemplateParams) {
1992 Method->getDeclName(),
1993 TemplateParams, Method);
1999 Method->setDescribedFunctionTemplate(FunctionTemplate);
2000 }
else if (FunctionTemplate) {
2003 Method->setFunctionTemplateSpecialization(FunctionTemplate,
2007 }
else if (!isFriend) {
2016 if (NumTempParamLists)
2017 Method->setTemplateParameterListsInfo(
2019 llvm::makeArrayRef(TempParamLists.data(), NumTempParamLists));
2021 Method->setLexicalDeclContext(Owner);
2022 Method->setObjectOfFriendDecl();
2027 for (
unsigned P = 0;
P < Params.size(); ++
P)
2028 Params[
P]->setOwningFunction(Method);
2029 Method->setParams(Params);
2032 Method->setInvalidDecl();
2037 if (!FunctionTemplate || TemplateParams || isFriend) {
2048 if (!IsClassScopeSpecialization)
2057 if (isFriend && Method->getPreviousDecl())
2058 Method->setAccess(Method->getPreviousDecl()->getAccess());
2061 if (FunctionTemplate)
2062 FunctionTemplate->
setAccess(Method->getAccess());
2073 if (FunctionTemplate) {
2077 }
else if (Method->isInvalidDecl() && !Previous.
empty()) {
2081 }
else if (isFriend) {
2092 }
else if (!IsClassScopeSpecialization) {
2116 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
2131 if (InstantiatedDefaultArg)
2132 Inst->setDefaultArgument(InstantiatedDefaultArg);
2142 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
2148 bool IsExpandedParameterPack =
false;
2151 bool Invalid =
false;
2170 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2171 ExpandedParameterPackTypes.push_back(NewT);
2174 IsExpandedParameterPack =
true;
2189 bool RetainExpansion =
false;
2194 Pattern.getSourceRange(),
2197 Expand, RetainExpansion,
2202 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2215 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2216 ExpandedParameterPackTypes.push_back(NewT);
2222 IsExpandedParameterPack =
true;
2259 if (IsExpandedParameterPack)
2264 ExpandedParameterPackTypesAsWritten);
2273 Param->setInvalidDecl();
2280 Param->setDefaultArgument(Value.
get());
2293 for (
const auto &
P : *Params) {
2294 if (
P->isTemplateParameterPack())
2306 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
2313 bool IsExpandedParameterPack =
false;
2327 ExpandedParams.push_back(Expansion);
2330 IsExpandedParameterPack =
true;
2331 InstParams = TempParams;
2343 bool RetainExpansion =
false;
2349 Expand, RetainExpansion,
2354 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2360 ExpandedParams.push_back(Expansion);
2366 IsExpandedParameterPack =
true;
2367 InstParams = TempParams;
2389 if (IsExpandedParameterPack)
2408 Param->setDefaultArgument(
2443 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
2464 if (
auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.
CurContext))
2471 bool CheckRedeclaration = Owner->
isRecord();
2483 SS.
Adopt(QualifierLoc);
2484 if (CheckRedeclaration) {
2515 for (
auto *Shadow : D->
shadows()) {
2518 NamedDecl *OldTarget = Shadow->getTargetDecl();
2519 if (
auto *CUSD = dyn_cast<ConstructorUsingShadowDecl>(Shadow))
2520 if (
auto *BaseShadow = CUSD->getNominatedBaseClassShadowDecl())
2521 OldTarget = BaseShadow;
2525 Shadow->getLocation(), OldTarget, TemplateArgs));
2530 if (CheckRedeclaration) {
2536 Shadow->getLocation(), OldPrev, TemplateArgs));
2544 if (isFunctionScope)
2556 Decl *TemplateDeclInstantiator::VisitConstructorUsingShadowDecl(
2562 template <
typename T>
2563 Decl *TemplateDeclInstantiator::instantiateUnresolvedUsingDecl(
2564 T *D,
bool InstantiatingPackElement) {
2566 if (D->isPackExpansion() && !InstantiatingPackElement) {
2574 bool RetainExpansion =
false;
2577 D->getEllipsisLoc(), D->
getSourceRange(), Unexpanded, TemplateArgs,
2578 Expand, RetainExpansion, NumExpansions))
2583 assert(!RetainExpansion &&
2584 "should never need to retain an expansion for UsingPackDecl");
2590 return instantiateUnresolvedUsingDecl(D,
true);
2601 SemaRef.
Diag(D->getEllipsisLoc(),
2602 diag::err_using_decl_redeclaration_expansion);
2608 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2610 Decl *Slice = instantiateUnresolvedUsingDecl(D,
true);
2617 Expansions.push_back(cast<NamedDecl>(Slice));
2636 SS.
Adopt(QualifierLoc);
2643 bool InstantiatingSlice = D->getEllipsisLoc().isValid() &&
2649 nullptr, D->
getAccess(), D->getUsingLoc(),
2650 TD, TypenameLoc, SS, NameInfo, EllipsisLoc,
2659 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingTypenameDecl(
2661 return instantiateUnresolvedUsingDecl(D);
2664 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingValueDecl(
2666 return instantiateUnresolvedUsingDecl(D);
2674 Expansions.push_back(NewUD);
2685 Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
2700 TemplateArgsPtr = &TemplateArgs;
2712 assert(Specialization &&
"Class scope Specialization is null");
2720 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
2725 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
2726 Vars.push_back(Var);
2738 Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
2745 if (SubstReductionType.
isNull())
2747 bool IsCorrect = !SubstReductionType.
isNull();
2749 std::pair<QualType, SourceLocation> ReductionTypes[] = {
2750 std::make_pair(SubstReductionType, D->
getLocation())};
2752 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
2753 PrevDeclInScope = cast<OMPDeclareReductionDecl>(
2760 auto *NewDRD = cast<OMPDeclareReductionDecl>(DRD.get().getSingleDecl());
2763 Expr *SubstCombiner =
nullptr;
2764 Expr *SubstInitializer =
nullptr;
2769 const char *Names[] = {
"omp_in",
"omp_out"};
2770 for (
auto &Name : Names) {
2772 auto OldLookup = D->
lookup(DN);
2773 auto Lookup = NewDRD->lookup(DN);
2774 if (!OldLookup.empty() && !Lookup.empty()) {
2775 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2787 const char *Names[] = {
"omp_orig",
"omp_priv"};
2788 for (
auto &Name : Names) {
2790 auto OldLookup = D->
lookup(DN);
2791 auto Lookup = NewDRD->lookup(DN);
2792 if (!OldLookup.empty() && !Lookup.empty()) {
2793 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2794 auto *OldVD = cast<VarDecl>(OldLookup.front());
2795 auto *NewVD = cast<VarDecl>(Lookup.front());
2804 IsCorrect = IsCorrect && OmpPrivParm->
hasInit();
2807 NewDRD, SubstInitializer, OmpPrivParm);
2810 IsCorrect && SubstCombiner &&
2813 SubstInitializer) ||
2815 !SubstInitializer && !SubstInitializer));
2825 Decl *TemplateDeclInstantiator::VisitOMPCapturedExprDecl(
2827 llvm_unreachable(
"Should not be met in templates");
2846 Decl *TemplateDeclInstantiator::VisitRecordDecl(
RecordDecl *D) {
2847 llvm_unreachable(
"There are only CXXRecordDecls in C++");
2851 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
2858 "can only instantiate an explicit specialization " 2859 "for a member class template");
2869 if (!InstClassTemplate)
2875 castAs<TemplateSpecializationTypeLoc>();
2879 for (
unsigned I = 0; I != Loc.
getNumArgs(); ++I)
2881 if (SemaRef.
Subst(ArgLocs.data(), ArgLocs.size(),
2882 InstTemplateArgs, TemplateArgs))
2897 void *InsertPos =
nullptr;
2929 diag::note_previous_definition);
2996 assert(VarTemplate &&
2997 "A template specialization without specialized template?");
3005 TemplateArgsInfo.
size(), VarTemplateArgsInfo, TemplateArgs))
3018 void *InsertPos =
nullptr;
3020 Converted, InsertPos))
3025 VarTemplateArgsInfo, Converted);
3041 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
3059 Owner, StartingScope);
3065 llvm_unreachable(
"@defs is not supported in Objective-C++");
3072 "cannot instantiate %0 yet");
3080 llvm_unreachable(
"Unexpected decl");
3089 return Instantiator.
Visit(D);
3101 bool Invalid =
false;
3103 unsigned N = L->
size();
3107 for (
auto &
P : *L) {
3109 Params.push_back(D);
3118 Expr *
const UninstantiatedRequiresClause = L->getRequiresClause();
3122 L->getLAngleLoc(), Params,
3124 UninstantiatedRequiresClause);
3170 InstTemplateArgs, TemplateArgs))
3191 void *InsertPos =
nullptr;
3231 SemaRef.
Diag(PartialSpec->
getLocation(), diag::err_partial_spec_redeclared)
3233 SemaRef.
Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
3264 ClassTemplate->AddPartialSpecialization(InstPartialSpec,
3266 return InstPartialSpec;
3304 InstTemplateArgs, TemplateArgs))
3311 InstTemplateArgs,
false, Converted))
3322 void *InsertPos =
nullptr;
3359 diag::err_var_partial_spec_redeclared)
3362 diag::note_var_prev_partial_spec_here);
3375 diag::err_variable_instantiates_to_function)
3399 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
3402 LateAttrs, Owner, StartingScope);
3404 return InstPartialSpec;
3411 assert(OldTInfo &&
"substituting function without type source info");
3412 assert(Params.empty() &&
"parameter vector is non-empty at start");
3415 unsigned ThisTypeQuals = 0;
3417 ThisContext = cast<CXXRecordDecl>(Owner);
3418 ThisTypeQuals = Method->getTypeQualifiers();
3425 ThisContext, ThisTypeQuals);
3431 if (NewTInfo != OldTInfo) {
3435 unsigned NewIdx = 0;
3436 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
3437 OldIdx != NumOldParams; ++OldIdx) {
3438 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
3443 NumArgumentsInExpansion =
3446 if (!NumArgumentsInExpansion) {
3450 Params.push_back(NewParam);
3455 for (
unsigned I = 0; I != *NumArgumentsInExpansion; ++I) {
3457 Params.push_back(NewParam);
3467 cast<FunctionProtoType>(OldProtoLoc.getType());
3468 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
3478 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
3481 Params.push_back(Parm);
3498 TemplateArgs, ParamTypes, &Params,
3513 unsigned FParamIdx = 0;
3514 for (
unsigned I = 0, N = PatternDecl->
getNumParams(); I != N; ++I) {
3518 assert(FParamIdx < Function->getNumParams());
3545 assert(NumArgumentsInExpansion &&
3546 "should only be called when all template arguments are known");
3549 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
3581 UpdateExceptionSpec(Decl,
EST_None);
3587 Diag(PointOfInstantiation, diag::err_exception_spec_cycle) << Decl;
3588 UpdateExceptionSpec(Decl,
EST_None);
3598 getTemplateInstantiationArgs(Decl,
nullptr,
true);
3603 UpdateExceptionSpec(Decl,
EST_None);
3637 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
3638 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
3640 = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
3641 assert(FunTmpl->getTemplatedDecl() == Tmpl &&
3642 "Deduction from the wrong function template?");
3645 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
3646 ActiveInst.Entity = New;
3652 assert(Proto &&
"Function template without prototype?");
3676 assert(NewProto &&
"Template instantiation without function prototype?");
3694 LateAttrs, StartingScope);
3731 *
this, Loc, FTD, Args->
asArray(),
3732 CodeSynthesisContext::ExplicitTemplateArgumentSubstitution, Info);
3733 if (Inst.isInvalid())
3739 return cast_or_null<FunctionDecl>(SubstDecl(FD, FD->
getParent(), MArgs));
3753 DLLExportAttr *
Attr = Ctor->
getAttr<DLLExportAttr>();
3756 for (
unsigned I = 0; I != NumParams; ++I) {
3783 bool DefinitionRequired,
3786 isa<CXXDeductionGuideDecl>(Function))
3798 assert(PatternDecl &&
"instantiating a non-template");
3801 Stmt *Pattern =
nullptr;
3803 Pattern = PatternDef->
getBody(PatternDef);
3804 PatternDecl = PatternDef;
3806 PatternDef =
nullptr;
3811 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Function,
3813 PatternDecl, PatternDef, TSK,
3814 DefinitionRequired)) {
3815 if (DefinitionRequired)
3822 PendingInstantiations.push_back(
3823 std::make_pair(Function, PointOfInstantiation));
3825 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
3826 !getSourceManager().isInSystemHeader(PatternDecl->
getLocStart())) {
3827 Diag(PointOfInstantiation, diag::warn_func_template_missing)
3830 if (getLangOpts().CPlusPlus11)
3831 Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
3841 !LateTemplateParser) {
3843 LateParsedInstantiations.push_back(
3844 std::make_pair(Function, PointOfInstantiation));
3860 LateTemplateParser) {
3863 ExternalSource->ReadLateParsedTemplates(LateParsedTemplateMap);
3865 auto LPTIter = LateParsedTemplateMap.find(PatternDecl);
3866 assert(LPTIter != LateParsedTemplateMap.end() &&
3867 "missing LateParsedTemplate");
3868 LateTemplateParser(OpaqueParser, *LPTIter->second);
3869 Pattern = PatternDecl->
getBody(PatternDecl);
3875 "unexpected kind of function template definition");
3892 D->setImplicitlyInline();
3902 "instantiating function definition");
3918 bool MergeWithParentScope =
false;
3920 MergeWithParentScope = Rec->isLocalClass();
3925 SetDeclDefaulted(Function, PatternDecl->
getLocation());
3928 getTemplateInstantiationArgs(Function,
nullptr,
false, PatternDecl);
3936 ActOnStartOfFunctionDef(
nullptr, Function);
3948 ActOnSkippedFunctionBody(Function);
3953 InstantiateMemInitializers(Ctor, cast<CXXConstructorDecl>(PatternDecl),
3959 Ctor->isDefaultConstructor()) {
3965 Body = SubstStmt(Pattern, TemplateArgs);
3972 ActOnFinishFunctionBody(Function, Body.
get(),
true);
3974 PerformDependentDiagnostics(PatternDecl, TemplateArgs);
3976 if (
auto *Listener = getASTMutationListener())
3977 Listener->FunctionDefinitionInstantiated(Function);
3983 Consumer.HandleTopLevelDecl(DG);
3987 LocalInstantiations.
perform();
3989 GlobalInstantiations.
perform();
4019 bool IsMemberSpec =
false;
4021 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar))
4022 IsMemberSpec = PartialSpec->isMemberSpecialization();
4024 IsMemberSpec = FromTemplate->isMemberSpecialization();
4034 return cast_or_null<VarTemplateSpecializationDecl>(
4035 Instantiator.VisitVarTemplateSpecializationDecl(
4036 VarTemplate, FromVar, InsertPos, TemplateArgsInfo, Converted));
4045 "don't have a definition to instantiate from");
4055 VarSpec->
setType(DI->getType());
4061 InstantiateVariableInitializer(VarSpec, PatternDecl, TemplateArgs);
4074 bool InstantiatingVarTemplate) {
4097 if (OldVar->
isUsed(
false))
4102 InstantiateAttrs(TemplateArgs, OldVar, NewVar, LateAttrs, StartingScope);
4109 : forRedeclarationInCurContext());
4116 if (
NamedDecl *NewPrev = FindInstantiatedDecl(
4119 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
4122 CheckVariableDeclaration(NewVar,
Previous);
4124 if (!InstantiatingVarTemplate) {
4132 CurrentInstantiationScope->InstantiatedLocal(OldVar, NewVar);
4148 if ((!isa<VarTemplateSpecializationDecl>(NewVar) &&
4149 !InstantiatingVarTemplate &&
4153 InstantiateVariableInitializer(NewVar, OldVar, TemplateArgs);
4160 DiagnoseUnusedDecl(NewVar);
4168 L->VariableDefinitionInstantiated(Var);
4187 Init = SubstInitializer(OldVar->
getInit(), TemplateArgs,
4194 if (Var->
hasAttr<DLLImportAttr>() &&
4198 }
else if (InitExpr) {
4200 AddInitializerToDecl(Var, InitExpr, DirectInit);
4202 ActOnUninitializedDecl(Var);
4225 ActOnUninitializedDecl(Var);
4228 if (getLangOpts().CUDA)
4229 checkAllowedCUDAInitializer(Var);
4249 bool DefinitionRequired,
bool AtEndOfTU) {
4255 VarDecl *PatternDecl =
nullptr, *Def =
nullptr;
4257 getTemplateInstantiationArgs(Var);
4262 bool InstantiationDependent =
false;
4265 "Only instantiate variable template specializations that are " 4266 "not type-dependent");
4267 (void)InstantiationDependent;
4273 "Specialization without specialized template?");
4289 VarTemplateDecl *Tmpl = PatternPtr.get<VarTemplateDecl *>();
4290 while (VarTemplateDecl *From =
4308 if (PatternDecl->isStaticDataMember() &&
4309 (PatternDecl = PatternDecl->getFirstDecl())->hasInit() &&
4317 "instantiating variable initializer");
4334 InstantiateVariableInitializer(Var, PatternDecl, TemplateArgs);
4335 PreviousContext.pop();
4339 LocalInstantiations.
perform();
4341 GlobalInstantiations.
perform();
4345 Def = PatternDecl->getDefinition(getASTContext());
4351 assert(PatternDecl &&
"data member was not instantiated from a template?");
4352 assert(PatternDecl->isStaticDataMember() &&
"not a static data member?");
4353 Def = PatternDecl->getDefinition();
4362 if (!Def && !DefinitionRequired) {
4364 PendingInstantiations.push_back(
4365 std::make_pair(Var, PointOfInstantiation));
4368 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
4369 !getSourceManager().isInSystemHeader(PatternDecl->getLocStart())) {
4370 Diag(PointOfInstantiation, diag::warn_var_template_missing)
4372 Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
4373 if (getLangOpts().CPlusPlus11)
4374 Diag(PointOfInstantiation, diag::note_inst_declaration_hint) << Var;
4384 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Var,
4386 PatternDecl, Def, TSK,
4387 DefinitionRequired))
4405 struct PassToConsumerRAII {
4410 : Consumer(Consumer), Var(Var) { }
4412 ~PassToConsumerRAII() {
4415 } PassToConsumerRAII(Consumer, Var);
4422 PointOfInstantiation);
4430 "instantiating variable definition");
4446 if (Def->isStaticDataMember() && !Def->isOutOfLine()) {
4449 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4450 }
else if (!VarSpec) {
4451 Var = cast_or_null<VarDecl>(SubstDecl(Def, Var->
getDeclContext(),
4460 Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
4469 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
4473 LookupResult R(*
this, Var->getDeclName(), Var->getLocation(),
4474 LookupOrdinaryName, forRedeclarationInCurContext());
4476 MergeVarDecl(Var, R);
4479 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4484 Var = CompleteVarTemplateSpecializationDecl(VarSpec, Def, TemplateArgs);
4486 PreviousContext.pop();
4489 PassToConsumerRAII.Var = Var;
4496 LocalInstantiations.
perform();
4498 GlobalInstantiations.
perform();
4510 for (
const auto *Init : Tmpl->
inits()) {
4513 if (!Init->isWritten())
4518 if (Init->isPackExpansion()) {
4520 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
4524 bool ShouldExpand =
false;
4525 bool RetainExpansion =
false;
4527 if (CheckParameterPacksForExpansion(Init->getEllipsisLoc(),
4530 TemplateArgs, ShouldExpand,
4537 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
4540 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4544 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4554 Init->getSourceLocation(),
4563 BaseTInfo, TempInit.
get(),
4571 NewInits.push_back(NewInit.
get());
4578 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4586 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
4589 Init->getSourceLocation(),
4597 if (Init->isBaseInitializer())
4598 NewInit = BuildBaseInitializer(TInfo->
getType(), TInfo, TempInit.
get(),
4601 NewInit = BuildDelegatingInitializer(TInfo, TempInit.
get(),
4602 cast<CXXRecordDecl>(CurContext->getParent()));
4603 }
else if (Init->isMemberInitializer()) {
4604 FieldDecl *Member = cast_or_null<FieldDecl>(FindInstantiatedDecl(
4605 Init->getMemberLocation(),
4614 NewInit = BuildMemberInitializer(Member, TempInit.
get(),
4615 Init->getSourceLocation());
4616 }
else if (Init->isIndirectMemberInitializer()) {
4618 cast_or_null<IndirectFieldDecl>(FindInstantiatedDecl(
4619 Init->getMemberLocation(),
4620 Init->getIndirectMember(), TemplateArgs));
4622 if (!IndirectMember) {
4628 NewInit = BuildMemberInitializer(IndirectMember, TempInit.
get(),
4629 Init->getSourceLocation());
4636 NewInits.push_back(NewInit.
get());
4641 ActOnMemInitializers(New,
4656 if (Pattern == Instance)
return true;
4669 if (Pattern == Instance)
return true;
4680 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
4682 Instance = cast<ClassTemplatePartialSpecializationDecl>(
4684 if (Pattern == Instance)
4698 if (Pattern == Instance)
return true;
4711 if (Pattern == Instance)
return true;
4724 if (Pattern == Instance)
return true;
4743 template<
typename T>
4752 bool OtherIsPackExpansion;
4754 if (
auto *OtherUUD = dyn_cast<T>(Other)) {
4755 OtherIsPackExpansion = OtherUUD->isPackExpansion();
4757 }
else if (
auto *OtherUPD = dyn_cast<UsingPackDecl>(Other)) {
4758 OtherIsPackExpansion =
true;
4759 OtherFrom = OtherUPD->getInstantiatedFromUsingDecl();
4760 }
else if (
auto *OtherUD = dyn_cast<UsingDecl>(Other)) {
4761 OtherIsPackExpansion =
false;
4766 return Pattern->isPackExpansion() == OtherIsPackExpansion &&
4778 if (Pattern == Instance)
return true;
4788 if (
auto *UUD = dyn_cast<UnresolvedUsingTypenameDecl>(D))
4791 if (
auto *UUD = dyn_cast<UnresolvedUsingValueDecl>(D))
4797 if (
auto *Record = dyn_cast<CXXRecordDecl>(Other))
4800 if (
auto *Function = dyn_cast<FunctionDecl>(Other))
4803 if (
auto *Enum = dyn_cast<EnumDecl>(Other))
4806 if (
auto *Var = dyn_cast<VarDecl>(Other))
4807 if (Var->isStaticDataMember())
4810 if (
auto *Temp = dyn_cast<ClassTemplateDecl>(Other))
4813 if (
auto *Temp = dyn_cast<FunctionTemplateDecl>(Other))
4816 if (
auto *PartialSpec =
4817 dyn_cast<ClassTemplatePartialSpecializationDecl>(Other))
4821 if (
auto *Field = dyn_cast<FieldDecl>(Other)) {
4822 if (!Field->getDeclName()) {
4825 cast<FieldDecl>(D));
4829 if (
auto *Using = dyn_cast<UsingDecl>(Other))
4832 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(Other))
4836 D->
getDeclName() == cast<NamedDecl>(Other)->getDeclName();
4839 template<
typename ForwardIterator>
4842 ForwardIterator first,
4843 ForwardIterator last) {
4844 for (; first != last; ++first)
4846 return cast<NamedDecl>(*first);
4857 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
4858 Decl*
ID = FindInstantiatedDecl(Loc, D, TemplateArgs,
true);
4859 return cast_or_null<DeclContext>(
ID);
4891 bool FindingInstantiatedContext) {
4910 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
4912 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
4913 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
4915 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda())) {
4918 if (CurrentInstantiationScope) {
4919 if (
auto Found = CurrentInstantiationScope->findInstantiationOf(D)) {
4920 if (Decl *FD = Found->dyn_cast<Decl *>())
4921 return cast<NamedDecl>(FD);
4923 int PackIdx = ArgumentPackSubstitutionIndex;
4924 assert(PackIdx != -1 &&
4925 "found declaration pack but not pack expanding");
4927 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
4934 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
4935 isa<TemplateTemplateParmDecl>(D))
4954 bool NeedInstantiate =
false;
4956 NeedInstantiate = RD->isLocalClass();
4958 NeedInstantiate = isa<EnumDecl>(D);
4959 if (NeedInstantiate) {
4960 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4961 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4962 return cast<TypeDecl>(Inst);
4967 assert(isa<LabelDecl>(D));
4969 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4970 assert(Inst &&
"Failed to instantiate label??");
4972 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4973 return cast<LabelDecl>(Inst);
4979 dyn_cast<VarTemplateSpecializationDecl>(D)) {
4980 bool InstantiationDependent =
false;
4982 VarSpec->getTemplateArgsInfo();
4984 VarTemplateArgs, InstantiationDependent))
4985 D = cast<NamedDecl>(
4991 if (!Record->isDependentContext())
5000 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Record))
5012 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
5016 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
5029 if (FD->getFriendObjectKind() && FD->getDeclContext()->isFileContext()){
5030 DC = FD->getLexicalDeclContext();
5036 if (Guide && Guide->isImplicit()) {
5044 Unpacked = Arg.pack_elements();
5047 getTrivialTemplateArgumentLoc(UnpackedArg,
QualType(), Loc));
5053 assert(SubstRecord &&
"class template id not a class type?");
5059 if (FindingInstantiatedContext &&
5060 usesPartialOrExplicitSpecialization(
5061 Loc, cast<ClassTemplateSpecializationDecl>(SubstRecord))) {
5062 Diag(Loc, diag::err_specialization_not_primary_template)
5063 << T << (SubstRecord->getTemplateSpecializationKind() ==
5082 ParentDC = FindInstantiatedContext(Loc, ParentDC, TemplateArgs);
5093 bool IsBeingInstantiated =
false;
5094 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
5095 if (!Spec->isDependentContext()) {
5098 assert(Tag &&
"type of non-dependent record is not a RecordType");
5100 IsBeingInstantiated =
true;
5102 RequireCompleteType(Loc, T, diag::err_incomplete_type))
5114 Name = SubstDeclarationNameInfo(NameInfo, TemplateArgs).getName();
5134 if (isa<UsingShadowDecl>(D)) {
5136 }
else if (Diags.hasErrorOccurred()) {
5140 }
else if (IsBeingInstantiated) {
5146 Diag(Loc, diag::err_member_not_yet_instantiated)
5154 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
5155 EnumDecl *Spec = cast<EnumDecl>(FindInstantiatedDecl(Loc, Enum,
5157 assert(Spec->getTemplateSpecializationKind() ==
5159 Diag(Loc, diag::err_enumerator_does_not_exist)
5162 Diag(Spec->getLocation(), diag::note_enum_specialized_here)
5166 llvm_unreachable(
"Unable to find instantiation of declaration!");
5179 while (!PendingLocalImplicitInstantiations.empty() ||
5180 (!LocalOnly && !PendingInstantiations.empty())) {
5183 if (PendingLocalImplicitInstantiations.empty()) {
5184 Inst = PendingInstantiations.front();
5185 PendingInstantiations.pop_front();
5187 Inst = PendingLocalImplicitInstantiations.front();
5188 PendingLocalImplicitInstantiations.pop_front();
5192 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
5193 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
5195 if (Function->isMultiVersion()) {
5196 getASTContext().forEachMultiversionedFunctionVersion(
5197 Function, [
this, Inst, DefinitionRequired](
FunctionDecl *CurFD) {
5198 InstantiateFunctionDefinition( Inst.second, CurFD,
true,
5199 DefinitionRequired,
true);
5204 InstantiateFunctionDefinition( Inst.second, Function,
true,
5205 DefinitionRequired,
true);
5206 if (Function->isDefined())
5207 Function->setInstantiationIsPending(
false);
5213 VarDecl *Var = cast<VarDecl>(Inst.first);
5216 isa<VarTemplateSpecializationDecl>(Var)) &&
5217 "Not a static data member, nor a variable template" 5218 " specialization?");
5229 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
5244 "instantiating variable definition");
5250 InstantiateVariableDefinition( Inst.second, Var,
true,
5251 DefinitionRequired,
true);
5257 for (
auto DD : Pattern->
ddiags()) {
5258 switch (DD->getKind()) {
5260 HandleDependentAccessCheck(*DD, TemplateArgs);
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
The lookup results will be used for redeclaration of a name with external linkage; non-visible lookup...
Defines the clang::ASTContext interface.
FunctionDecl * getDefinition()
Get the definition for this declaration.
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
static void collectUnexpandedParameterPacks(Sema &S, TemplateParameterList *Params, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
void setImplicit(bool I=true)
Represents a function declaration or definition.
NamespaceDecl * getStdNamespace() const
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
no exception specification
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D)
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
A (possibly-)qualified type.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
const char * getDeclKindName() const
void InstantiatedLocal(const Decl *D, Decl *Inst)
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
Decl * VisitVarDecl(VarDecl *D, bool InstantiatingVarTemplate, ArrayRef< BindingDecl *> *Bindings=nullptr)
bool isOverloadedOperator() const
Whether this function declaration represents an C++ overloaded operator, e.g., "operator+".
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
A stack-allocated class that identifies which local variable declaration instantiations are present i...
const TypeClass * getTypePtr() const
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained)...
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
SourceRange getBraceRange() const
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
static void instantiateDependentAllocAlignAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AllocAlignAttr *Align, Decl *New)
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
NestedNameSpecifierLoc getTemplateQualifierLoc() const
void addOuterTemplateArguments(const TemplateArgumentList *TemplateArgs)
Add a new outermost level to the multi-level template argument list.
Expr * getUnderlyingExpr() const
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, llvm::MutableArrayRef< NamedDecl *> CH)
Stmt - This represents one statement.
Expr * getBitWidth() const
We are matching the template parameter lists of two templates that might be redeclarations.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
Provides information about an attempted template argument deduction, whose success or failure was des...
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
static bool isDeclWithinFunction(const Decl *D)
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
An instance of this object exists for each enum constant that is defined.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList &TemplateArgList, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, void *InsertPos, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
bool isSingleTagDecl() const
Asks if the result is a single tag decl.
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation)
Builds a using declaration.
const Type * getTypeForDecl() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
static Expr * instantiateDependentFunctionAttrCondition(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, Expr *OldCond, const Decl *Tmpl, FunctionDecl *New)
IdentifierInfo * getGetterId() const
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
ThreadStorageClassSpecifier getTSCSpec() const
llvm::PointerUnion< Decl *, DeclArgumentPack * > * findInstantiationOf(const Decl *D)
Find the instantiation of the declaration D within the current instantiation scope.
Defines the C++ template declaration subclasses.
bool hasWrittenPrototype() const
Decl * InstantiateTypedefNameDecl(TypedefNameDecl *D, bool IsTypeAlias)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
void setIsCopyDeductionCandidate()
Declaration of a variable template.
Represent a C++ namespace.
const TargetInfo & getTargetInfo() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
A container of type source information.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
bool isDefined(const FunctionDecl *&Definition) const
Returns true if the function has a definition that does not need to be instantiated.
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
SourceLocation getLocEnd() const LLVM_READONLY
void setInitStyle(InitializationStyle Style)
VarTemplatePartialSpecializationDecl * InstantiateVarTemplatePartialSpecialization(VarTemplateDecl *VarTemplate, VarTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a variable template partial specialization.
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted, bool UpdateArgsWithConversions=true)
Check that the given template arguments can be be provided to the given template, converting the argu...
Represents a C++ constructor within a class.
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
Instantiate or parse a C++ default argument expression as necessary.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
static void instantiateDependentEnableIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const EnableIfAttr *EIA, const Decl *Tmpl, FunctionDecl *New)
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl *> Expansions)
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
void setRAngleLoc(SourceLocation Loc)
unsigned getDepth() const
Get the nesting depth of the template parameter.
enumerator_range enumerators() const
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
void InstantiatedLocalPackArg(const Decl *D, ParmVarDecl *Inst)
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
RAII object that enters a new expression evaluation context.
Represents a variable declaration or definition.
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit, bool isConstexpr, SourceLocation EndLocation)
QualType getReturnType() const
bool SubstQualifier(const DeclaratorDecl *OldDecl, DeclaratorDecl *NewDecl)
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
static void instantiateDependentAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignedAttr *Aligned, Decl *New, bool IsPackExpansion)
const T * getAs() const
Member-template getAs<specific type>'.
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
Extra information about a function prototype.
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, unsigned ThisTypeQuals)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
Declaration context for names declared as extern "C" in C++.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
Represents a variable template specialization, which refers to a variable template with a given set o...
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static void instantiateDependentCUDALaunchBoundsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const CUDALaunchBoundsAttr &Attr, Decl *New)
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
static void instantiateDependentAssumeAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AssumeAlignedAttr *Aligned, Decl *New)
Look up an ordinary name that is going to be redeclared as a name with linkage.
Represents a parameter to a function.
static AccessSpecDecl * Create(ASTContext &C, AccessSpecifier AS, DeclContext *DC, SourceLocation ASLoc, SourceLocation ColonLoc)
Defines the clang::Expr interface and subclasses for C++ expressions.
Provides information about a dependent function-template specialization declaration.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
const FunctionDecl * isLocalClass() const
If the class is a local class [class.local], returns the enclosing function declaration.
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation >> ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr *> Uniforms, ArrayRef< Expr *> Aligneds, ArrayRef< Expr *> Alignments, ArrayRef< Expr *> Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr *> Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isLexicallyWithinFunctionOrMethod() const
Returns true if this declaration lexically is inside a function.
Base wrapper for a particular "section" of type source info.
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
Represents a struct/union/class.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
unsigned getDepth() const
Retrieve the depth of the template parameter.
StringLiteral * getMessage()
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
void setManglingNumber(const NamedDecl *ND, unsigned Number)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
ArrayRef< QualType > getParamTypes() const
The results of name lookup within a DeclContext.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
void AddModeAttr(SourceRange AttrRange, Decl *D, IdentifierInfo *Name, unsigned SpellingListIndex, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
void setObjCForDecl(bool FRD)
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl *> Bindings)
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Represents a member of a struct/union/class.
The current expression is potentially evaluated at run time, which means that code may be generated t...
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
unsigned getStaticLocalNumber(const VarDecl *VD) const
Decl * VisitVarTemplateSpecializationDecl(VarTemplateDecl *VarTemplate, VarDecl *FromVar, void *InsertPos, const TemplateArgumentListInfo &TemplateArgsInfo, ArrayRef< TemplateArgument > Converted)
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
void startDefinition()
Starts the definition of this tag declaration.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
bool isReferenceType() const
InitKind getInitializerKind() const
Get initializer kind.
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
bool isInIdentifierNamespace(unsigned NS) const
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
ParmVarDecl * getParam(unsigned i) const
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, bool IsExplicit, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation)
void Exit()
Exit this local instantiation scope early.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
Represents an access specifier followed by colon ':'.
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
Declaration of a function specialization at template class scope.
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
ArrayRef< ParmVarDecl * > parameters() const
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
SourceLocation getLAngleLoc() const
Represents a C++ using-declaration.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE, unsigned SpellingListIndex)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
ArrayRef< BindingDecl * > bindings() const
static void instantiateDependentDiagnoseIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const DiagnoseIfAttr *DIA, const Decl *Tmpl, FunctionDecl *New)
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Represents the results of name lookup.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
TagKind getTagKind() const
bool isReferenced() const
Whether any declaration of this entity was referenced.
A convenient class for passing around template argument information.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
Look up all declarations in a scope with the given name, including resolved using declarations...
bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
ArrayRef< NamedDecl * > chain() const
bool InitFunctionInstantiation(FunctionDecl *New, FunctionDecl *Tmpl)
Initializes the common fields of an instantiation function declaration (New) from the corresponding f...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
const TemplateArgumentLoc * getArgumentArray() const
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void setSpecializationKind(TemplateSpecializationKind TSK)
Scope - A scope is a transient data structure that is used while parsing the program.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
Represents a C++ nested-name-specifier or a global scope specifier.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
const LangOptions & getLangOpts() const
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
TemplateArgumentLoc getArgLoc(unsigned i) const
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
SourceLocation getTypeSpecStartLoc() const
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
unsigned getNumArgs() const
A binding in a decomposition declaration.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
RAII object used to change the argument pack substitution index within a Sema object.
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
A helper class for building up ExtParameterInfos.
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
SourceLocation getRParenLoc() const
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
DiagnosticsEngine & getDiagnostics() const
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false)
BuildVariableInstantiation - Used after a new variable has been created.
void MakeInstantiatedLocalArgPack(const Decl *D)
Sema - This implements semantic analysis and AST building for C.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
Represents a prototype with parameter type info, e.g.
bool isUsableInConstantExpressions(ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
bool inferObjCARCLifetime(ValueDecl *decl)
Represents a ValueDecl that came out of a declarator.
DeclarationNameTable DeclarationNames
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind NewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
static QualType adjustFunctionTypeForInstantiation(ASTContext &Context, FunctionDecl *D, TypeSourceInfo *TInfo)
Adjust the given function type for an instantiation of the given declaration, to cope with modificati...
unsigned getNumSubstitutedLevels() const
Determine the number of substituted levels in this template argument list.
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
FunctionDecl * getClassScopeSpecializationPattern() const
Retrieve the class scope template pattern that this function template specialization is instantiated ...
bool isInlineSpecified() const
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
TypeSourceInfo * getTypeSourceInfo() const
void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared)
const ArgList & getInnermost() const
Retrieve the innermost template argument list.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Expr - This represents one expression.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
void setCompleteDefinition()
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
unsigned getChainingSize() const
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
bool isDefaulted() const
Whether this function is defaulted per C++0x.
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Declaration of a template type parameter.
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr *> VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
ClassTemplatePartialSpecializationDecl * InstantiateClassTemplatePartialSpecialization(ClassTemplateDecl *ClassTemplate, ClassTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a class template partial specialization.
DeclarationNameInfo getNameInfo() const
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
void setHideTags(bool Hide)
Sets whether tag declarations should be hidden by non-tag declarations during resolution.
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name...
const T * castAs() const
Member-template castAs<specific type>.
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
static DeclT * getPreviousDeclForInstantiation(DeclT *D)
Get the previous declaration of a declaration for the purposes of template instantiation.
Represents a C++ destructor within a class.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
bool isLocalExternDecl()
Determine whether this is a block-scope declaration with linkage.
bool isFileContext() const
TemplateParameterList * getTemplateParameterList(unsigned index) const
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, Optional< unsigned > NumExpansions, bool ExpectParameterPack)
DeclContext * getDeclContext()
void CheckAlignasUnderalignment(Decl *D)
CXXRecordDecl * getDefinition() const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
SourceLocation getEllipsisLoc() const
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given function template specialization.
EnumDecl * getDefinition() const
static void InstantiateDefaultCtorDefaultArgs(Sema &S, CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
Defines the clang::TypeLoc interface and its subclasses.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
void DiscardCleanupsInEvaluationContext()
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
void setConstexpr(bool IC)
FieldDecl * CheckFieldDecl(DeclarationName Name, QualType T, TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, InClassInitStyle InitStyle, SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D=nullptr)
Build a new FieldDecl and check its well-formedness.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
bool isFunctionOrMethod() const
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
StorageClass
Storage classes.
IdentifierInfo * getSetterId() const
Declaration of an alias template.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Data structure that captures multiple levels of template argument lists for use in template instantia...
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
QualType getRecordType(const RecordDecl *Decl) const
SourceLocation getEnd() const
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
void setLocation(SourceLocation L)
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
Represents a C++ deduction guide declaration.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Represents a C++ conversion function within a class.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
static StringRef getIdentifier(const Token &Tok)
static void instantiateOMPDeclareSimdDeclAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareSimdDeclAttr &Attr, Decl *New)
Instantiation of 'declare simd' attribute and its arguments.
static void instantiateDependentModeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const ModeAttr &Attr, Decl *New)
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
TypeSourceInfo * SubstFunctionType(FunctionDecl *D, SmallVectorImpl< ParmVarDecl *> &Params)
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation. ...
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
Attr * instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
RecordDecl * getDecl() const
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
SourceLocation getLocStart() const LLVM_READONLY
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
TypeLoc getPatternLoc() const
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
ExceptionSpecificationType Type
The kind of exception specification this is.
TypeLoc IgnoreParens() const
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
A stack object to be created when performing template instantiation.
ExtProtoInfo getExtProtoInfo() const
Attr * instantiateTemplateAttributeForDecl(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, TemplateArgumentListInfo &Result, const MultiLevelTemplateArgumentList &TemplateArgs)
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
ASTContext & getASTContext() const
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, ArrayRef< TemplateParameterList *> FriendTypeTPLists=None)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
bool isParameterPack() const
Returns whether this is a parameter pack.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Encodes a location in the source.
QualType getReturnType() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
bool isPure() const
Whether this virtual function is pure, i.e.
void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
This represents '#pragma omp declare reduction ...' directive.
decl_iterator decls_begin() const
Pseudo declaration for capturing expressions.
static bool isInstantiationOfUnresolvedUsingDecl(T *Pattern, Decl *Other, ASTContext &Ctx)
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Attr * clone(ASTContext &C) const
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
unsigned getManglingNumber(const NamedDecl *ND) const
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
DeclarationName getName() const
getName - Returns the embedded declaration name.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
Represents the declaration of a struct/union/class/enum.
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
const TemplateArgumentListInfo & templateArgs() const
TemplateParameterList * SubstTemplateParams(TemplateParameterList *List)
Instantiates a nested template parameter list in the current instantiation context.
void setReferenced(bool R=true)
Represents the declaration of a label.
Represents a dependent using declaration which was not marked with typename.
Represents a static or instance method of a struct/union/class.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
static bool isInstantiationOf(ClassTemplateDecl *Pattern, ClassTemplateDecl *Instance)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
Decl * VisitDecl(Decl *D)
SourceLocation getIdentLocation() const
Returns the location of this using declaration's identifier.
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
const ParmVarDecl * getParamDecl(unsigned i) const
static void instantiateDependentAlignValueAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignValueAttr *Aligned, Decl *New)
SourceLocation getLocation() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
void setDeclName(DeclarationName N)
Set the name of this declaration.
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
const TemplateArgumentListInfo & getTemplateArgsInfo() const
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern)
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
SourceLocation getRAngleLoc() const
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
DeclarationNameInfo getNameInfo() const
Represents a C++11 static_assert declaration.
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
void setLAngleLoc(SourceLocation Loc)
SourceLocation getAccessSpecifierLoc() const
The location of the access specifier.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
void addArgument(const TemplateArgumentLoc &Loc)
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, Expr *AssociatedConstraints=nullptr)
Create a class template node.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isTemplateTypeParmType() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
void setVirtualAsWritten(bool V)
Represents a pack expansion of types.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
ddiag_range ddiags() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template...
Base class for declarations which introduce a typedef-name.
Represents a template argument.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
static bool isInvalid(LocType Loc, bool *Invalid)
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
bool isNull() const
Determine whether this template name is NULL.
static bool addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function, const FunctionDecl *PatternDecl, LocalInstantiationScope &Scope, const MultiLevelTemplateArgumentList &TemplateArgs)
Introduce the instantiated function parameters into the local instantiation scope, and set the parameter names to those used in the template.
Dataflow Directional Tag Classes.
void setImplicitlyInline()
Flag that this function is implicitly inline.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
ExtInfo getExtInfo() const
Decl * VisitFunctionDecl(FunctionDecl *D, TemplateParameterList *TemplateParams)
Normal class members are of more specific types and therefore don't make it here. ...
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
const TemplateArgument & getArgument() const
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
LocalInstantiationScope * cloneScopes(LocalInstantiationScope *Outermost)
Clone this scope, and all outer scopes, down to the given outermost scope.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool hasExplicitTemplateArgs() const
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
Represents a field injected from an anonymous union/struct into the parent scope. ...
QualType getUnderlyingType() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
CanQualType UnsignedLongLongTy
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
const Expr * getInit() const
AccessSpecifier getAccess() const
static NamedDecl * findInstantiationOf(ASTContext &Ctx, NamedDecl *D, ForwardIterator first, ForwardIterator last)
A decomposition declaration.
This template specialization was instantiated from a template due to an explicit instantiation declar...
unsigned getIndex() const
Retrieve the index of the template parameter.
Represents a dependent using declaration which was marked with typename.
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
DeclarationName - The name of a declaration.
void setInstantiationIsPending(bool IC)
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
SourceLocation getLocStart() const LLVM_READONLY
unsigned getNumTemplateParameterLists() const
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
void setInlineSpecified()
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void setPreviousDeclInSameBlockScope(bool Same)
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration...
void setInitCapture(bool IC)
void setLocalExternDecl()
Changes the namespace of this declaration to reflect that it's a function-local extern declaration...
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
void setImplicitlyInline()
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Location wrapper for a TemplateArgument.
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
Decl * Visit(PTR(Decl) D)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
This template specialization was declared or defined by an explicit specialization (C++ [temp...
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
isConstantInitializer - Returns true if this expression can be emitted to IR as a constant...
void setNonMemberOperator()
Specifies that this declaration is a C++ overloaded non-member.
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl *> Elements, Scope *S, const ParsedAttributesView &Attr)
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C...
bool isFunctionType() const
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
static bool SubstQualifier(Sema &SemaRef, const DeclT *OldDecl, DeclT *NewDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
TypeSourceInfo * getTypeSourceInfo() const
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
void setCXXForRangeDecl(bool FRD)
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
void addDecl(Decl *D)
Add the declaration D into this context.
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
The template argument is actually a parameter pack.
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool hasTypename() const
Return true if the using declaration has 'typename'.
void setInnerLocStart(SourceLocation L)
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
RedeclarationKind forRedeclarationInCurContext()
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
A template argument list.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
shadow_range shadows() const
QualType getParamType(unsigned i) const
Call-style initialization (C++98)
Represents a field declaration created by an @defs(...).
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
TypedefNameDecl * getTypedefNameForAnonDecl() const
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization)
Perform semantic checking of a new function declaration.
bool isMutable() const
Determines whether this field is mutable (C++ only).
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Represents a C++ struct/union/class.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
void setTSCSpec(ThreadStorageClassSpecifier TSC)
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
void setDescribedVarTemplate(VarTemplateDecl *Template)
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
void addHiddenDecl(Decl *D)
Add the declaration D to this context without modifying any lookup tables.
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Provides information a specialization of a member of a class template, which may be a member function...
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
void atTemplateEnd(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads, Expr *MinBlocks, unsigned SpellingListIndex)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration. ...
void setUnsupportedFriend(bool Unsupported)
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
Declaration of a class template.
CXXMethodDecl * getSpecialization() const
SourceManager & getSourceManager() const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
static bool isInstantiationOfStaticDataMember(VarDecl *Pattern, VarDecl *Instance)
void AddAllocAlignAttr(SourceRange AttrRange, Decl *D, Expr *ParamExpr, unsigned SpellingListIndex)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
VarTemplateDecl * getInstantiatedFromMemberTemplate() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
SourceLocation getLAngleLoc() const
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
static OpaquePtr make(QualType P)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
The top declaration context.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
bool isDeleted() const
Whether this function has been deleted.
SourceLocation getTemplateNameLoc() const
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, CopyElisionSemanticsKind CESK)
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
bool isStaticDataMember() const
Determines whether this is a static data member.
An instance of this class represents the declaration of a property member.
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExprUnevaluted - Return true if this expression might be usable in a constant expr...
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
bool empty() const
Return true if no decls were found.
A trivial tuple used to represent a source range.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
void setLexicalDeclContext(DeclContext *DC)
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
This represents a decl that may have a name.
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void setAccess(AccessSpecifier AS)
Represents a C++ namespace alias.
bool isInline() const
Whether this variable is (C++1z) inline.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Declaration of a friend template.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
SourceLocation getRAngleLoc() const
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl *> Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl *> *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
void setType(QualType newType)
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared, bool isConstexpr, InheritedConstructor Inherited=InheritedConstructor())
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
bool InitMethodInstantiation(CXXMethodDecl *New, CXXMethodDecl *Tmpl)
Initializes common fields of an instantiated method declaration (New) from the corresponding fields o...
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
void setDeletedAsWritten(bool D=true)
Decl * VisitCXXMethodDecl(CXXMethodDecl *D, TemplateParameterList *TemplateParams, bool IsClassScopeSpecialization=false)
This represents '#pragma omp threadprivate ...' directive.
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
ExceptionSpecInfo ExceptionSpec
Declaration of a template function.
void clear()
Clears out any current state.
bool hasLinkage() const
Determine whether this declaration has linkage.
Attr - This represents one attribute.
bool isDeletedAsWritten() const
SourceLocation getLocation() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
QualType getType() const
Return the type wrapped by this type source info.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
decl_iterator decls_end() const
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)