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)) {
443 ABIAttr->getSpellingListIndex());
447 if (isa<NSConsumedAttr>(TmplAttr) || isa<CFConsumedAttr>(TmplAttr)) {
449 TmplAttr->getSpellingListIndex(),
450 isa<NSConsumedAttr>(TmplAttr),
455 assert(!TmplAttr->isPackExpansion());
456 if (TmplAttr->isLateParsed() && LateAttrs) {
472 *
this, TemplateArgs);
484 template<
typename DeclT>
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()) {
664 if (PrevAliasTemplate)
669 if (!PrevAliasTemplate)
688 NewBindings.push_back(cast<BindingDecl>(VisitBindingDecl(OldBD)));
691 auto *NewDD = cast_or_null<DecompositionDecl>(
694 if (!NewDD || NewDD->isInvalidDecl())
695 for (
auto *NewBD : NewBindings)
696 NewBD->setInvalidDecl();
706 bool InstantiatingVarTemplate,
717 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
747 StartingScope, InstantiatingVarTemplate);
750 QualType ReturnType = cast<FunctionDecl>(DC)->getReturnType();
752 Var->setNRVOVariable(
true);
768 Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
785 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
802 = SemaRef.
SubstExpr(BitWidth, TemplateArgs);
807 BitWidth = InstantiatedBitWidth.
getAs<
Expr>();
812 cast<RecordDecl>(Owner),
821 cast<Decl>(Owner)->setInvalidDecl();
838 if (Parent->isAnonymousStructOrUnion() &&
839 Parent->getRedeclContext()->isFunctionOrMethod())
851 bool Invalid =
false;
855 SemaRef.
Diag(D->
getLocation(), diag::err_property_is_variably_modified)
871 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
900 for (
auto *PI : D->
chain()) {
906 NamedChain[i++] =
Next;
909 QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
920 return IndirectField;
935 InstTy = SemaRef.
SubstType(Ty, TemplateArgs,
953 assert(ND &&
"friend decl must be a decl or a type!");
960 if (!NewND)
return nullptr;
979 = SemaRef.
SubstExpr(AssertExpr, TemplateArgs);
984 InstantiatedAssertExpr.
get(),
990 Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
996 if (!Prev)
return nullptr;
997 PrevDecl = cast<EnumDecl>(Prev);
1018 &&
"Dependent type without type source info");
1041 if (Def && Def != D) {
1048 SemaRef.
SubstType(TI->getType(), TemplateArgs,
1084 if (
Expr *UninstValue = EC->getInitExpr()) {
1089 Value = SemaRef.
SubstExpr(UninstValue, TemplateArgs);
1115 Enumerators.push_back(EnumConst);
1116 LastEnumConst = EnumConst;
1133 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
1138 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
1170 if (!Found.
empty()) {
1172 if (PrevClassTemplate)
1185 SS.
Adopt(QualifierLoc);
1187 if (!DC)
return nullptr;
1200 if (R.isSingleResult()) {
1202 if (PrevClassTemplate)
1206 if (!PrevClassTemplate && QualifierLoc) {
1213 bool AdoptedPreviousTemplateParams =
false;
1214 if (PrevClassTemplate) {
1215 bool Complain =
true;
1227 cast<NamespaceDecl>(DC)->
getIdentifier()->isStr(
"__detail")) {
1231 cast<NamespaceDecl>(DCParent)->
getIdentifier()->isStr(
"tr1")) {
1232 if (cast<Decl>(DCParent)->isInStdNamespace())
1247 AdoptedPreviousTemplateParams =
true;
1248 InstParams = PrevParams;
1253 if (!AdoptedPreviousTemplateParams &&
1278 if (PrevClassTemplate)
1288 if (!PrevClassTemplate)
1311 if (!PrevClassTemplate) {
1317 for (
unsigned I = 0, N = PartialSpecs.size();
I != N; ++
I)
1318 if (PartialSpecs[
I]->getFirstDecl()->isOutOfLine())
1319 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[
I]));
1326 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
1339 if (!InstClassTemplate)
1351 "Only static data member templates are allowed.");
1367 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
1373 if (!VarInst)
return nullptr;
1384 if (!PrevVarTemplate)
1394 if (!PrevVarTemplate) {
1400 for (
unsigned I = 0, N = PartialSpecs.size();
I != N; ++
I)
1401 if (PartialSpecs[
I]->getFirstDecl()->isOutOfLine())
1402 OutOfLineVarPartialSpecs.push_back(
1403 std::make_pair(Inst, PartialSpecs[
I]));
1409 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
1412 "Only static data member templates are allowed.");
1418 assert(!Found.
empty() &&
"Instantiation found nothing?");
1421 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
1424 InstVarTemplate->findPartialSpecInstantiatedFromMember(D))
1458 = Instantiated->getDescribedFunctionTemplate();
1460 assert(InstTemplate &&
1461 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
1479 return InstTemplate;
1485 PrevDecl = cast<CXXRecordDecl>(Owner);
1490 if (!Prev)
return nullptr;
1491 PrevDecl = cast<CXXRecordDecl>(Prev);
1551 if (!D->isCXXClassMember())
1557 LocalInstantiations.perform();
1578 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
1584 NewFunc->getParamTypes(), NewEPI);
1596 if (FunctionTemplate && !TemplateParams) {
1599 void *InsertPos =
nullptr;
1609 if (FunctionTemplate)
1614 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1616 !(isa<Decl>(Owner) &&
1617 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1641 }
else if (isFriend && QualifierLoc) {
1643 SS.
Adopt(QualifierLoc);
1645 if (!DC)
return nullptr;
1652 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D))
1682 for (
unsigned P = 0;
P < Params.size(); ++
P)
1684 Params[
P]->setOwningFunction(Function);
1685 Function->setParams(Params);
1688 if (TemplateParams) {
1706 TemplateParams, Function);
1715 }
else if (FunctionTemplate) {
1718 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1726 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1732 bool isExplicitSpecialization =
false;
1742 assert(isFriend &&
"non-friend has dependent specialization info?");
1749 Info->getRAngleLoc());
1750 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
1751 ExplicitArgs, TemplateArgs))
1755 for (
unsigned I = 0,
E = Info->getNumTemplates();
I !=
E; ++
I) {
1757 Info->getTemplate(
I),
1759 if (!Temp)
return nullptr;
1761 Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
1769 isExplicitSpecialization =
true;
1771 }
else if (TemplateParams || !FunctionTemplate) {
1789 isExplicitSpecialization);
1791 NamedDecl *PrincipalDecl = (TemplateParams
1792 ? cast<NamedDecl>(FunctionTemplate)
1801 bool QueuedInstantiation =
false;
1816 SemaRef.
Diag(Definition->
getLocation(), diag::note_previous_definition);
1820 else for (
auto R : Function->
redecls()) {
1826 if (!QueuedInstantiation && R->isUsed(
false)) {
1829 if (MSInfo->getPointOfInstantiation().isInvalid()) {
1831 MSInfo->setPointOfInstantiation(Loc);
1833 std::make_pair(Function, Loc));
1834 QueuedInstantiation =
true;
1841 if (R->getFriendObjectKind()) {
1844 if (RPattern->isDefined(RPattern)) {
1847 SemaRef.
Diag(R->getLocation(), diag::note_previous_definition);
1876 assert(!D->
isDefaulted() &&
"only methods should be defaulted");
1883 bool IsClassScopeSpecialization) {
1885 if (FunctionTemplate && !TemplateParams) {
1891 void *InsertPos =
nullptr;
1901 if (FunctionTemplate)
1906 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1907 !(isa<Decl>(Owner) &&
1908 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1913 unsigned NumTempParamLists = 0;
1915 TempParamLists.resize(NumTempParamLists);
1916 for (
unsigned I = 0;
I != NumTempParamLists; ++
I) {
1921 TempParamLists[
I] = InstParams;
1943 SS.
Adopt(QualifierLoc);
1953 if (!DC)
return nullptr;
1965 StartLoc, NameInfo, T, TInfo,
1966 Constructor->isExplicit(),
1967 Constructor->isInlineSpecified(),
1968 false, Constructor->isConstexpr());
1972 StartLoc, NameInfo, T, TInfo,
1973 Destructor->isInlineSpecified(),
1978 StartLoc, NameInfo, T, TInfo,
1979 Conversion->isInlineSpecified(),
1980 Conversion->isExplicit(),
1981 Conversion->isConstexpr(),
1982 Conversion->getLocEnd());
1986 StartLoc, NameInfo, T, TInfo,
1995 Method->setQualifierInfo(QualifierLoc);
1997 if (TemplateParams) {
2013 Method->getDeclName(),
2014 TemplateParams, Method);
2020 Method->setDescribedFunctionTemplate(FunctionTemplate);
2021 }
else if (FunctionTemplate) {
2024 Method->setFunctionTemplateSpecialization(FunctionTemplate,
2028 }
else if (!isFriend) {
2030 Method->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
2037 if (NumTempParamLists)
2038 Method->setTemplateParameterListsInfo(
2040 llvm::makeArrayRef(TempParamLists.data(), NumTempParamLists));
2042 Method->setLexicalDeclContext(Owner);
2043 Method->setObjectOfFriendDecl();
2048 for (
unsigned P = 0;
P < Params.size(); ++
P)
2049 Params[
P]->setOwningFunction(Method);
2050 Method->setParams(Params);
2053 Method->setInvalidDecl();
2058 if (!FunctionTemplate || TemplateParams || isFriend) {
2069 if (!IsClassScopeSpecialization)
2078 if (isFriend && Method->getPreviousDecl())
2079 Method->setAccess(Method->getPreviousDecl()->getAccess());
2082 if (FunctionTemplate)
2083 FunctionTemplate->
setAccess(Method->getAccess());
2094 if (FunctionTemplate) {
2098 }
else if (Method->isInvalidDecl() && !Previous.
empty()) {
2102 }
else if (isFriend) {
2113 }
else if (!IsClassScopeSpecialization) {
2137 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
2152 if (InstantiatedDefaultArg)
2153 Inst->setDefaultArgument(InstantiatedDefaultArg);
2163 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
2169 bool IsExpandedParameterPack =
false;
2172 bool Invalid =
false;
2191 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2192 ExpandedParameterPackTypes.push_back(NewT);
2195 IsExpandedParameterPack =
true;
2210 bool RetainExpansion =
false;
2215 Pattern.getSourceRange(),
2218 Expand, RetainExpansion,
2223 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
2236 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2237 ExpandedParameterPackTypes.push_back(NewT);
2243 IsExpandedParameterPack =
true;
2280 if (IsExpandedParameterPack)
2283 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
2285 ExpandedParameterPackTypesAsWritten);
2289 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
2294 Param->setInvalidDecl();
2301 Param->setDefaultArgument(Value.
get());
2314 for (
const auto &
P : *Params) {
2315 if (
P->isTemplateParameterPack())
2327 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
2334 bool IsExpandedParameterPack =
false;
2348 ExpandedParams.push_back(Expansion);
2351 IsExpandedParameterPack =
true;
2352 InstParams = TempParams;
2364 bool RetainExpansion =
false;
2370 Expand, RetainExpansion,
2375 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
2381 ExpandedParams.push_back(Expansion);
2387 IsExpandedParameterPack =
true;
2388 InstParams = TempParams;
2410 if (IsExpandedParameterPack)
2413 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
2418 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
2429 Param->setDefaultArgument(
2464 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
2485 if (
auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.
CurContext))
2492 bool CheckRedeclaration = Owner->
isRecord();
2504 SS.
Adopt(QualifierLoc);
2505 if (CheckRedeclaration) {
2506 Prev.setHideTags(
false);
2536 for (
auto *Shadow : D->
shadows()) {
2539 NamedDecl *OldTarget = Shadow->getTargetDecl();
2540 if (
auto *CUSD = dyn_cast<ConstructorUsingShadowDecl>(Shadow))
2541 if (
auto *BaseShadow = CUSD->getNominatedBaseClassShadowDecl())
2542 OldTarget = BaseShadow;
2546 Shadow->getLocation(), OldTarget, TemplateArgs));
2551 if (CheckRedeclaration) {
2557 Shadow->getLocation(), OldPrev, TemplateArgs));
2565 if (isFunctionScope)
2577 Decl *TemplateDeclInstantiator::VisitConstructorUsingShadowDecl(
2583 template <
typename T>
2584 Decl *TemplateDeclInstantiator::instantiateUnresolvedUsingDecl(
2585 T *D,
bool InstantiatingPackElement) {
2587 if (D->isPackExpansion() && !InstantiatingPackElement) {
2595 bool RetainExpansion =
false;
2598 D->getEllipsisLoc(), D->getSourceRange(), Unexpanded, TemplateArgs,
2599 Expand, RetainExpansion, NumExpansions))
2604 assert(!RetainExpansion &&
2605 "should never need to retain an expansion for UsingPackDecl");
2611 return instantiateUnresolvedUsingDecl(D,
true);
2621 if (D->getDeclContext()->isFunctionOrMethod() && *NumExpansions > 1) {
2622 SemaRef.
Diag(D->getEllipsisLoc(),
2623 diag::err_using_decl_redeclaration_expansion);
2629 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
2631 Decl *Slice = instantiateUnresolvedUsingDecl(D,
true);
2638 Expansions.push_back(cast<NamedDecl>(Slice));
2657 SS.
Adopt(QualifierLoc);
2664 bool InstantiatingSlice = D->getEllipsisLoc().isValid() &&
2670 nullptr, D->getAccess(), D->getUsingLoc(),
2671 TD, TypenameLoc, SS, NameInfo, EllipsisLoc,
nullptr,
2679 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingTypenameDecl(
2681 return instantiateUnresolvedUsingDecl(D);
2684 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingValueDecl(
2686 return instantiateUnresolvedUsingDecl(D);
2694 Expansions.push_back(cast<NamedDecl>(NewUD));
2705 Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
2720 TemplateArgsPtr = &TemplateArgs;
2732 assert(Specialization &&
"Class scope Specialization is null");
2738 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
2743 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
2744 Vars.push_back(Var);
2756 Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
2763 if (SubstReductionType.
isNull())
2765 bool IsCorrect = !SubstReductionType.
isNull();
2767 std::pair<QualType, SourceLocation> ReductionTypes[] = {
2768 std::make_pair(SubstReductionType, D->
getLocation())};
2770 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
2771 PrevDeclInScope = cast<OMPDeclareReductionDecl>(
2778 auto *NewDRD = cast<OMPDeclareReductionDecl>(DRD.get().getSingleDecl());
2781 Expr *SubstCombiner =
nullptr;
2782 Expr *SubstInitializer =
nullptr;
2787 const char *
Names[] = {
"omp_in",
"omp_out"};
2788 for (
auto &
Name : Names) {
2790 auto OldLookup = D->
lookup(DN);
2791 auto Lookup = NewDRD->lookup(DN);
2792 if (!OldLookup.empty() && !Lookup.empty()) {
2793 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2804 const char *Names[] = {
"omp_orig",
"omp_priv"};
2805 for (
auto &
Name : Names) {
2807 auto OldLookup = D->
lookup(DN);
2808 auto Lookup = NewDRD->lookup(DN);
2809 if (!OldLookup.empty() && !Lookup.empty()) {
2810 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2812 OldLookup.front(), Lookup.front());
2820 IsCorrect = IsCorrect && SubstCombiner &&
2831 Decl *TemplateDeclInstantiator::VisitOMPCapturedExprDecl(
2833 llvm_unreachable(
"Should not be met in templates");
2849 Decl *TemplateDeclInstantiator::VisitRecordDecl(
RecordDecl *D) {
2850 llvm_unreachable(
"There are only CXXRecordDecls in C++");
2854 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
2861 "can only instantiate an explicit specialization "
2862 "for a member class template");
2872 if (!InstClassTemplate)
2878 castAs<TemplateSpecializationTypeLoc>();
2884 if (SemaRef.
Subst(ArgLocs.data(), ArgLocs.size(),
2885 InstTemplateArgs, TemplateArgs))
2900 void *InsertPos =
nullptr;
2932 diag::note_previous_definition);
2999 assert(VarTemplate &&
3000 "A template specialization without specialized template?");
3008 TemplateArgsInfo.
size(), VarTemplateArgsInfo, TemplateArgs))
3021 void *InsertPos =
nullptr;
3023 Converted, InsertPos))
3028 VarTemplateArgsInfo, Converted);
3044 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
3062 Owner, StartingScope);
3068 llvm_unreachable(
"@defs is not supported in Objective-C++");
3075 "cannot instantiate %0 yet");
3083 llvm_unreachable(
"Unexpected decl");
3092 return Instantiator.
Visit(D);
3104 bool Invalid =
false;
3106 unsigned N = L->
size();
3110 for (
auto &
P : *L) {
3112 Params.push_back(D);
3121 Expr *
const UninstantiatedRequiresClause = L->getRequiresClause();
3125 L->getLAngleLoc(), Params,
3127 UninstantiatedRequiresClause);
3166 InstTemplateArgs, TemplateArgs))
3187 void *InsertPos =
nullptr;
3227 SemaRef.
Diag(PartialSpec->
getLocation(), diag::err_partial_spec_redeclared)
3229 SemaRef.
Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
3260 ClassTemplate->AddPartialSpecialization(InstPartialSpec,
3262 return InstPartialSpec;
3300 InstTemplateArgs, TemplateArgs))
3307 InstTemplateArgs,
false, Converted))
3318 void *InsertPos =
nullptr;
3355 diag::err_var_partial_spec_redeclared)
3358 diag::note_var_prev_partial_spec_here);
3371 diag::err_variable_instantiates_to_function)
3395 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
3398 LateAttrs, Owner, StartingScope);
3400 return InstPartialSpec;
3407 assert(OldTInfo &&
"substituting function without type source info");
3408 assert(Params.empty() &&
"parameter vector is non-empty at start");
3411 unsigned ThisTypeQuals = 0;
3413 ThisContext = cast<CXXRecordDecl>(Owner);
3414 ThisTypeQuals = Method->getTypeQualifiers();
3421 ThisContext, ThisTypeQuals);
3427 if (NewTInfo != OldTInfo) {
3431 unsigned NewIdx = 0;
3432 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
3433 OldIdx != NumOldParams; ++OldIdx) {
3434 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
3439 NumArgumentsInExpansion =
3442 if (!NumArgumentsInExpansion) {
3446 Params.push_back(NewParam);
3451 for (
unsigned I = 0;
I != *NumArgumentsInExpansion; ++
I) {
3453 Params.push_back(NewParam);
3463 cast<FunctionProtoType>(OldProtoLoc.getType());
3464 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
3474 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
3477 Params.push_back(Parm);
3494 TemplateArgs, ParamTypes, &Params,
3509 unsigned FParamIdx = 0;
3514 assert(FParamIdx < Function->getNumParams());
3541 assert(NumArgumentsInExpansion &&
3542 "should only be called when all template arguments are known");
3545 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
3577 UpdateExceptionSpec(Decl,
EST_None);
3583 Diag(PointOfInstantiation, diag::err_exception_spec_cycle) << Decl;
3584 UpdateExceptionSpec(Decl,
EST_None);
3594 getTemplateInstantiationArgs(Decl,
nullptr,
true);
3599 UpdateExceptionSpec(Decl,
EST_None);
3633 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
3634 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
3636 = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
3637 assert(FunTmpl->getTemplatedDecl() == Tmpl &&
3638 "Deduction from the wrong function template?");
3640 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
3641 ActiveInst.Entity = New;
3646 assert(Proto &&
"Function template without prototype?");
3670 assert(NewProto &&
"Template instantiation without function prototype?");
3688 LateAttrs, StartingScope);
3723 DLLExportAttr *
Attr = Ctor->
getAttr<DLLExportAttr>();
3726 for (
unsigned I = 0;
I != NumParams; ++
I) {
3753 bool DefinitionRequired,
3767 assert(PatternDecl &&
"instantiating a non-template");
3770 Stmt *Pattern =
nullptr;
3772 Pattern = PatternDef->
getBody(PatternDef);
3773 PatternDecl = PatternDef;
3775 PatternDef =
nullptr;
3780 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Function,
3782 PatternDecl, PatternDef, TSK,
3783 DefinitionRequired)) {
3784 if (DefinitionRequired)
3791 PendingInstantiations.push_back(
3792 std::make_pair(Function, PointOfInstantiation));
3793 }
else if (TSK == TSK_ImplicitInstantiation) {
3794 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred()) {
3795 Diag(PointOfInstantiation, diag::warn_func_template_missing)
3798 if (getLangOpts().CPlusPlus11)
3799 Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
3809 !LateTemplateParser) {
3811 PendingInstantiations.push_back(
3812 std::make_pair(Function, PointOfInstantiation));
3828 LateTemplateParser) {
3831 ExternalSource->ReadLateParsedTemplates(LateParsedTemplateMap);
3833 auto LPTIter = LateParsedTemplateMap.find(PatternDecl);
3834 assert(LPTIter != LateParsedTemplateMap.end() &&
3835 "missing LateParsedTemplate");
3836 LateTemplateParser(OpaqueParser, *LPTIter->second);
3837 Pattern = PatternDecl->
getBody(PatternDecl);
3842 "unexpected kind of function template definition");
3859 D->setImplicitlyInline();
3869 "instantiating function definition");
3885 bool MergeWithParentScope =
false;
3887 MergeWithParentScope = Rec->isLocalClass();
3892 SetDeclDefaulted(Function, PatternDecl->
getLocation());
3895 getTemplateInstantiationArgs(Function,
nullptr,
false, PatternDecl);
3903 ActOnStartOfFunctionDef(
nullptr, Function);
3915 InstantiateMemInitializers(Ctor, cast<CXXConstructorDecl>(PatternDecl),
3921 Ctor->isDefaultConstructor()) {
3927 StmtResult Body = SubstStmt(Pattern, TemplateArgs);
3934 ActOnFinishFunctionBody(Function, Body.
get(),
3937 PerformDependentDiagnostics(PatternDecl, TemplateArgs);
3939 if (
auto *Listener = getASTMutationListener())
3940 Listener->FunctionDefinitionInstantiated(Function);
3946 Consumer.HandleTopLevelDecl(DG);
3950 LocalInstantiations.
perform();
3952 GlobalInstantiations.
perform();
3960 SourceLocation PointOfInstantiation,
void *InsertPos,
3982 bool IsMemberSpec =
false;
3984 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar))
3985 IsMemberSpec = PartialSpec->isMemberSpecialization();
3987 IsMemberSpec = FromTemplate->isMemberSpecialization();
3997 return cast_or_null<VarTemplateSpecializationDecl>(
3998 Instantiator.VisitVarTemplateSpecializationDecl(
3999 VarTemplate, FromVar, InsertPos, TemplateArgsInfo, Converted));
4019 InstantiateVariableInitializer(VarSpec, PatternDecl, TemplateArgs);
4032 bool InstantiatingVarTemplate) {
4054 if (OldVar->
isUsed(
false))
4059 InstantiateAttrs(TemplateArgs, OldVar, NewVar, LateAttrs, StartingScope);
4072 if (
NamedDecl *NewPrev = FindInstantiatedDecl(
4075 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
4078 CheckVariableDeclaration(NewVar,
Previous);
4080 if (!InstantiatingVarTemplate) {
4088 CurrentInstantiationScope->InstantiatedLocal(OldVar, NewVar);
4095 TSK_ImplicitInstantiation);
4104 if ((!isa<VarTemplateSpecializationDecl>(NewVar) &&
4105 !InstantiatingVarTemplate &&
4108 InstantiateVariableInitializer(NewVar, OldVar, TemplateArgs);
4115 DiagnoseUnusedDecl(NewVar);
4132 PushExpressionEvaluationContext(
4135 PushExpressionEvaluationContext(
4143 Init = SubstInitializer(OldVar->
getInit(), TemplateArgs,
4150 if (Var->
hasAttr<DLLImportAttr>() &&
4154 }
else if (InitExpr) {
4156 AddInitializerToDecl(Var, InitExpr, DirectInit);
4158 ActOnUninitializedDecl(Var);
4165 PopExpressionEvaluationContext();
4181 ActOnUninitializedDecl(Var);
4202 SourceLocation PointOfInstantiation,
4205 bool DefinitionRequired) {
4206 InstantiateVariableDefinition(PointOfInstantiation, Var, Recursive,
4207 DefinitionRequired);
4212 bool DefinitionRequired,
bool AtEndOfTU) {
4218 VarDecl *PatternDecl =
nullptr, *Def =
nullptr;
4220 getTemplateInstantiationArgs(Var);
4225 bool InstantiationDependent =
false;
4228 "Only instantiate variable template specializations that are "
4229 "not type-dependent");
4230 (void)InstantiationDependent;
4236 "Specialization without specialized template?");
4252 VarTemplateDecl *Tmpl = PatternPtr.get<VarTemplateDecl *>();
4253 while (VarTemplateDecl *From =
4266 if (PatternDecl->isStaticDataMember() &&
4267 (PatternDecl = PatternDecl->getFirstDecl())->hasInit() &&
4275 "instantiating variable initializer");
4292 InstantiateVariableInitializer(Var, PatternDecl, TemplateArgs);
4293 PreviousContext.pop();
4297 LocalInstantiations.
perform();
4299 GlobalInstantiations.
perform();
4309 assert(PatternDecl &&
"data member was not instantiated from a template?");
4310 assert(PatternDecl->isStaticDataMember() &&
"not a static data member?");
4320 if (!Def && !DefinitionRequired) {
4322 PendingInstantiations.push_back(
4323 std::make_pair(Var, PointOfInstantiation));
4324 }
else if (TSK == TSK_ImplicitInstantiation) {
4326 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred()) {
4327 Diag(PointOfInstantiation, diag::warn_var_template_missing)
4329 Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
4330 if (getLangOpts().CPlusPlus11)
4331 Diag(PointOfInstantiation, diag::note_inst_declaration_hint) << Var;
4341 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Var,
4343 PatternDecl, Def, TSK,
4344 DefinitionRequired))
4360 struct PassToConsumerRAII {
4365 : Consumer(Consumer), Var(Var) { }
4367 ~PassToConsumerRAII() {
4370 } PassToConsumerRAII(Consumer, Var);
4377 PointOfInstantiation);
4385 "instantiating variable definition");
4401 if (Def->isStaticDataMember() && !Def->
isOutOfLine()) {
4404 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4405 }
else if (!VarSpec) {
4406 Var = cast_or_null<VarDecl>(SubstDecl(Def, Var->
getDeclContext(),
4415 Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
4424 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
4428 LookupResult R(*
this, Var->getDeclName(), Var->getLocation(),
4429 LookupOrdinaryName, ForRedeclaration);
4431 MergeVarDecl(Var, R);
4434 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4439 Var = CompleteVarTemplateSpecializationDecl(VarSpec, Def, TemplateArgs);
4441 PreviousContext.pop();
4444 PassToConsumerRAII.Var = Var;
4451 LocalInstantiations.
perform();
4453 GlobalInstantiations.
perform();
4465 for (
const auto *Init : Tmpl->
inits()) {
4468 if (!Init->isWritten())
4471 SourceLocation EllipsisLoc;
4473 if (Init->isPackExpansion()) {
4475 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
4479 bool ShouldExpand =
false;
4480 bool RetainExpansion =
false;
4482 if (CheckParameterPacksForExpansion(Init->getEllipsisLoc(),
4485 TemplateArgs, ShouldExpand,
4492 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
4495 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
4499 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4509 Init->getSourceLocation(),
4518 BaseTInfo, TempInit.
get(),
4526 NewInits.push_back(NewInit.
get());
4533 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4541 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
4544 Init->getSourceLocation(),
4552 if (Init->isBaseInitializer())
4553 NewInit = BuildBaseInitializer(TInfo->
getType(), TInfo, TempInit.
get(),
4556 NewInit = BuildDelegatingInitializer(TInfo, TempInit.
get(),
4557 cast<CXXRecordDecl>(CurContext->getParent()));
4558 }
else if (Init->isMemberInitializer()) {
4559 FieldDecl *Member = cast_or_null<FieldDecl>(FindInstantiatedDecl(
4560 Init->getMemberLocation(),
4569 NewInit = BuildMemberInitializer(Member, TempInit.
get(),
4570 Init->getSourceLocation());
4571 }
else if (Init->isIndirectMemberInitializer()) {
4573 cast_or_null<IndirectFieldDecl>(FindInstantiatedDecl(
4574 Init->getMemberLocation(),
4575 Init->getIndirectMember(), TemplateArgs));
4577 if (!IndirectMember) {
4583 NewInit = BuildMemberInitializer(IndirectMember, TempInit.
get(),
4584 Init->getSourceLocation());
4591 NewInits.push_back(NewInit.
get());
4596 ActOnMemInitializers(New,
4611 if (Pattern == Instance)
return true;
4624 if (Pattern == Instance)
return true;
4635 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
4637 Instance = cast<ClassTemplatePartialSpecializationDecl>(
4639 if (Pattern == Instance)
4653 if (Pattern == Instance)
return true;
4666 if (Pattern == Instance)
return true;
4679 if (Pattern == Instance)
return true;
4698 template<
typename T>
4707 bool OtherIsPackExpansion;
4709 if (
auto *OtherUUD = dyn_cast<T>(Other)) {
4710 OtherIsPackExpansion = OtherUUD->isPackExpansion();
4712 }
else if (
auto *OtherUPD = dyn_cast<UsingPackDecl>(Other)) {
4713 OtherIsPackExpansion =
true;
4714 OtherFrom = OtherUPD->getInstantiatedFromUsingDecl();
4715 }
else if (
auto *OtherUD = dyn_cast<UsingDecl>(Other)) {
4716 OtherIsPackExpansion =
false;
4721 return Pattern->isPackExpansion() == OtherIsPackExpansion &&
4733 if (Pattern == Instance)
return true;
4743 if (
auto *UUD = dyn_cast<UnresolvedUsingTypenameDecl>(D))
4746 if (
auto *UUD = dyn_cast<UnresolvedUsingValueDecl>(D))
4752 if (
auto *Record = dyn_cast<CXXRecordDecl>(Other))
4755 if (
auto *Function = dyn_cast<FunctionDecl>(Other))
4758 if (
auto *Enum = dyn_cast<EnumDecl>(Other))
4761 if (
auto *Var = dyn_cast<VarDecl>(Other))
4765 if (
auto *Temp = dyn_cast<ClassTemplateDecl>(Other))
4768 if (
auto *Temp = dyn_cast<FunctionTemplateDecl>(Other))
4771 if (
auto *PartialSpec =
4772 dyn_cast<ClassTemplatePartialSpecializationDecl>(Other))
4776 if (
auto *Field = dyn_cast<FieldDecl>(Other)) {
4780 cast<FieldDecl>(D));
4784 if (
auto *Using = dyn_cast<UsingDecl>(Other))
4787 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(Other))
4791 D->
getDeclName() == cast<NamedDecl>(Other)->getDeclName();
4794 template<
typename ForwardIterator>
4797 ForwardIterator first,
4798 ForwardIterator last) {
4799 for (; first != last; ++first)
4801 return cast<NamedDecl>(*first);
4812 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
4813 Decl*
ID = FindInstantiatedDecl(Loc, D, TemplateArgs,
true);
4814 return cast_or_null<DeclContext>(
ID);
4846 bool FindingInstantiatedContext) {
4865 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
4867 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
4868 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
4870 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda())) {
4873 if (CurrentInstantiationScope) {
4874 if (
auto Found = CurrentInstantiationScope->findInstantiationOf(D)) {
4875 if (Decl *FD = Found->dyn_cast<Decl *>())
4876 return cast<NamedDecl>(FD);
4878 int PackIdx = ArgumentPackSubstitutionIndex;
4879 assert(PackIdx != -1 &&
4880 "found declaration pack but not pack expanding");
4882 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
4889 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
4890 isa<TemplateTemplateParmDecl>(D))
4909 bool NeedInstantiate =
false;
4911 NeedInstantiate = RD->isLocalClass();
4913 NeedInstantiate = isa<EnumDecl>(D);
4914 if (NeedInstantiate) {
4915 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4916 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4917 return cast<TypeDecl>(Inst);
4922 assert(isa<LabelDecl>(D));
4924 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4925 assert(Inst &&
"Failed to instantiate label??");
4927 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4928 return cast<LabelDecl>(Inst);
4934 dyn_cast<VarTemplateSpecializationDecl>(D)) {
4935 bool InstantiationDependent =
false;
4937 VarSpec->getTemplateArgsInfo();
4939 VarTemplateArgs, InstantiationDependent))
4940 D = cast<NamedDecl>(
4955 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Record))
4967 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
4971 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
4991 if (Guide && Guide->isImplicit()) {
4999 Unpacked = Arg.pack_elements();
5002 getTrivialTemplateArgumentLoc(UnpackedArg,
QualType(), Loc));
5008 assert(SubstRecord &&
"class template id not a class type?");
5014 if (FindingInstantiatedContext &&
5015 usesPartialOrExplicitSpecialization(
5016 Loc, cast<ClassTemplateSpecializationDecl>(SubstRecord))) {
5017 Diag(Loc, diag::err_specialization_not_primary_template)
5018 << T << (SubstRecord->getTemplateSpecializationKind() ==
5037 ParentDC = FindInstantiatedContext(Loc, ParentDC, TemplateArgs);
5048 bool IsBeingInstantiated =
false;
5049 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
5050 if (!Spec->isDependentContext()) {
5053 assert(Tag &&
"type of non-dependent record is not a RecordType");
5055 IsBeingInstantiated =
true;
5057 RequireCompleteType(Loc, T, diag::err_incomplete_type))
5069 Name = SubstDeclarationNameInfo(NameInfo, TemplateArgs).getName();
5089 if (isa<UsingShadowDecl>(D)) {
5091 }
else if (Diags.hasErrorOccurred()) {
5095 }
else if (IsBeingInstantiated) {
5101 Diag(Loc, diag::err_member_not_yet_instantiated)
5109 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
5110 EnumDecl *Spec = cast<EnumDecl>(FindInstantiatedDecl(Loc, Enum,
5112 assert(Spec->getTemplateSpecializationKind() ==
5114 Diag(Loc, diag::err_enumerator_does_not_exist)
5117 Diag(Spec->getLocation(), diag::note_enum_specialized_here)
5121 llvm_unreachable(
"Unable to find instantiation of declaration!");
5134 while (!PendingLocalImplicitInstantiations.empty() ||
5135 (!LocalOnly && !PendingInstantiations.empty())) {
5138 if (PendingLocalImplicitInstantiations.empty()) {
5139 Inst = PendingInstantiations.front();
5140 PendingInstantiations.pop_front();
5142 Inst = PendingLocalImplicitInstantiations.front();
5143 PendingLocalImplicitInstantiations.pop_front();
5147 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
5148 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
5150 InstantiateFunctionDefinition(Inst.second, Function,
true,
5151 DefinitionRequired,
true);
5152 if (Function->isDefined())
5153 Function->setInstantiationIsPending(
false);
5158 VarDecl *Var = cast<VarDecl>(Inst.first);
5161 isa<VarTemplateSpecializationDecl>(Var)) &&
5162 "Not a static data member, nor a variable template"
5163 " specialization?");
5174 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
5182 case TSK_ImplicitInstantiation:
5187 "instantiating variable definition");
5193 InstantiateVariableDefinition( Inst.second, Var,
true,
5194 DefinitionRequired,
true);
5200 for (
auto DD : Pattern->
ddiags()) {
5201 switch (DD->getKind()) {
5203 HandleDependentAccessCheck(*DD, TemplateArgs);
Defines the clang::ASTContext interface.
FunctionDecl * getDefinition()
Get the definition for this declaration.
SourceLocation getEnd() const
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 ...
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
static void collectUnexpandedParameterPacks(Sema &S, TemplateParameterList *Params, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
ddiag_range ddiags() const
void setImplicit(bool I=true)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
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+...
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
no exception specification
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
SourceLocation getIdentLocation() const
Returns the location of this using declaration's identifier.
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D)
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
void setAnonymousStructOrUnion(bool Anon)
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
A (possibly-)qualified type.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
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.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
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...
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
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.
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...
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
static void instantiateDependentAllocAlignAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AllocAlignAttr *Align, Decl *New)
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
void addOuterTemplateArguments(const TemplateArgumentList *TemplateArgs)
Add a new outermost level to the multi-level template argument list.
const LangOptions & getLangOpts() const
CXXMethodDecl * getSpecialization() const
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
Stmt - This represents one statement.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
We are matching the template parameter lists of two templates that might be redeclarations.
bool isParameterPack() const
Returns whether this is a parameter pack.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
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)
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...
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 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...
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)
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
QualType getUnderlyingType() const
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
TypeLoc getPatternLoc() const
static Expr * instantiateDependentFunctionAttrCondition(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, Expr *OldCond, const Decl *Tmpl, FunctionDecl *New)
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
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.
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.
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
bool hasLinkage() const
Determine whether this declaration has linkage.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
const FunctionDecl * isLocalClass() const
If the class is a local class [class.local], returns the enclosing function declaration.
QualType getRecordType(const RecordDecl *Decl) const
Declaration of a variable template.
const Expr * getInit() const
NamespaceDecl - Represent a C++ namespace.
A container of type source information.
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
SourceLocation getLocEnd() const LLVM_READONLY
void setInitStyle(InitializationStyle Style)
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, ArrayRef< TemplateParameterList * > FriendTypeTPLists=None)
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.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
InClassInitStyle getInClassInitStyle() const
getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has...
static void instantiateDependentEnableIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const EnableIfAttr *EIA, const Decl *Tmpl, FunctionDecl *New)
const TemplateArgumentLoc * getArgumentArray() const
bool hasExplicitTemplateArgs() const
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
const TemplateArgumentListInfo & templateArgs() const
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void setRAngleLoc(SourceLocation Loc)
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)
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)
bool SubstQualifier(const DeclaratorDecl *OldDecl, DeclaratorDecl *NewDecl)
bool isInlineSpecified() const
SourceLocation getRParenLoc() const
static void instantiateDependentAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignedAttr *Aligned, Decl *New, bool IsPackExpansion)
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Extra information about a function prototype.
AccessSpecifier getAccess() const
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)
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
Stores a list of template parameters for a TemplateDecl and its derived classes.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
decl_iterator decls_end() const
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)
bool isSingleTagDecl() const
Asks if the result is a single tag decl.
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)
void AddParameterABIAttr(SourceRange AttrRange, Decl *D, ParameterABI ABI, unsigned SpellingListIndex)
Defines the clang::Expr interface and subclasses for C++ expressions.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
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...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
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'.
unsigned getStaticLocalNumber(const VarDecl *VD) const
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
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 isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
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...
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
DeclarationName getName() const
getName - Returns the embedded declaration name.
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
void setIntegerType(QualType T)
Set the underlying integer type.
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
StringLiteral * getMessage()
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
void setManglingNumber(const NamedDecl *ND, unsigned Number)
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
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)
The results of name lookup within a DeclContext.
unsigned getNumArgs() const
ArrayRef< QualType > getParamTypes() const
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
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.
bool isReferenceType() const
bool isInIdentifierNamespace(unsigned NS) const
QualType getReturnType() const
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
The current expression is potentially evaluated at run time, which means that code may be generated t...
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, AttributeList *Attr)
bool isReferenced() const
Whether any declaration of this entity was referenced.
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...
bool isPure() const
Whether this virtual function is pure, i.e.
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.
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
ParmVarDecl * getParam(unsigned i) const
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
CXXRecordDecl * getDefinition() const
TagKind getTagKind() const
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
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.
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
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...
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
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.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the ty...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Expr * getUnderlyingExpr() const
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
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.
VarTemplateDecl * getInstantiatedFromMemberTemplate() 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.
const TargetInfo & getTargetInfo() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer)
Finish current declare reduction construct initializer.
IdentifierInfo * getSetterId() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For an enumeration member that was instantiated from a member enumeration of a templated class...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
SourceLocation getRAngleLoc() const
A convenient class for passing around template argument information.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
QualType getReturnType() const
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...
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isDefaulted() const
Whether this function is defaulted per C++0x.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool InitFunctionInstantiation(FunctionDecl *New, FunctionDecl *Tmpl)
Initializes the common fields of an instantiation function declaration (New) from the corresponding f...
NestedNameSpecifierLoc getTemplateQualifierLoc() const
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 ('>').
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
RecordDecl * getDecl() const
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isOverloadedOperator() const
isOverloadedOperator - Whether this function declaration represents an C++ overloaded operator...
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
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.
SourceLocation getRAngleLoc() const
Represents a C++ nested-name-specifier or a global scope specifier.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
SourceLocation getTemplateNameLoc() const
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
SourceLocation getLocation() const
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
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'.
ArrayRef< BindingDecl * > bindings() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
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.
decl_iterator decls_begin() const
detail::InMemoryDirectory::const_iterator I
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
A binding in a decomposition declaration.
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
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)
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
RAII object used to change the argument pack substitution index within a Sema object.
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
bool isDefined(const FunctionDecl *&Definition) const
isDefined - Returns true if the function is defined at all, including a deleted definition.
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
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.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
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)
ExtInfo getExtInfo() const
Sema - This implements semantic analysis and AST building for C.
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
QualType getParamType(unsigned i) const
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
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 getPosition() const
Get the position of the template parameter within its parameter list.
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
bool inferObjCARCLifetime(ValueDecl *decl)
Represents a ValueDecl that came out of a declarator.
DeclarationNameTable DeclarationNames
unsigned getChainingSize() const
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...
SourceLocation getTypeSpecStartLoc() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
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)
Decl * VisitVarDecl(VarDecl *D, bool InstantiatingVarTemplate, ArrayRef< BindingDecl * > *Bindings=nullptr)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool isDeleted() const
Whether this function has been deleted.
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
const Type * getTypeForDecl() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Expr - This represents one expression.
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
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)
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
bool isDeletedAsWritten() const
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Declaration of a template type parameter.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
ClassTemplatePartialSpecializationDecl * InstantiateClassTemplatePartialSpecialization(ClassTemplateDecl *ClassTemplate, ClassTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a class template partial specialization.
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
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...
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Expr * getBitWidth() const
ArrayRef< NamedDecl * > chain() const
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.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, bool AllowParamOrMoveConstructible)
const ParmVarDecl * getParamDecl(unsigned i) const
ExtProtoInfo getExtProtoInfo() const
bool isLocalExternDecl()
Determine whether this is a block-scope declaration with linkage.
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, Optional< unsigned > NumExpansions, bool ExpectParameterPack)
DeclContext * getDeclContext()
void CheckAlignasUnderalignment(Decl *D)
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
const char * getDeclKindName() const
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
Represents the type decltype(expr) (C++11).
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given function template specialization.
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) 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.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
void DiscardCleanupsInEvaluationContext()
void setConstexpr(bool IC)
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
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.
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
StorageClass
Storage classes.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFunctionOrMethod() 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.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
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.
void setLocation(SourceLocation L)
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
DiagnosticsEngine & getDiagnostics() const
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
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.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
shadow_range shadows() const
static StringRef getIdentifier(const Token &Tok)
TypeSourceInfo * getTypeSourceInfo() const
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.
bool isTemplateTypeParmType() const
TypedefNameDecl * getTypedefNameForAnonDecl() const
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. ...
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
DeclarationNameInfo getNameInfo() const
Attr * instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
Stmt * getBody(const FunctionDecl *&Definition) const
getBody - Retrieve the body (definition) of the function.
SourceLocation getLocStart() const LLVM_READONLY
TemplateArgumentLoc getArgLoc(unsigned i) const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
IdentifierInfo * getGetterId() const
ExceptionSpecificationType Type
The kind of exception specification this is.
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.
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
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)
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
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...
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.
Encodes a location in the source.
enumerator_range enumerators() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
This represents '#pragma omp declare reduction ...' directive.
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)
const TemplateArgumentListInfo & getTemplateArgsInfo() const
SourceRange getBraceRange() const
void InstantiateStaticDataMemberDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false)
Instantiate the definition of the given variable from its template.
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
TagDecl - Represents the declaration of a struct/union/class/enum.
TemplateParameterList * SubstTemplateParams(TemplateParameterList *List)
Instantiates a nested template parameter list in the current instantiation context.
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.
ASTContext & getASTContext() const
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
void setReferenced(bool R=true)
LabelDecl - Represents the declaration of a label.
Represents a dependent using declaration which was not marked with typename.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a static or instance method of a struct/union/class.
unsigned getDepth() const
Retrieve the depth of the template parameter.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
static bool isInstantiationOf(ClassTemplateDecl *Pattern, ClassTemplateDecl *Instance)
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
Decl * VisitDecl(Decl *D)
ArrayRef< ParmVarDecl * > parameters() const
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
static void instantiateDependentAlignValueAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignValueAttr *Aligned, Decl *New)
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
void setDeclName(DeclarationName N)
Set the name of this declaration.
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or NULL if no such declaration exists...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
SourceLocation getLAngleLoc() const
ThreadStorageClassSpecifier getTSCSpec() const
void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern)
const T * castAs() const
Member-template castAs<specific 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.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
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.
bool isFileContext() 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)
Represents a C++11 static_assert declaration.
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 setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Attr * clone(ASTContext &C) const
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
const ArgList & getInnermost() const
Retrieve the innermost template argument list.
void setLAngleLoc(SourceLocation Loc)
QualType getType() const
Return the type wrapped by this type source info.
void addArgument(const TemplateArgumentLoc &Loc)
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, Expr *AssociatedConstraints=nullptr)
Create a class template node.
unsigned getManglingNumber(const NamedDecl *ND) const
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
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)
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template...
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Base class for declarations which introduce a typedef-name.
attr::Kind getKind() const
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Whether this is an anonymous struct or union.
Represents a template argument.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
static bool isInvalid(LocType Loc, bool *Invalid)
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
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.
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
void setImplicitlyInline()
Flag that this function is implicitly inline.
bool hasTypename() const
Return true if the using declaration has 'typename'.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
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.
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 isUnsupportedFriend() const
Determines if this friend kind is unsupported.
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...
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.).
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
SourceLocation getEllipsisLoc() const
bool isInvalidDecl() const
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...
TypeLoc IgnoreParens() const
CanQualType UnsignedLongLongTy
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
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...
bool hasWrittenPrototype() const
Represents a dependent using declaration which was marked with typename.
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.
void AddNSConsumedAttr(SourceRange AttrRange, Decl *D, unsigned SpellingListIndex, bool isNSConsumed, bool isTemplateInstantiation)
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
SourceLocation getLocStart() const LLVM_READONLY
EnumDecl - Represents an enum.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
void setInlineSpecified()
detail::InMemoryDirectory::const_iterator E
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void setPreviousDeclInSameBlockScope(bool Same)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
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...
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...
unsigned getDepth() const
Get the nesting depth of the template parameter.
void setInitCapture(bool IC)
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
void setLocalExternDecl()
Changes the namespace of this declaration to reflect that it's a function-local extern declaration...
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...
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
bool empty() const
Return true if no decls were found.
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...
TypeSourceInfo * SubstFunctionType(FunctionDecl *D, SmallVectorImpl< ParmVarDecl * > &Params)
Location wrapper for a TemplateArgument.
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
Decl * Visit(PTR(Decl) D)
SourceManager & getSourceManager() const
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
const T * getAs() const
Member-template getAs<specific type>'.
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
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)
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
bool isNull() const
Determine whether this template name is NULL.
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
bool isFunctionType() const
static bool SubstQualifier(Sema &SemaRef, const DeclT *OldDecl, DeclT *NewDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
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.
const TypeClass * getTypePtr() const
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 isStaticDataMember() const
Determines whether this is a static data member.
bool isLexicallyWithinFunctionOrMethod() const
Returns true if this declaration lexically is inside a function.
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
void setInnerLocStart(SourceLocation L)
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
A template argument list.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
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.
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization)
Perform semantic checking of a new function declaration.
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, llvm::MutableArrayRef< NamedDecl * > CH)
void setTSCSpec(ThreadStorageClassSpecifier TSC)
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...
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
void addHiddenDecl(Decl *D)
Add the declaration D to this context without modifying any lookup tables.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
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...
bool duplicatesAllowed() const
By default, attributes cannot be duplicated when being merged; however, an attribute can override thi...
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
bool isInline() const
Whether this variable is (C++1z) inline.
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.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
SourceLocation getAccessSpecifierLoc() const
The location of the access specifier.
unsigned getIndex() const
Retrieve the index of the template parameter.
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 Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
static OpaquePtr make(QualTypeP)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
TranslationUnitDecl - The top declaration context.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
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.
An instance of this class represents the declaration of a property member.
TemplateParameterList * getTemplateParameterList(unsigned index) const
SourceLocation getLAngleLoc() const
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 isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
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)
SourceLocation getLocation() const
void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo)
Set the underlying integer type source info.
void setLexicalDeclContext(DeclContext *DC)
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
NamedDecl - This represents a decl with a name.
DeclarationNameInfo getNameInfo() const
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.
void setAccess(AccessSpecifier AS)
EnumDecl * getDefinition() const
Represents a C++ namespace alias.
Declaration of a friend template.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
TypeSourceInfo * getTypeSourceInfo() const
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
NamespaceDecl * getStdNamespace() const
void setType(QualType newType)
const TemplateArgument & getArgument() const
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())
SourceRange getSourceRange() const LLVM_READONLY
bool InitMethodInstantiation(CXXMethodDecl *New, CXXMethodDecl *Tmpl)
Initializes common fields of an instantiated method declaration (New) from the corresponding fields o...
void setDeletedAsWritten(bool D=true)
Decl * VisitCXXMethodDecl(CXXMethodDecl *D, TemplateParameterList *TemplateParams, bool IsClassScopeSpecialization=false)
This represents '#pragma omp threadprivate ...' directive.
FunctionDecl * getClassScopeSpecializationPattern() const
Retrieve the class scope template pattern that this function template specialization is instantiated ...
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
ExceptionSpecInfo ExceptionSpec
Declaration of a template function.
void clear()
Clears out any current state.
Attr - This represents one attribute.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
std::vector< const ClassTemplatePartialSpecializationDecl * > PartialSpecs
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
unsigned getNumTemplateParameterLists() const
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)