27 using namespace clang;
35 return cast<CXXRecordDecl>(DC)->isLocalClass();
40 template<
typename DeclT>
43 if (!OldDecl->getQualifierLoc())
46 assert((NewDecl->getFriendObjectKind() ||
47 !OldDecl->getLexicalDeclContext()->isDependentContext()) &&
48 "non-friend with qualified name defined in dependent context");
51 const_cast<DeclContext *>(NewDecl->getFriendObjectKind()
52 ? NewDecl->getLexicalDeclContext()
53 : OldDecl->getLexicalDeclContext()));
62 NewDecl->setQualifierInfo(NewQualifierLoc);
77 #include "clang/Sema/AttrTemplateInstantiate.inc" 81 const AlignedAttr *Aligned,
Decl *New,
bool IsPackExpansion) {
82 if (Aligned->isAlignmentExpr()) {
89 Aligned->getSpellingListIndex(), IsPackExpansion);
92 TemplateArgs, Aligned->getLocation(),
96 Aligned->getSpellingListIndex(), IsPackExpansion);
102 const AlignedAttr *Aligned,
Decl *New) {
103 if (!Aligned->isPackExpansion()) {
109 if (Aligned->isAlignmentExpr())
115 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
118 bool Expand =
true, RetainExpansion =
false;
123 Unexpanded, TemplateArgs, Expand,
124 RetainExpansion, NumExpansions))
131 for (
unsigned I = 0; I != *NumExpansions; ++I) {
140 const AssumeAlignedAttr *Aligned,
Decl *New) {
145 Expr *E, *OE =
nullptr;
151 if (Aligned->getOffset()) {
152 Result = S.
SubstExpr(Aligned->getOffset(), TemplateArgs);
159 Aligned->getSpellingListIndex());
164 const AlignValueAttr *Aligned,
Decl *New) {
171 Aligned->getSpellingListIndex());
176 const AllocAlignAttr *Align,
Decl *New) {
181 Align->getSpellingListIndex());
187 Expr *Cond =
nullptr;
201 Cond = Converted.
get();
207 S.
Diag(A->
getLocation(), diag::err_attr_cond_never_constant_expr) << A;
208 for (
const auto &
P : Diags)
209 S.
Diag(
P.first,
P.second);
219 S, TemplateArgs, EIA, EIA->getCond(), Tmpl, New);
223 EIA->getLocation(), S.
getASTContext(), Cond, EIA->getMessage(),
224 EIA->getSpellingListIndex()));
231 S, TemplateArgs, DIA, DIA->getCond(), Tmpl, New);
235 DIA->getLocation(), S.
getASTContext(), Cond, DIA->getMessage(),
236 DIA->getDiagnosticType(), DIA->getArgDependent(), New,
237 DIA->getSpellingListIndex()));
244 const CUDALaunchBoundsAttr &
Attr,
Decl *New) {
254 Expr *MinBlocks =
nullptr;
255 if (Attr.getMinBlocks()) {
256 Result = S.
SubstExpr(Attr.getMinBlocks(), TemplateArgs);
263 Attr.getSpellingListIndex());
270 S.
AddModeAttr(Attr.getRange(), New, Attr.getMode(),
271 Attr.getSpellingListIndex(),
true);
277 const OMPDeclareSimdDeclAttr &
Attr,
Decl *New) {
279 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
280 New = FTD->getTemplatedDecl();
281 auto *FD = cast<FunctionDecl>(New);
282 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
287 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
288 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
291 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
293 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
297 FD->isCXXInstanceMember());
302 if (
auto *E = Attr.getSimdlen())
305 if (Attr.uniforms_size() > 0) {
306 for(
auto *E : Attr.uniforms()) {
310 Uniforms.push_back(Inst.
get());
314 auto AI = Attr.alignments_begin();
315 for (
auto *E : Attr.aligneds()) {
319 Aligneds.push_back(Inst.
get());
323 Alignments.push_back(Inst.
get());
327 auto SI = Attr.steps_begin();
328 for (
auto *E : Attr.linears()) {
332 Linears.push_back(Inst.
get());
336 Steps.push_back(Inst.
get());
339 LinModifiers.append(Attr.modifiers_begin(), Attr.modifiers_end());
342 Uniforms, Aligneds, Alignments, Linears, LinModifiers, Steps,
358 if (
NamedDecl *ND = dyn_cast<NamedDecl>(New)) {
359 for (
const auto *TmplAttr : Tmpl->
attrs()) {
363 *
this, dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext()),
364 0, ND->isCXXInstanceMember());
367 TmplAttr, Context, *
this, TemplateArgs);
378 for (
const auto *TmplAttr : Tmpl->
attrs()) {
380 const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
381 if (Aligned && Aligned->isAlignmentDependent()) {
386 const AssumeAlignedAttr *AssumeAligned = dyn_cast<AssumeAlignedAttr>(TmplAttr);
392 const AlignValueAttr *AlignValue = dyn_cast<AlignValueAttr>(TmplAttr);
398 if (
const auto *AllocAlign = dyn_cast<AllocAlignAttr>(TmplAttr)) {
404 if (
const auto *EnableIf = dyn_cast<EnableIfAttr>(TmplAttr)) {
406 cast<FunctionDecl>(New));
410 if (
const auto *DiagnoseIf = dyn_cast<DiagnoseIfAttr>(TmplAttr)) {
412 cast<FunctionDecl>(New));
416 if (
const CUDALaunchBoundsAttr *CUDALaunchBounds =
417 dyn_cast<CUDALaunchBoundsAttr>(TmplAttr)) {
419 *CUDALaunchBounds, New);
423 if (
const ModeAttr *Mode = dyn_cast<ModeAttr>(TmplAttr)) {
428 if (
const auto *OMPAttr = dyn_cast<OMPDeclareSimdDeclAttr>(TmplAttr)) {
434 if (TmplAttr->getKind() == attr::DLLExport ||
435 TmplAttr->getKind() == attr::DLLImport) {
436 if (New->
hasAttr<DLLExportAttr>() || New->
hasAttr<DLLImportAttr>()) {
441 if (
auto ABIAttr = dyn_cast<ParameterABIAttr>(TmplAttr)) {
442 AddParameterABIAttr(ABIAttr->getRange(), New, ABIAttr->getABI(),
443 ABIAttr->getSpellingListIndex());
447 if (isa<NSConsumedAttr>(TmplAttr) || isa<CFConsumedAttr>(TmplAttr)) {
448 AddNSConsumedAttr(TmplAttr->getRange(), New,
449 TmplAttr->getSpellingListIndex(),
450 isa<NSConsumedAttr>(TmplAttr),
455 assert(!TmplAttr->isPackExpansion());
456 if (TmplAttr->isLateParsed() && LateAttrs) {
460 if (CurrentInstantiationScope)
461 Saved = CurrentInstantiationScope->
cloneScopes(OuterMostScope);
472 *
this, TemplateArgs);
484 template<
typename DeclT>
486 DeclT *
Result = D->getPreviousDecl();
491 if (Result && isa<CXXRecordDecl>(D->getDeclContext()) &&
492 D->getLexicalDeclContext() != Result->getLexicalDeclContext())
500 llvm_unreachable(
"Translation units cannot be instantiated");
505 llvm_unreachable(
"pragma comment cannot be instantiated");
508 Decl *TemplateDeclInstantiator::VisitPragmaDetectMismatchDecl(
510 llvm_unreachable(
"pragma comment cannot be instantiated");
515 llvm_unreachable(
"extern \"C\" context cannot be instantiated");
519 TemplateDeclInstantiator::VisitLabelDecl(
LabelDecl *D) {
527 TemplateDeclInstantiator::VisitNamespaceDecl(
NamespaceDecl *D) {
528 llvm_unreachable(
"Namespaces cannot be instantiated");
547 bool Invalid =
false;
591 TagDecl *oldTag = oldTagType->getDecl();
610 Typedef->setPreviousDecl(InstPrevTypedef);
648 if (getPreviousDeclForInstantiation<TypedefNameDecl>(Pattern)) {
650 if (!Found.
empty()) {
663 AliasInst->setDescribedAliasTemplate(Inst);
664 if (PrevAliasTemplate)
669 if (!PrevAliasTemplate)
689 NewBindings.push_back(cast<BindingDecl>(VisitBindingDecl(OldBD)));
692 auto *NewDD = cast_or_null<DecompositionDecl>(
695 if (!NewDD || NewDD->isInvalidDecl())
696 for (
auto *NewBD : NewBindings)
697 NewBD->setInvalidDecl();
707 bool InstantiatingVarTemplate,
718 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
748 StartingScope, InstantiatingVarTemplate);
751 QualType ReturnType = cast<FunctionDecl>(DC)->getReturnType();
753 Var->setNRVOVariable(
true);
769 Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
770 bool Invalid =
false;
786 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
803 = SemaRef.
SubstExpr(BitWidth, TemplateArgs);
808 BitWidth = InstantiatedBitWidth.
getAs<
Expr>();
813 cast<RecordDecl>(Owner),
822 cast<Decl>(Owner)->setInvalidDecl();
828 if (Field->hasAttrs())
832 Field->setInvalidDecl();
834 if (!Field->getDeclName()) {
839 if (
Parent->isAnonymousStructOrUnion() &&
840 Parent->getRedeclContext()->isFunctionOrMethod())
852 bool Invalid =
false;
856 SemaRef.
Diag(D->
getLocation(), diag::err_property_is_variably_modified)
872 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
901 for (
auto *PI : D->
chain()) {
907 NamedChain[i++] = Next;
910 QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
921 return IndirectField;
936 InstTy = SemaRef.
SubstType(Ty, TemplateArgs,
954 assert(ND &&
"friend decl must be a decl or a type!");
961 if (!NewND)
return nullptr;
980 = SemaRef.
SubstExpr(AssertExpr, TemplateArgs);
985 InstantiatedAssertExpr.
get(),
991 Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
997 if (!Prev)
return nullptr;
998 PrevDecl = cast<EnumDecl>(Prev);
1016 Enum->setIntegerTypeSourceInfo(NewTI);
1019 &&
"Dependent type without type source info");
1042 if (Def && Def != D) {
1049 SemaRef.
SubstType(TI->getType(), TemplateArgs,
1085 if (
Expr *UninstValue = EC->getInitExpr()) {
1090 Value = SemaRef.
SubstExpr(UninstValue, TemplateArgs);
1116 Enumerators.push_back(EnumConst);
1117 LastEnumConst = EnumConst;
1134 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
1139 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
1171 if (!Found.
empty()) {
1173 if (PrevClassTemplate)
1186 SS.
Adopt(QualifierLoc);
1188 if (!DC)
return nullptr;
1202 if (R.isSingleResult()) {
1204 if (PrevClassTemplate)
1208 if (!PrevClassTemplate && QualifierLoc) {
1215 bool AdoptedPreviousTemplateParams =
false;
1216 if (PrevClassTemplate) {
1217 bool Complain =
true;
1229 cast<NamespaceDecl>(DC)->
getIdentifier()->isStr(
"__detail")) {
1233 cast<NamespaceDecl>(DCParent)->
getIdentifier()->isStr(
"tr1")) {
1234 if (cast<Decl>(DCParent)->isInStdNamespace())
1249 AdoptedPreviousTemplateParams =
true;
1250 InstParams = PrevParams;
1255 if (!AdoptedPreviousTemplateParams &&
1280 if (PrevClassTemplate)
1290 if (!PrevClassTemplate)
1313 if (!PrevClassTemplate) {
1319 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1320 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1321 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[I]));
1328 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
1341 if (!InstClassTemplate)
1353 "Only static data member templates are allowed.");
1369 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
1375 if (!VarInst)
return nullptr;
1386 if (!PrevVarTemplate)
1396 if (!PrevVarTemplate) {
1402 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1403 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1404 OutOfLineVarPartialSpecs.push_back(
1405 std::make_pair(Inst, PartialSpecs[I]));
1411 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
1414 "Only static data member templates are allowed.");
1420 assert(!Found.
empty() &&
"Instantiation found nothing?");
1423 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
1426 InstVarTemplate->findPartialSpecInstantiatedFromMember(D))
1460 = Instantiated->getDescribedFunctionTemplate();
1462 assert(InstTemplate &&
1463 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
1481 return InstTemplate;
1487 PrevDecl = cast<CXXRecordDecl>(Owner);
1492 if (!Prev)
return nullptr;
1493 PrevDecl = cast<CXXRecordDecl>(Prev);
1517 Record->setObjectOfFriendDecl();
1521 Record->setAnonymousStructOrUnion(
true);
1553 if (!D->isCXXClassMember())
1559 LocalInstantiations.
perform();
1580 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
1586 NewFunc->getParamTypes(), NewEPI);
1599 if (FunctionTemplate && !TemplateParams) {
1602 void *InsertPos =
nullptr;
1612 if (FunctionTemplate)
1617 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1619 !(isa<Decl>(Owner) &&
1620 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1644 }
else if (isFriend && QualifierLoc) {
1646 SS.
Adopt(QualifierLoc);
1648 if (!DC)
return nullptr;
1658 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
1662 if (DGuide->isCopyDeductionCandidate())
1690 for (
unsigned P = 0;
P < Params.size(); ++
P)
1692 Params[
P]->setOwningFunction(Function);
1693 Function->setParams(Params);
1695 if (TemplateParams) {
1713 TemplateParams, Function);
1722 }
else if (FunctionTemplate) {
1725 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1739 bool isExplicitSpecialization =
false;
1750 assert(isFriend &&
"non-friend has dependent specialization info?");
1757 Info->getRAngleLoc());
1758 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
1759 ExplicitArgs, TemplateArgs))
1763 for (
unsigned I = 0, E = Info->getNumTemplates(); I != E; ++I) {
1765 Info->getTemplate(I),
1767 if (!Temp)
return nullptr;
1769 Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
1777 isExplicitSpecialization =
true;
1779 }
else if (TemplateParams || !FunctionTemplate) {
1797 isExplicitSpecialization);
1799 NamedDecl *PrincipalDecl = (TemplateParams
1800 ? cast<NamedDecl>(FunctionTemplate)
1809 bool QueuedInstantiation =
false;
1824 SemaRef.
Diag(Definition->
getLocation(), diag::note_previous_definition);
1828 else for (
auto R : Function->
redecls()) {
1834 if (!QueuedInstantiation && R->isUsed(
false)) {
1837 if (MSInfo->getPointOfInstantiation().isInvalid()) {
1839 MSInfo->setPointOfInstantiation(Loc);
1841 std::make_pair(Function, Loc));
1842 QueuedInstantiation =
true;
1849 if (R->getFriendObjectKind()) {
1852 if (RPattern->isDefined(RPattern)) {
1855 SemaRef.
Diag(R->getLocation(), diag::note_previous_definition);
1884 assert(!D->
isDefaulted() &&
"only methods should be defaulted");
1891 bool IsClassScopeSpecialization) {
1893 if (FunctionTemplate && !TemplateParams) {
1899 void *InsertPos =
nullptr;
1909 if (FunctionTemplate)
1914 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1915 !(isa<Decl>(Owner) &&
1916 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1921 unsigned NumTempParamLists = 0;
1923 TempParamLists.resize(NumTempParamLists);
1924 for (
unsigned I = 0; I != NumTempParamLists; ++I) {
1929 TempParamLists[I] = InstParams;
1951 SS.
Adopt(QualifierLoc);
1961 if (!DC)
return nullptr;
1973 StartLoc, NameInfo, T, TInfo,
1974 Constructor->isExplicit(),
1975 Constructor->isInlineSpecified(),
1976 false, Constructor->isConstexpr());
1980 StartLoc, NameInfo, T, TInfo,
1981 Destructor->isInlineSpecified(),
1986 StartLoc, NameInfo, T, TInfo,
1987 Conversion->isInlineSpecified(),
1988 Conversion->isExplicit(),
1989 Conversion->isConstexpr(),
1990 Conversion->getLocEnd());
1994 StartLoc, NameInfo, T, TInfo,
2003 Method->setQualifierInfo(QualifierLoc);
2005 if (TemplateParams) {
2021 Method->getDeclName(),
2022 TemplateParams, Method);
2028 Method->setDescribedFunctionTemplate(FunctionTemplate);
2029 }
else if (FunctionTemplate) {
2032 Method->setFunctionTemplateSpecialization(FunctionTemplate,
2036 }
else if (!isFriend) {
2045 if (NumTempParamLists)
2046 Method->setTemplateParameterListsInfo(
2048 llvm::makeArrayRef(TempParamLists.data(), NumTempParamLists));
2050 Method->setLexicalDeclContext(Owner);
2051 Method->setObjectOfFriendDecl();
2056 for (
unsigned P = 0;
P < Params.size(); ++
P)
2057 Params[
P]->setOwningFunction(Method);
2058 Method->setParams(Params);
2061 Method->setInvalidDecl();
2066 if (!FunctionTemplate || TemplateParams || isFriend) {
2077 if (!IsClassScopeSpecialization)
2086 if (isFriend && Method->getPreviousDecl())
2087 Method->setAccess(Method->getPreviousDecl()->getAccess());
2090 if (FunctionTemplate)
2091 FunctionTemplate->
setAccess(Method->getAccess());
2102 if (FunctionTemplate) {
2106 }
else if (Method->isInvalidDecl() && !Previous.
empty()) {
2110 }
else if (isFriend) {
2121 }
else if (!IsClassScopeSpecialization) {
2145 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
2160 if (InstantiatedDefaultArg)
2161 Inst->setDefaultArgument(InstantiatedDefaultArg);
2171 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
2177 bool IsExpandedParameterPack =
false;
2180 bool Invalid =
false;
2199 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2200 ExpandedParameterPackTypes.push_back(NewT);
2203 IsExpandedParameterPack =
true;
2218 bool RetainExpansion =
false;
2223 Pattern.getSourceRange(),
2226 Expand, RetainExpansion,
2231 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2244 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2245 ExpandedParameterPackTypes.push_back(NewT);
2251 IsExpandedParameterPack =
true;
2288 if (IsExpandedParameterPack)
2293 ExpandedParameterPackTypesAsWritten);
2302 Param->setInvalidDecl();
2309 Param->setDefaultArgument(Value.
get());
2322 for (
const auto &
P : *Params) {
2323 if (
P->isTemplateParameterPack())
2335 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
2342 bool IsExpandedParameterPack =
false;
2356 ExpandedParams.push_back(Expansion);
2359 IsExpandedParameterPack =
true;
2360 InstParams = TempParams;
2372 bool RetainExpansion =
false;
2378 Expand, RetainExpansion,
2383 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2389 ExpandedParams.push_back(Expansion);
2395 IsExpandedParameterPack =
true;
2396 InstParams = TempParams;
2418 if (IsExpandedParameterPack)
2437 Param->setDefaultArgument(
2472 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
2493 if (
auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.
CurContext))
2500 bool CheckRedeclaration = Owner->
isRecord();
2512 SS.
Adopt(QualifierLoc);
2513 if (CheckRedeclaration) {
2544 for (
auto *Shadow : D->
shadows()) {
2547 NamedDecl *OldTarget = Shadow->getTargetDecl();
2548 if (
auto *CUSD = dyn_cast<ConstructorUsingShadowDecl>(Shadow))
2549 if (
auto *BaseShadow = CUSD->getNominatedBaseClassShadowDecl())
2550 OldTarget = BaseShadow;
2554 Shadow->getLocation(), OldTarget, TemplateArgs));
2559 if (CheckRedeclaration) {
2565 Shadow->getLocation(), OldPrev, TemplateArgs));
2573 if (isFunctionScope)
2585 Decl *TemplateDeclInstantiator::VisitConstructorUsingShadowDecl(
2591 template <
typename T>
2592 Decl *TemplateDeclInstantiator::instantiateUnresolvedUsingDecl(
2593 T *D,
bool InstantiatingPackElement) {
2595 if (D->isPackExpansion() && !InstantiatingPackElement) {
2603 bool RetainExpansion =
false;
2606 D->getEllipsisLoc(), D->
getSourceRange(), Unexpanded, TemplateArgs,
2607 Expand, RetainExpansion, NumExpansions))
2612 assert(!RetainExpansion &&
2613 "should never need to retain an expansion for UsingPackDecl");
2619 return instantiateUnresolvedUsingDecl(D,
true);
2630 SemaRef.
Diag(D->getEllipsisLoc(),
2631 diag::err_using_decl_redeclaration_expansion);
2637 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2639 Decl *Slice = instantiateUnresolvedUsingDecl(D,
true);
2646 Expansions.push_back(cast<NamedDecl>(Slice));
2665 SS.
Adopt(QualifierLoc);
2672 bool InstantiatingSlice = D->getEllipsisLoc().isValid() &&
2678 nullptr, D->
getAccess(), D->getUsingLoc(),
2679 TD, TypenameLoc, SS, NameInfo, EllipsisLoc,
nullptr,
2687 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingTypenameDecl(
2689 return instantiateUnresolvedUsingDecl(D);
2692 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingValueDecl(
2694 return instantiateUnresolvedUsingDecl(D);
2702 Expansions.push_back(cast<NamedDecl>(NewUD));
2713 Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
2728 TemplateArgsPtr = &TemplateArgs;
2740 assert(Specialization &&
"Class scope Specialization is null");
2746 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
2751 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
2752 Vars.push_back(Var);
2764 Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
2771 if (SubstReductionType.
isNull())
2773 bool IsCorrect = !SubstReductionType.
isNull();
2775 std::pair<QualType, SourceLocation> ReductionTypes[] = {
2776 std::make_pair(SubstReductionType, D->
getLocation())};
2778 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
2779 PrevDeclInScope = cast<OMPDeclareReductionDecl>(
2786 auto *NewDRD = cast<OMPDeclareReductionDecl>(DRD.get().getSingleDecl());
2789 Expr *SubstCombiner =
nullptr;
2790 Expr *SubstInitializer =
nullptr;
2795 const char *Names[] = {
"omp_in",
"omp_out"};
2796 for (
auto &Name : Names) {
2798 auto OldLookup = D->
lookup(DN);
2799 auto Lookup = NewDRD->lookup(DN);
2800 if (!OldLookup.empty() && !Lookup.empty()) {
2801 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2813 const char *Names[] = {
"omp_orig",
"omp_priv"};
2814 for (
auto &Name : Names) {
2816 auto OldLookup = D->
lookup(DN);
2817 auto Lookup = NewDRD->lookup(DN);
2818 if (!OldLookup.empty() && !Lookup.empty()) {
2819 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2820 auto *OldVD = cast<VarDecl>(OldLookup.front());
2821 auto *NewVD = cast<VarDecl>(Lookup.front());
2830 IsCorrect = IsCorrect && OmpPrivParm->
hasInit();
2833 NewDRD, SubstInitializer, OmpPrivParm);
2836 IsCorrect && SubstCombiner &&
2839 SubstInitializer) ||
2841 !SubstInitializer && !SubstInitializer));
2851 Decl *TemplateDeclInstantiator::VisitOMPCapturedExprDecl(
2853 llvm_unreachable(
"Should not be met in templates");
2869 Decl *TemplateDeclInstantiator::VisitRecordDecl(
RecordDecl *D) {
2870 llvm_unreachable(
"There are only CXXRecordDecls in C++");
2874 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
2881 "can only instantiate an explicit specialization " 2882 "for a member class template");
2892 if (!InstClassTemplate)
2898 castAs<TemplateSpecializationTypeLoc>();
2902 for (
unsigned I = 0; I != Loc.
getNumArgs(); ++I)
2904 if (SemaRef.
Subst(ArgLocs.data(), ArgLocs.size(),
2905 InstTemplateArgs, TemplateArgs))
2920 void *InsertPos =
nullptr;
2952 diag::note_previous_definition);
3019 assert(VarTemplate &&
3020 "A template specialization without specialized template?");
3028 TemplateArgsInfo.
size(), VarTemplateArgsInfo, TemplateArgs))
3041 void *InsertPos =
nullptr;
3043 Converted, InsertPos))
3048 VarTemplateArgsInfo, Converted);
3064 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
3082 Owner, StartingScope);
3088 llvm_unreachable(
"@defs is not supported in Objective-C++");
3095 "cannot instantiate %0 yet");
3103 llvm_unreachable(
"Unexpected decl");
3112 return Instantiator.
Visit(D);
3124 bool Invalid =
false;
3126 unsigned N = L->
size();
3130 for (
auto &
P : *L) {
3132 Params.push_back(D);
3141 Expr *
const UninstantiatedRequiresClause = L->getRequiresClause();
3145 L->getLAngleLoc(), Params,
3147 UninstantiatedRequiresClause);
3186 InstTemplateArgs, TemplateArgs))
3207 void *InsertPos =
nullptr;
3247 SemaRef.
Diag(PartialSpec->
getLocation(), diag::err_partial_spec_redeclared)
3249 SemaRef.
Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
3280 ClassTemplate->AddPartialSpecialization(InstPartialSpec,
3282 return InstPartialSpec;
3320 InstTemplateArgs, TemplateArgs))
3327 InstTemplateArgs,
false, Converted))
3338 void *InsertPos =
nullptr;
3375 diag::err_var_partial_spec_redeclared)
3378 diag::note_var_prev_partial_spec_here);
3391 diag::err_variable_instantiates_to_function)
3415 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
3418 LateAttrs, Owner, StartingScope);
3420 return InstPartialSpec;
3427 assert(OldTInfo &&
"substituting function without type source info");
3428 assert(Params.empty() &&
"parameter vector is non-empty at start");
3431 unsigned ThisTypeQuals = 0;
3433 ThisContext = cast<CXXRecordDecl>(Owner);
3434 ThisTypeQuals = Method->getTypeQualifiers();
3441 ThisContext, ThisTypeQuals);
3447 if (NewTInfo != OldTInfo) {
3451 unsigned NewIdx = 0;
3452 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
3453 OldIdx != NumOldParams; ++OldIdx) {
3454 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
3459 NumArgumentsInExpansion =
3462 if (!NumArgumentsInExpansion) {
3466 Params.push_back(NewParam);
3471 for (
unsigned I = 0; I != *NumArgumentsInExpansion; ++I) {
3473 Params.push_back(NewParam);
3483 cast<FunctionProtoType>(OldProtoLoc.getType());
3484 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
3494 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
3497 Params.push_back(Parm);
3514 TemplateArgs, ParamTypes, &Params,
3529 unsigned FParamIdx = 0;
3530 for (
unsigned I = 0, N = PatternDecl->
getNumParams(); I != N; ++I) {
3534 assert(FParamIdx < Function->getNumParams());
3561 assert(NumArgumentsInExpansion &&
3562 "should only be called when all template arguments are known");
3565 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
3597 UpdateExceptionSpec(Decl,
EST_None);
3603 Diag(PointOfInstantiation, diag::err_exception_spec_cycle) << Decl;
3604 UpdateExceptionSpec(Decl,
EST_None);
3614 getTemplateInstantiationArgs(Decl,
nullptr,
true);
3619 UpdateExceptionSpec(Decl,
EST_None);
3653 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
3654 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
3656 = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
3657 assert(FunTmpl->getTemplatedDecl() == Tmpl &&
3658 "Deduction from the wrong function template?");
3660 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
3661 ActiveInst.Entity = New;
3666 assert(Proto &&
"Function template without prototype?");
3690 assert(NewProto &&
"Template instantiation without function prototype?");
3708 LateAttrs, StartingScope);
3745 *
this, Loc, FTD, Args->
asArray(),
3746 CodeSynthesisContext::ExplicitTemplateArgumentSubstitution, Info);
3747 if (Inst.isInvalid())
3753 return cast_or_null<FunctionDecl>(SubstDecl(FD, FD->
getParent(), MArgs));
3767 DLLExportAttr *
Attr = Ctor->
getAttr<DLLExportAttr>();
3770 for (
unsigned I = 0; I != NumParams; ++I) {
3797 bool DefinitionRequired,
3800 isa<CXXDeductionGuideDecl>(Function))
3812 assert(PatternDecl &&
"instantiating a non-template");
3815 Stmt *Pattern =
nullptr;
3817 Pattern = PatternDef->
getBody(PatternDef);
3818 PatternDecl = PatternDef;
3820 PatternDef =
nullptr;
3825 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Function,
3827 PatternDecl, PatternDef, TSK,
3828 DefinitionRequired)) {
3829 if (DefinitionRequired)
3836 PendingInstantiations.push_back(
3837 std::make_pair(Function, PointOfInstantiation));
3839 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
3840 !getSourceManager().isInSystemHeader(PatternDecl->
getLocStart())) {
3841 Diag(PointOfInstantiation, diag::warn_func_template_missing)
3844 if (getLangOpts().CPlusPlus11)
3845 Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
3855 !LateTemplateParser) {
3857 PendingInstantiations.push_back(
3858 std::make_pair(Function, PointOfInstantiation));
3874 LateTemplateParser) {
3877 ExternalSource->ReadLateParsedTemplates(LateParsedTemplateMap);
3879 auto LPTIter = LateParsedTemplateMap.find(PatternDecl);
3880 assert(LPTIter != LateParsedTemplateMap.end() &&
3881 "missing LateParsedTemplate");
3882 LateTemplateParser(OpaqueParser, *LPTIter->second);
3883 Pattern = PatternDecl->
getBody(PatternDecl);
3889 "unexpected kind of function template definition");
3906 D->setImplicitlyInline();
3916 "instantiating function definition");
3932 bool MergeWithParentScope =
false;
3934 MergeWithParentScope = Rec->isLocalClass();
3939 SetDeclDefaulted(Function, PatternDecl->
getLocation());
3942 getTemplateInstantiationArgs(Function,
nullptr,
false, PatternDecl);
3950 ActOnStartOfFunctionDef(
nullptr, Function);
3961 ActOnSkippedFunctionBody(Function);
3965 InstantiateMemInitializers(Ctor, cast<CXXConstructorDecl>(PatternDecl),
3971 Ctor->isDefaultConstructor()) {
3977 StmtResult Body = SubstStmt(Pattern, TemplateArgs);
3984 ActOnFinishFunctionBody(Function, Body.
get(),
3988 PerformDependentDiagnostics(PatternDecl, TemplateArgs);
3990 if (
auto *Listener = getASTMutationListener())
3991 Listener->FunctionDefinitionInstantiated(Function);
3997 Consumer.HandleTopLevelDecl(DG);
4001 LocalInstantiations.
perform();
4003 GlobalInstantiations.
perform();
4033 bool IsMemberSpec =
false;
4035 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar))
4036 IsMemberSpec = PartialSpec->isMemberSpecialization();
4038 IsMemberSpec = FromTemplate->isMemberSpecialization();
4048 return cast_or_null<VarTemplateSpecializationDecl>(
4049 Instantiator.VisitVarTemplateSpecializationDecl(
4050 VarTemplate, FromVar, InsertPos, TemplateArgsInfo, Converted));
4059 "don't have a definition to instantiate from");
4069 VarSpec->
setType(DI->getType());
4075 InstantiateVariableInitializer(VarSpec, PatternDecl, TemplateArgs);
4088 bool InstantiatingVarTemplate) {
4110 if (OldVar->
isUsed(
false))
4115 InstantiateAttrs(TemplateArgs, OldVar, NewVar, LateAttrs, StartingScope);
4122 : forRedeclarationInCurContext());
4129 if (
NamedDecl *NewPrev = FindInstantiatedDecl(
4132 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
4135 CheckVariableDeclaration(NewVar,
Previous);
4137 if (!InstantiatingVarTemplate) {
4145 CurrentInstantiationScope->InstantiatedLocal(OldVar, NewVar);
4161 if ((!isa<VarTemplateSpecializationDecl>(NewVar) &&
4162 !InstantiatingVarTemplate &&
4166 InstantiateVariableInitializer(NewVar, OldVar, TemplateArgs);
4173 DiagnoseUnusedDecl(NewVar);
4181 L->VariableDefinitionInstantiated(Var);
4200 Init = SubstInitializer(OldVar->
getInit(), TemplateArgs,
4207 if (Var->
hasAttr<DLLImportAttr>() &&
4211 }
else if (InitExpr) {
4213 AddInitializerToDecl(Var, InitExpr, DirectInit);
4215 ActOnUninitializedDecl(Var);
4236 ActOnUninitializedDecl(Var);
4257 bool DefinitionRequired,
bool AtEndOfTU) {
4263 VarDecl *PatternDecl =
nullptr, *Def =
nullptr;
4265 getTemplateInstantiationArgs(Var);
4270 bool InstantiationDependent =
false;
4273 "Only instantiate variable template specializations that are " 4274 "not type-dependent");
4275 (void)InstantiationDependent;
4281 "Specialization without specialized template?");
4297 VarTemplateDecl *Tmpl = PatternPtr.get<VarTemplateDecl *>();
4298 while (VarTemplateDecl *From =
4316 if (PatternDecl->isStaticDataMember() &&
4317 (PatternDecl = PatternDecl->getFirstDecl())->hasInit() &&
4325 "instantiating variable initializer");
4342 InstantiateVariableInitializer(Var, PatternDecl, TemplateArgs);
4343 PreviousContext.pop();
4347 LocalInstantiations.
perform();
4349 GlobalInstantiations.
perform();
4353 Def = PatternDecl->getDefinition(getASTContext());
4359 assert(PatternDecl &&
"data member was not instantiated from a template?");
4360 assert(PatternDecl->isStaticDataMember() &&
"not a static data member?");
4361 Def = PatternDecl->getDefinition();
4370 if (!Def && !DefinitionRequired) {
4372 PendingInstantiations.push_back(
4373 std::make_pair(Var, PointOfInstantiation));
4376 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
4377 !getSourceManager().isInSystemHeader(PatternDecl->getLocStart())) {
4378 Diag(PointOfInstantiation, diag::warn_var_template_missing)
4380 Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
4381 if (getLangOpts().CPlusPlus11)
4382 Diag(PointOfInstantiation, diag::note_inst_declaration_hint) << Var;
4392 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Var,
4394 PatternDecl, Def, TSK,
4395 DefinitionRequired))
4413 struct PassToConsumerRAII {
4418 : Consumer(Consumer), Var(Var) { }
4420 ~PassToConsumerRAII() {
4423 } PassToConsumerRAII(Consumer, Var);
4430 PointOfInstantiation);
4438 "instantiating variable definition");
4454 if (Def->isStaticDataMember() && !Def->isOutOfLine()) {
4457 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4458 }
else if (!VarSpec) {
4459 Var = cast_or_null<VarDecl>(SubstDecl(Def, Var->
getDeclContext(),
4468 Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
4477 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
4481 LookupResult R(*
this, Var->getDeclName(), Var->getLocation(),
4482 LookupOrdinaryName, forRedeclarationInCurContext());
4484 MergeVarDecl(Var, R);
4487 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4492 Var = CompleteVarTemplateSpecializationDecl(VarSpec, Def, TemplateArgs);
4494 PreviousContext.pop();
4497 PassToConsumerRAII.Var = Var;
4504 LocalInstantiations.
perform();
4506 GlobalInstantiations.
perform();
4518 for (
const auto *Init : Tmpl->
inits()) {
4521 if (!Init->isWritten())
4526 if (Init->isPackExpansion()) {
4528 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
4532 bool ShouldExpand =
false;
4533 bool RetainExpansion =
false;
4535 if (CheckParameterPacksForExpansion(Init->getEllipsisLoc(),
4538 TemplateArgs, ShouldExpand,
4545 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
4548 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4552 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4562 Init->getSourceLocation(),
4571 BaseTInfo, TempInit.
get(),
4579 NewInits.push_back(NewInit.
get());
4586 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4594 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
4597 Init->getSourceLocation(),
4605 if (Init->isBaseInitializer())
4606 NewInit = BuildBaseInitializer(TInfo->
getType(), TInfo, TempInit.
get(),
4609 NewInit = BuildDelegatingInitializer(TInfo, TempInit.
get(),
4610 cast<CXXRecordDecl>(CurContext->getParent()));
4611 }
else if (Init->isMemberInitializer()) {
4612 FieldDecl *Member = cast_or_null<FieldDecl>(FindInstantiatedDecl(
4613 Init->getMemberLocation(),
4622 NewInit = BuildMemberInitializer(Member, TempInit.
get(),
4623 Init->getSourceLocation());
4624 }
else if (Init->isIndirectMemberInitializer()) {
4626 cast_or_null<IndirectFieldDecl>(FindInstantiatedDecl(
4627 Init->getMemberLocation(),
4628 Init->getIndirectMember(), TemplateArgs));
4630 if (!IndirectMember) {
4636 NewInit = BuildMemberInitializer(IndirectMember, TempInit.
get(),
4637 Init->getSourceLocation());
4644 NewInits.push_back(NewInit.
get());
4649 ActOnMemInitializers(New,
4664 if (Pattern == Instance)
return true;
4677 if (Pattern == Instance)
return true;
4688 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
4690 Instance = cast<ClassTemplatePartialSpecializationDecl>(
4692 if (Pattern == Instance)
4706 if (Pattern == Instance)
return true;
4719 if (Pattern == Instance)
return true;
4732 if (Pattern == Instance)
return true;
4751 template<
typename T>
4760 bool OtherIsPackExpansion;
4762 if (
auto *OtherUUD = dyn_cast<T>(Other)) {
4763 OtherIsPackExpansion = OtherUUD->isPackExpansion();
4765 }
else if (
auto *OtherUPD = dyn_cast<UsingPackDecl>(Other)) {
4766 OtherIsPackExpansion =
true;
4767 OtherFrom = OtherUPD->getInstantiatedFromUsingDecl();
4768 }
else if (
auto *OtherUD = dyn_cast<UsingDecl>(Other)) {
4769 OtherIsPackExpansion =
false;
4774 return Pattern->isPackExpansion() == OtherIsPackExpansion &&
4786 if (Pattern == Instance)
return true;
4796 if (
auto *UUD = dyn_cast<UnresolvedUsingTypenameDecl>(D))
4799 if (
auto *UUD = dyn_cast<UnresolvedUsingValueDecl>(D))
4805 if (
auto *Record = dyn_cast<CXXRecordDecl>(Other))
4808 if (
auto *Function = dyn_cast<FunctionDecl>(Other))
4811 if (
auto *Enum = dyn_cast<EnumDecl>(Other))
4814 if (
auto *Var = dyn_cast<VarDecl>(Other))
4815 if (Var->isStaticDataMember())
4818 if (
auto *Temp = dyn_cast<ClassTemplateDecl>(Other))
4821 if (
auto *Temp = dyn_cast<FunctionTemplateDecl>(Other))
4824 if (
auto *PartialSpec =
4825 dyn_cast<ClassTemplatePartialSpecializationDecl>(Other))
4829 if (
auto *Field = dyn_cast<FieldDecl>(Other)) {
4830 if (!Field->getDeclName()) {
4833 cast<FieldDecl>(D));
4837 if (
auto *Using = dyn_cast<UsingDecl>(Other))
4840 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(Other))
4844 D->
getDeclName() == cast<NamedDecl>(Other)->getDeclName();
4847 template<
typename ForwardIterator>
4850 ForwardIterator first,
4851 ForwardIterator last) {
4852 for (; first != last; ++first)
4854 return cast<NamedDecl>(*first);
4865 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
4866 Decl*
ID = FindInstantiatedDecl(Loc, D, TemplateArgs,
true);
4867 return cast_or_null<DeclContext>(
ID);
4899 bool FindingInstantiatedContext) {
4918 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
4920 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
4921 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
4923 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda())) {
4926 if (CurrentInstantiationScope) {
4927 if (
auto Found = CurrentInstantiationScope->findInstantiationOf(D)) {
4928 if (Decl *FD = Found->dyn_cast<Decl *>())
4929 return cast<NamedDecl>(FD);
4931 int PackIdx = ArgumentPackSubstitutionIndex;
4932 assert(PackIdx != -1 &&
4933 "found declaration pack but not pack expanding");
4935 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
4942 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
4943 isa<TemplateTemplateParmDecl>(D))
4962 bool NeedInstantiate =
false;
4964 NeedInstantiate = RD->isLocalClass();
4966 NeedInstantiate = isa<EnumDecl>(D);
4967 if (NeedInstantiate) {
4968 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4969 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4970 return cast<TypeDecl>(Inst);
4975 assert(isa<LabelDecl>(D));
4977 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4978 assert(Inst &&
"Failed to instantiate label??");
4980 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4981 return cast<LabelDecl>(Inst);
4987 dyn_cast<VarTemplateSpecializationDecl>(D)) {
4988 bool InstantiationDependent =
false;
4990 VarSpec->getTemplateArgsInfo();
4992 VarTemplateArgs, InstantiationDependent))
4993 D = cast<NamedDecl>(
4999 if (!Record->isDependentContext())
5008 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Record))
5020 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
5024 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
5037 if (FD->getFriendObjectKind() && FD->getDeclContext()->isFileContext()){
5038 DC = FD->getLexicalDeclContext();
5044 if (Guide && Guide->isImplicit()) {
5052 Unpacked = Arg.pack_elements();
5055 getTrivialTemplateArgumentLoc(UnpackedArg,
QualType(), Loc));
5061 assert(SubstRecord &&
"class template id not a class type?");
5067 if (FindingInstantiatedContext &&
5068 usesPartialOrExplicitSpecialization(
5069 Loc, cast<ClassTemplateSpecializationDecl>(SubstRecord))) {
5070 Diag(Loc, diag::err_specialization_not_primary_template)
5071 << T << (SubstRecord->getTemplateSpecializationKind() ==
5090 ParentDC = FindInstantiatedContext(Loc, ParentDC, TemplateArgs);
5101 bool IsBeingInstantiated =
false;
5102 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
5103 if (!Spec->isDependentContext()) {
5106 assert(Tag &&
"type of non-dependent record is not a RecordType");
5108 IsBeingInstantiated =
true;
5110 RequireCompleteType(Loc, T, diag::err_incomplete_type))
5122 Name = SubstDeclarationNameInfo(NameInfo, TemplateArgs).getName();
5142 if (isa<UsingShadowDecl>(D)) {
5144 }
else if (Diags.hasErrorOccurred()) {
5148 }
else if (IsBeingInstantiated) {
5154 Diag(Loc, diag::err_member_not_yet_instantiated)
5162 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
5163 EnumDecl *Spec = cast<EnumDecl>(FindInstantiatedDecl(Loc, Enum,
5165 assert(Spec->getTemplateSpecializationKind() ==
5167 Diag(Loc, diag::err_enumerator_does_not_exist)
5170 Diag(Spec->getLocation(), diag::note_enum_specialized_here)
5174 llvm_unreachable(
"Unable to find instantiation of declaration!");
5187 while (!PendingLocalImplicitInstantiations.empty() ||
5188 (!LocalOnly && !PendingInstantiations.empty())) {
5191 if (PendingLocalImplicitInstantiations.empty()) {
5192 Inst = PendingInstantiations.front();
5193 PendingInstantiations.pop_front();
5195 Inst = PendingLocalImplicitInstantiations.front();
5196 PendingLocalImplicitInstantiations.pop_front();
5200 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
5201 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
5203 InstantiateFunctionDefinition(Inst.second, Function,
true,
5204 DefinitionRequired,
true);
5205 if (Function->isDefined())
5206 Function->setInstantiationIsPending(
false);
5211 VarDecl *Var = cast<VarDecl>(Inst.first);
5214 isa<VarTemplateSpecializationDecl>(Var)) &&
5215 "Not a static data member, nor a variable template" 5216 " specialization?");
5227 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
5242 "instantiating variable definition");
5248 InstantiateVariableDefinition( Inst.second, Var,
true,
5249 DefinitionRequired,
true);
5255 for (
auto DD : Pattern->
ddiags()) {
5256 switch (DD->getKind()) {
5258 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)
An instance of this class is created to represent 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
isOverloadedOperator - Whether this function declaration represents an C++ overloaded 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)
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...
EnumConstantDecl - 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)
TypedefDecl - 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.
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.
NamespaceDecl - 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 is defined at all, including a deleted definition.
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
isCompleteDefinition - 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.
VarDecl - An instance of this class is created to represent 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.
ParmVarDecl - 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
getIdentifier - 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.
RecordDecl - 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
getDeclName - 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.
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.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
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.
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl *> Elements, Scope *S, AttributeList *Attr)
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
isAnonymousStructOrUnion - 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.
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x 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.
const FunctionProtoType * T
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.
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, bool AllowParamOrMoveConstructible)
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
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.
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)
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, AttributeList *AttrList, bool IsInstantiation)
Builds a using declaration.
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.
bool duplicatesAllowed() const
By default, attributes cannot be duplicated when being merged; however, an attribute can override thi...
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.
TagDecl - 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)
LabelDecl - 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.
static bool DeclContainsAttr(const Decl *D, const Attr *NewAttr)
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.
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool EnumUnderlyingIsImplicit, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
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
EnumDecl - Represents an enum.
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)
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
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
isMutable - Determines whether this field is mutable (C++ only).
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the ty...
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...
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
getIntegerType - 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.
TranslationUnitDecl - 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
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...
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.
NamedDecl - This represents a decl with 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.
attr::Kind getKind() const
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
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
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)