26 using namespace clang;
34 return cast<CXXRecordDecl>(DC)->isLocalClass();
39 template<
typename DeclT>
42 if (!OldDecl->getQualifierLoc())
45 assert((NewDecl->getFriendObjectKind() ||
46 !OldDecl->getLexicalDeclContext()->isDependentContext()) &&
47 "non-friend with qualified name defined in dependent context");
50 const_cast<DeclContext *>(NewDecl->getFriendObjectKind()
51 ? NewDecl->getLexicalDeclContext()
52 : OldDecl->getLexicalDeclContext()));
61 NewDecl->setQualifierInfo(NewQualifierLoc);
76 #include "clang/Sema/AttrTemplateInstantiate.inc"
80 const AlignedAttr *Aligned,
Decl *New,
bool IsPackExpansion) {
81 if (Aligned->isAlignmentExpr()) {
87 Aligned->getSpellingListIndex(), IsPackExpansion);
90 TemplateArgs, Aligned->getLocation(),
94 Aligned->getSpellingListIndex(), IsPackExpansion);
100 const AlignedAttr *Aligned,
Decl *New) {
101 if (!Aligned->isPackExpansion()) {
107 if (Aligned->isAlignmentExpr())
113 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
116 bool Expand =
true, RetainExpansion =
false;
121 Unexpanded, TemplateArgs, Expand,
122 RetainExpansion, NumExpansions))
129 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
138 const AssumeAlignedAttr *Aligned,
Decl *New) {
142 Expr *
E, *OE =
nullptr;
148 if (Aligned->getOffset()) {
149 Result = S.
SubstExpr(Aligned->getOffset(), TemplateArgs);
156 Aligned->getSpellingListIndex());
161 const AlignValueAttr *Aligned,
Decl *New) {
167 Aligned->getSpellingListIndex());
172 const EnableIfAttr *A,
const Decl *Tmpl,
Decl *New) {
173 Expr *Cond =
nullptr;
185 Cond = Converted.
get();
192 S.
Diag(A->getLocation(), diag::err_enable_if_never_constant_expr);
193 for (
int I = 0, N = Diags.size();
I != N; ++
I)
194 S.
Diag(Diags[
I].first, Diags[I].second);
201 A->getSpellingListIndex());
209 const CUDALaunchBoundsAttr &
Attr,
Decl *New) {
218 Expr *MinBlocks =
nullptr;
219 if (Attr.getMinBlocks()) {
220 Result = S.
SubstExpr(Attr.getMinBlocks(), TemplateArgs);
227 Attr.getSpellingListIndex());
234 for (
const auto *TmplAttr : Tmpl->
attrs()) {
236 const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
237 if (Aligned && Aligned->isAlignmentDependent()) {
242 const AssumeAlignedAttr *AssumeAligned = dyn_cast<AssumeAlignedAttr>(TmplAttr);
248 const AlignValueAttr *AlignValue = dyn_cast<AlignValueAttr>(TmplAttr);
254 const EnableIfAttr *EnableIf = dyn_cast<EnableIfAttr>(TmplAttr);
255 if (EnableIf && EnableIf->getCond()->isValueDependent()) {
261 if (
const CUDALaunchBoundsAttr *CUDALaunchBounds =
262 dyn_cast<CUDALaunchBoundsAttr>(TmplAttr)) {
264 *CUDALaunchBounds, New);
269 if (TmplAttr->getKind() == attr::DLLExport ||
270 TmplAttr->getKind() == attr::DLLImport) {
271 if (New->
hasAttr<DLLExportAttr>() || New->
hasAttr<DLLImportAttr>()) {
276 assert(!TmplAttr->isPackExpansion());
277 if (TmplAttr->isLateParsed() && LateAttrs) {
293 *
this, TemplateArgs);
304 template<
typename DeclT>
306 DeclT *
Result = D->getPreviousDecl();
311 if (Result && isa<CXXRecordDecl>(D->getDeclContext()) &&
312 D->getLexicalDeclContext() != Result->getLexicalDeclContext())
320 llvm_unreachable(
"Translation units cannot be instantiated");
325 llvm_unreachable(
"extern \"C\" context cannot be instantiated");
329 TemplateDeclInstantiator::VisitLabelDecl(
LabelDecl *D) {
337 TemplateDeclInstantiator::VisitNamespaceDecl(
NamespaceDecl *D) {
338 llvm_unreachable(
"Namespaces cannot be instantiated");
357 bool Invalid =
false;
401 TagDecl *oldTag = oldTagType->getDecl();
420 Typedef->setPreviousDecl(InstPrevTypedef);
458 if (getPreviousDeclForInstantiation<TypedefNameDecl>(Pattern)) {
460 if (!Found.
empty()) {
474 if (PrevAliasTemplate)
479 if (!PrevAliasTemplate)
492 bool InstantiatingVarTemplate) {
497 if (RecordTy->getDecl()->isAnonymousStructOrUnion())
498 if (!VisitCXXRecordDecl(cast<CXXRecordDecl>(RecordTy->getDecl())))
510 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
534 StartingScope, InstantiatingVarTemplate);
537 QualType ReturnType = cast<FunctionDecl>(DC)->getReturnType();
555 Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
572 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
589 = SemaRef.
SubstExpr(BitWidth, TemplateArgs);
594 BitWidth = InstantiatedBitWidth.
getAs<
Expr>();
599 cast<RecordDecl>(Owner),
608 cast<Decl>(Owner)->setInvalidDecl();
625 if (Parent->isAnonymousStructOrUnion() &&
626 Parent->getRedeclContext()->isFunctionOrMethod())
638 bool Invalid =
false;
642 SemaRef.
Diag(D->
getLocation(), diag::err_property_is_variably_modified)
658 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
687 for (
auto *PI : D->
chain()) {
693 NamedChain[i++] =
Next;
696 QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
707 return IndirectField;
722 InstTy = SemaRef.
SubstType(Ty, TemplateArgs,
740 assert(ND &&
"friend decl must be a decl or a type!");
747 if (!NewND)
return nullptr;
766 = SemaRef.
SubstExpr(AssertExpr, TemplateArgs);
771 InstantiatedAssertExpr.
get(),
777 Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
783 if (!Prev)
return nullptr;
784 PrevDecl = cast<EnumDecl>(Prev);
805 &&
"Dependent type without type source info");
828 if (Def && Def != D) {
835 SemaRef.
SubstType(TI->getType(), TemplateArgs,
871 if (
Expr *UninstValue = EC->getInitExpr()) {
876 Value = SemaRef.
SubstExpr(UninstValue, TemplateArgs);
902 Enumerators.push_back(EnumConst);
903 LastEnumConst = EnumConst;
922 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
927 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
959 if (!Found.
empty()) {
961 if (PrevClassTemplate)
974 SS.
Adopt(QualifierLoc);
976 if (!DC)
return nullptr;
989 if (R.isSingleResult()) {
991 if (PrevClassTemplate)
995 if (!PrevClassTemplate && QualifierLoc) {
1002 bool AdoptedPreviousTemplateParams =
false;
1003 if (PrevClassTemplate) {
1004 bool Complain =
true;
1021 if (cast<Decl>(DCParent)->isInStdNamespace())
1036 AdoptedPreviousTemplateParams =
true;
1037 InstParams = PrevParams;
1042 if (!AdoptedPreviousTemplateParams &&
1062 RecordInst->setDescribedClassTemplate(Inst);
1065 if (PrevClassTemplate)
1075 if (!PrevClassTemplate)
1087 RecordInst->setLexicalDeclContext(Owner);
1098 if (!PrevClassTemplate) {
1104 for (
unsigned I = 0, N = PartialSpecs.size();
I != N; ++
I)
1105 if (PartialSpecs[
I]->getFirstDecl()->isOutOfLine())
1106 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[
I]));
1113 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
1126 if (!InstClassTemplate)
1138 "Only static data member templates are allowed.");
1154 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
1160 if (!VarInst)
return nullptr;
1171 if (!PrevVarTemplate)
1181 if (!PrevVarTemplate) {
1187 for (
unsigned I = 0, N = PartialSpecs.size();
I != N; ++
I)
1188 if (PartialSpecs[
I]->getFirstDecl()->isOutOfLine())
1189 OutOfLineVarPartialSpecs.push_back(
1190 std::make_pair(Inst, PartialSpecs[
I]));
1196 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
1199 "Only static data member templates are allowed.");
1205 assert(!Found.
empty() &&
"Instantiation found nothing?");
1208 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
1211 InstVarTemplate->findPartialSpecInstantiatedFromMember(D))
1245 = Instantiated->getDescribedFunctionTemplate();
1247 assert(InstTemplate &&
1248 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
1266 return InstTemplate;
1272 PrevDecl = cast<CXXRecordDecl>(Owner);
1277 if (!Prev)
return nullptr;
1278 PrevDecl = cast<CXXRecordDecl>(Prev);
1331 SavedPendingLocalImplicitInstantiations(SemaRef);
1363 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
1369 NewFunc->getParamTypes(), NewEPI);
1381 if (FunctionTemplate && !TemplateParams) {
1384 void *InsertPos =
nullptr;
1394 if (FunctionTemplate)
1399 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1401 !(isa<Decl>(Owner) &&
1402 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1426 }
else if (isFriend && QualifierLoc) {
1428 SS.
Adopt(QualifierLoc);
1430 if (!DC)
return nullptr;
1462 for (
unsigned P = 0;
P < Params.size(); ++
P)
1464 Params[
P]->setOwningFunction(Function);
1465 Function->setParams(Params);
1468 if (TemplateParams) {
1486 TemplateParams, Function);
1497 }
else if (FunctionTemplate) {
1500 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1505 }
else if (isFriend) {
1512 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1518 bool isExplicitSpecialization =
false;
1528 assert(isFriend &&
"non-friend has dependent specialization info?");
1535 Info->getRAngleLoc());
1536 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
1537 ExplicitArgs, TemplateArgs))
1541 for (
unsigned I = 0,
E = Info->getNumTemplates();
I !=
E; ++
I) {
1543 Info->getTemplate(
I),
1545 if (!Temp)
return nullptr;
1547 Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
1555 isExplicitSpecialization =
true;
1557 }
else if (TemplateParams || !FunctionTemplate) {
1572 isExplicitSpecialization);
1574 NamedDecl *PrincipalDecl = (TemplateParams
1575 ? cast<NamedDecl>(FunctionTemplate)
1584 bool QueuedInstantiation =
false;
1599 SemaRef.
Diag(Definition->
getLocation(), diag::note_previous_definition);
1603 else for (
auto R : Function->
redecls()) {
1609 if (!QueuedInstantiation && R->isUsed(
false)) {
1612 if (MSInfo->getPointOfInstantiation().isInvalid()) {
1614 MSInfo->setPointOfInstantiation(Loc);
1616 std::make_pair(Function, Loc));
1617 QueuedInstantiation =
true;
1624 if (R->getFriendObjectKind()) {
1627 if (RPattern->isDefined(RPattern)) {
1630 SemaRef.
Diag(R->getLocation(), diag::note_previous_definition);
1646 assert(!D->
isDefaulted() &&
"only methods should be defaulted");
1653 bool IsClassScopeSpecialization) {
1655 if (FunctionTemplate && !TemplateParams) {
1661 void *InsertPos =
nullptr;
1671 if (FunctionTemplate)
1676 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1677 !(isa<Decl>(Owner) &&
1678 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1683 unsigned NumTempParamLists = 0;
1685 TempParamLists.resize(NumTempParamLists);
1686 for (
unsigned I = 0;
I != NumTempParamLists; ++
I) {
1691 TempParamLists[
I] = InstParams;
1713 SS.
Adopt(QualifierLoc);
1723 if (!DC)
return nullptr;
1735 StartLoc, NameInfo, T, TInfo,
1736 Constructor->isExplicit(),
1737 Constructor->isInlineSpecified(),
1738 false, Constructor->isConstexpr());
1743 Constructor->getInheritedConstructor())) {
1747 if (FunctionTemplate) {
1748 assert(!TemplateParams && Inh->getDescribedFunctionTemplate() &&
1749 !Inh->getParent()->isDependentContext() &&
1750 "inheriting constructor template in dependent context?");
1753 if (Inst.isInvalid())
1762 Inh = cast_or_null<CXXConstructorDecl>(
1763 SemaRef.
SubstDecl(Inh, Inh->getDeclContext(), InheritedArgs));
1767 cast<CXXConstructorDecl>(Method)->setInheritedConstructor(Inh);
1771 StartLoc, NameInfo, T, TInfo,
1772 Destructor->isInlineSpecified(),
1776 StartLoc, NameInfo, T, TInfo,
1777 Conversion->isInlineSpecified(),
1778 Conversion->isExplicit(),
1779 Conversion->isConstexpr(),
1780 Conversion->getLocEnd());
1784 StartLoc, NameInfo, T, TInfo,
1793 Method->setQualifierInfo(QualifierLoc);
1795 if (TemplateParams) {
1811 Method->getDeclName(),
1812 TemplateParams, Method);
1818 Method->setDescribedFunctionTemplate(FunctionTemplate);
1819 }
else if (FunctionTemplate) {
1822 Method->setFunctionTemplateSpecialization(FunctionTemplate,
1827 }
else if (!isFriend) {
1829 Method->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1836 if (NumTempParamLists)
1837 Method->setTemplateParameterListsInfo(
1839 llvm::makeArrayRef(TempParamLists.data(), NumTempParamLists));
1841 Method->setLexicalDeclContext(Owner);
1842 Method->setObjectOfFriendDecl();
1847 for (
unsigned P = 0;
P < Params.size(); ++
P)
1848 Params[
P]->setOwningFunction(Method);
1849 Method->setParams(Params);
1852 Method->setInvalidDecl();
1857 if (!FunctionTemplate || TemplateParams || isFriend) {
1868 if (!IsClassScopeSpecialization)
1877 if (isFriend && Method->getPreviousDecl())
1878 Method->setAccess(Method->getPreviousDecl()->getAccess());
1881 if (FunctionTemplate)
1882 FunctionTemplate->
setAccess(Method->getAccess());
1893 if (FunctionTemplate) {
1897 }
else if (Method->isInvalidDecl() && !Previous.
empty()) {
1901 }
else if (isFriend) {
1912 }
else if (!IsClassScopeSpecialization) {
1936 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
1944 D->
getDepth() - TemplateArgs.getNumLevels(),
1954 if (InstantiatedDefaultArg)
1955 Inst->setDefaultArgument(InstantiatedDefaultArg);
1965 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
1971 bool IsExpandedParameterPack =
false;
1974 bool Invalid =
false;
1989 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
1994 ExpandedParameterPackTypes.push_back(NewT);
1997 IsExpandedParameterPack =
true;
2012 bool RetainExpansion =
false;
2017 Pattern.getSourceRange(),
2020 Expand, RetainExpansion,
2025 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
2033 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2039 ExpandedParameterPackTypes.push_back(NewT);
2045 IsExpandedParameterPack =
true;
2082 if (IsExpandedParameterPack)
2086 D->
getDepth() - TemplateArgs.getNumLevels(),
2090 ExpandedParameterPackTypes.data(),
2091 ExpandedParameterPackTypes.size(),
2092 ExpandedParameterPackTypesAsWritten.data());
2097 D->
getDepth() - TemplateArgs.getNumLevels(),
2104 Param->setInvalidDecl();
2109 Param->setDefaultArgument(Value.
get());
2122 for (
const auto &
P : *Params) {
2123 if (
P->isTemplateParameterPack())
2135 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
2142 bool IsExpandedParameterPack =
false;
2156 ExpandedParams.push_back(Expansion);
2159 IsExpandedParameterPack =
true;
2160 InstParams = TempParams;
2172 bool RetainExpansion =
false;
2178 Expand, RetainExpansion,
2183 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
2189 ExpandedParams.push_back(Expansion);
2195 IsExpandedParameterPack =
true;
2196 InstParams = TempParams;
2218 if (IsExpandedParameterPack)
2221 D->
getDepth() - TemplateArgs.getNumLevels(),
2228 D->
getDepth() - TemplateArgs.getNumLevels(),
2241 Param->setDefaultArgument(
2276 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
2299 bool CheckRedeclaration = Owner->
isRecord();
2311 SS.
Adopt(QualifierLoc);
2312 if (CheckRedeclaration) {
2313 Prev.setHideTags(
false);
2345 for (
auto *Shadow : D->
shadows()) {
2348 Shadow->getLocation(), Shadow->getTargetDecl(), TemplateArgs));
2353 if (CheckRedeclaration) {
2359 Shadow->getLocation(), OldPrev, TemplateArgs));
2367 if (isFunctionScope)
2379 Decl * TemplateDeclInstantiator
2388 SS.
Adopt(QualifierLoc);
2404 Decl * TemplateDeclInstantiator
2412 SS.
Adopt(QualifierLoc);
2429 Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
2444 TemplateArgsPtr = &TemplateArgs;
2456 assert(Specialization &&
"Class scope Specialization is null");
2462 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
2467 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
2468 Vars.push_back(Var);
2488 Decl *TemplateDeclInstantiator::VisitRecordDecl(
RecordDecl *D) {
2489 llvm_unreachable(
"There are only CXXRecordDecls in C++");
2493 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
2500 "can only instantiate an explicit specialization "
2501 "for a member class template");
2511 if (!InstClassTemplate)
2517 castAs<TemplateSpecializationTypeLoc>();
2523 if (SemaRef.
Subst(ArgLocs.data(), ArgLocs.size(),
2524 InstTemplateArgs, TemplateArgs))
2539 void *InsertPos =
nullptr;
2571 diag::note_previous_definition);
2599 TemplateName(InstClassTemplate), Converted.data(), Converted.size(),
2639 assert(VarTemplate &&
2640 "A template specialization without specialized template?");
2648 TemplateArgsInfo.
size(), VarTemplateArgsInfo, TemplateArgs))
2661 void *InsertPos =
nullptr;
2663 Converted, InsertPos))
2668 VarTemplateArgsInfo, Converted);
2679 if (RecordTy->getDecl()->isAnonymousStructOrUnion())
2680 if (!VisitCXXRecordDecl(cast<CXXRecordDecl>(RecordTy->getDecl())))
2691 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
2710 Owner, StartingScope);
2716 llvm_unreachable(
"@defs is not supported in Objective-C++");
2723 "cannot instantiate %0 yet");
2731 llvm_unreachable(
"Unexpected decl");
2740 return Instantiator.
Visit(D);
2752 bool Invalid =
false;
2754 unsigned N = L->
size();
2758 for (
auto &
P : *L) {
2760 Params.push_back(D);
2770 L->getLAngleLoc(), Params,
2810 InstTemplateArgs, TemplateArgs))
2825 void *InsertPos =
nullptr;
2866 SemaRef.
Diag(PartialSpec->
getLocation(), diag::err_partial_spec_redeclared)
2868 SemaRef.
Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
2897 ClassTemplate->AddPartialSpecialization(InstPartialSpec,
2899 return InstPartialSpec;
2937 InstTemplateArgs, TemplateArgs))
2944 InstTemplateArgs,
false, Converted))
2949 void *InsertPos =
nullptr;
2956 TemplateName(VarTemplate), Converted.data(), Converted.size());
2986 diag::err_var_partial_spec_redeclared)
2989 diag::note_var_prev_partial_spec_here);
3002 diag::err_variable_instantiates_to_function)
3013 Converted.size(), InstTemplateArgs);
3024 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
3027 LateAttrs, Owner, StartingScope);
3029 return InstPartialSpec;
3036 assert(OldTInfo &&
"substituting function without type source info");
3037 assert(Params.empty() &&
"parameter vector is non-empty at start");
3040 unsigned ThisTypeQuals = 0;
3042 ThisContext = cast<CXXRecordDecl>(Owner);
3043 ThisTypeQuals = Method->getTypeQualifiers();
3050 ThisContext, ThisTypeQuals);
3056 if (NewTInfo != OldTInfo) {
3060 unsigned NewIdx = 0;
3061 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
3062 OldIdx != NumOldParams; ++OldIdx) {
3063 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
3068 NumArgumentsInExpansion =
3071 if (!NumArgumentsInExpansion) {
3075 Params.push_back(NewParam);
3080 for (
unsigned I = 0;
I != *NumArgumentsInExpansion; ++
I) {
3082 Params.push_back(NewParam);
3092 cast<FunctionProtoType>(OldProtoLoc.getType());
3093 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
3103 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
3106 Params.push_back(Parm);
3137 unsigned FParamIdx = 0;
3142 assert(FParamIdx < Function->getNumParams());
3169 assert(NumArgumentsInExpansion &&
3170 "should only be called when all template arguments are known");
3173 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
3252 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
3253 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
3255 = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
3256 assert(FunTmpl->getTemplatedDecl() == Tmpl &&
3257 "Deduction from the wrong function template?");
3259 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
3260 ActiveInst.Entity = New;
3265 assert(Proto &&
"Function template without prototype?");
3289 assert(NewProto &&
"Template instantiation without function prototype?");
3306 LateAttrs, StartingScope);
3350 bool DefinitionRequired) {
3362 assert(PatternDecl &&
"instantiating a non-template");
3364 Stmt *Pattern = PatternDecl->
getBody(PatternDecl);
3365 assert(PatternDecl &&
"template definition is not a template");
3370 assert(PatternDecl &&
"template definition is not a template");
3376 std::make_pair(Function, PointOfInstantiation));
3386 SavedPendingLocalImplicitInstantiations(*
this);
3388 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
3399 assert(LPT &&
"missing LateParsedTemplate");
3401 Pattern = PatternDecl->
getBody(PatternDecl);
3405 if (DefinitionRequired) {
3407 Diag(PointOfInstantiation,
3408 diag::err_explicit_instantiation_undefined_func_template)
3411 Diag(PointOfInstantiation,
3412 diag::err_explicit_instantiation_undefined_member)
3417 diag::note_explicit_instantiation_here);
3423 std::make_pair(Function, PointOfInstantiation));
3445 D->setImplicitlyInline();
3465 bool MergeWithParentScope =
false;
3467 MergeWithParentScope = Rec->isLocalClass();
3495 dyn_cast<CXXConstructorDecl>(PatternDecl)) {
3512 Listener->FunctionDefinitionInstantiated(Function);
3565 bool IsMemberSpec =
false;
3567 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar))
3568 IsMemberSpec = PartialSpec->isMemberSpecialization();
3570 IsMemberSpec = FromTemplate->isMemberSpecialization();
3580 return cast_or_null<VarTemplateSpecializationDecl>(
3581 Instantiator.VisitVarTemplateSpecializationDecl(
3582 VarTemplate, FromVar, InsertPos, TemplateArgsInfo, Converted));
3615 bool InstantiatingVarTemplate) {
3637 if (OldVar->
isUsed(
false))
3658 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
3663 if (!InstantiatingVarTemplate) {
3678 TSK_ImplicitInstantiation);
3687 if ((!isa<VarTemplateSpecializationDecl>(NewVar) &&
3688 !InstantiatingVarTemplate) ||
3720 bool TypeMayContainAuto =
true;
3723 if (Var->
hasAttr<DLLImportAttr>() &&
3727 }
else if (InitExpr) {
3764 bool DefinitionRequired) {
3766 DefinitionRequired);
3771 bool DefinitionRequired) {
3777 VarDecl *PatternDecl =
nullptr, *Def =
nullptr;
3784 bool InstantiationDependent =
false;
3787 "Only instantiate variable template specializations that are "
3788 "not type-dependent");
3789 (void)InstantiationDependent;
3795 "Specialization without specialized template?");
3811 VarTemplateDecl *Tmpl = PatternPtr.get<VarTemplateDecl *>();
3812 while (VarTemplateDecl *From =
3825 if (PatternDecl->isStaticDataMember() &&
3826 (PatternDecl = PatternDecl->getFirstDecl())->hasInit() &&
3838 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
3846 PreviousContext.pop();
3877 assert(PatternDecl &&
"data member was not instantiated from a template?");
3878 assert(PatternDecl->isStaticDataMember() &&
"not a static data member?");
3879 Def = PatternDecl->getOutOfLineDefinition();
3887 if (DefinitionRequired) {
3889 Diag(PointOfInstantiation,
3890 diag::err_explicit_instantiation_undefined_var_template) << Var;
3892 Diag(PointOfInstantiation,
3893 diag::err_explicit_instantiation_undefined_member)
3895 Diag(PatternDecl->getLocation(),
3896 diag::note_explicit_instantiation_here);
3902 std::make_pair(Var, PointOfInstantiation));
3922 struct PassToConsumerRAII {
3929 ~PassToConsumerRAII() {
3932 } PassToConsumerRAII(
Consumer, Var);
3939 PointOfInstantiation);
3951 SavedPendingLocalImplicitInstantiations(*
this);
3953 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
3971 Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
3980 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
3984 LookupResult R(*
this, Var->getDeclName(), Var->getLocation(),
3997 PreviousContext.pop();
4000 PassToConsumerRAII.Var = Var;
4033 for (
const auto *Init : Tmpl->
inits()) {
4036 if (!Init->isWritten())
4041 if (Init->isPackExpansion()) {
4043 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
4047 bool ShouldExpand =
false;
4048 bool RetainExpansion =
false;
4053 TemplateArgs, ShouldExpand,
4060 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
4063 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
4077 Init->getSourceLocation(),
4086 BaseTInfo, TempInit.
get(),
4094 NewInits.push_back(NewInit.
get());
4109 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
4112 Init->getSourceLocation(),
4120 if (Init->isBaseInitializer())
4126 }
else if (Init->isMemberInitializer()) {
4128 Init->getMemberLocation(),
4138 Init->getSourceLocation());
4139 }
else if (Init->isIndirectMemberInitializer()) {
4142 Init->getMemberLocation(),
4143 Init->getIndirectMember(), TemplateArgs));
4145 if (!IndirectMember) {
4152 Init->getSourceLocation());
4159 NewInits.push_back(NewInit.
get());
4179 if (Pattern == Instance)
return true;
4192 if (Pattern == Instance)
return true;
4203 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
4205 Instance = cast<ClassTemplatePartialSpecializationDecl>(
4207 if (Pattern == Instance)
4221 if (Pattern == Instance)
return true;
4234 if (Pattern == Instance)
return true;
4247 if (Pattern == Instance)
return true;
4287 if (Pattern == Instance)
return true;
4299 = dyn_cast<UnresolvedUsingTypenameDecl>(D)) {
4300 if (
UsingDecl *UD = dyn_cast<UsingDecl>(Other)) {
4306 = dyn_cast<UnresolvedUsingValueDecl>(D)) {
4307 if (
UsingDecl *UD = dyn_cast<UsingDecl>(Other)) {
4318 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
4321 if (
EnumDecl *Enum = dyn_cast<EnumDecl>(Other))
4324 if (
VarDecl *Var = dyn_cast<VarDecl>(Other))
4335 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Other))
4339 if (
FieldDecl *Field = dyn_cast<FieldDecl>(Other)) {
4343 cast<FieldDecl>(D));
4347 if (
UsingDecl *Using = dyn_cast<UsingDecl>(Other))
4353 return D->
getDeclName() && isa<NamedDecl>(Other) &&
4354 D->
getDeclName() == cast<NamedDecl>(Other)->getDeclName();
4357 template<
typename ForwardIterator>
4360 ForwardIterator first,
4361 ForwardIterator last) {
4362 for (; first != last; ++first)
4364 return cast<NamedDecl>(*first);
4375 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
4377 return cast_or_null<DeclContext>(
ID);
4427 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
4429 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
4430 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
4432 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda())) {
4437 if (Decl *FD = Found->dyn_cast<Decl *>())
4438 return cast<NamedDecl>(FD);
4441 assert(PackIdx != -1 &&
4442 "found declaration pack but not pack expanding");
4444 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
4451 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
4452 isa<TemplateTemplateParmDecl>(D))
4471 bool NeedInstantiate =
false;
4473 NeedInstantiate = RD->isLocalClass();
4475 NeedInstantiate = isa<EnumDecl>(D);
4476 if (NeedInstantiate) {
4479 return cast<TypeDecl>(Inst);
4484 assert(isa<LabelDecl>(D));
4487 assert(Inst &&
"Failed to instantiate label??");
4490 return cast<LabelDecl>(Inst);
4496 dyn_cast<VarTemplateSpecializationDecl>(D)) {
4497 bool InstantiationDependent =
false;
4499 VarSpec->getTemplateArgsInfo();
4501 VarTemplateArgs, InstantiationDependent))
4502 D = cast<NamedDecl>(
4517 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Record))
4529 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
4533 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
4573 bool IsBeingInstantiated =
false;
4574 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
4575 if (!Spec->isDependentContext()) {
4578 assert(Tag &&
"type of non-dependent record is not a RecordType");
4580 IsBeingInstantiated =
true;
4608 if (isa<UsingShadowDecl>(D)) {
4614 }
else if (IsBeingInstantiated) {
4620 Diag(Loc, diag::err_member_not_yet_instantiated)
4628 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
4631 assert(Spec->getTemplateSpecializationKind() ==
4633 Diag(Loc, diag::err_enumerator_does_not_exist)
4636 Diag(Spec->getLocation(), diag::note_enum_specialized_here)
4640 llvm_unreachable(
"Unable to find instantiation of declaration!");
4666 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
4668 "instantiating function definition");
4669 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
4672 DefinitionRequired);
4677 VarDecl *Var = cast<VarDecl>(Inst.first);
4680 isa<VarTemplateSpecializationDecl>(Var)) &&
4681 "Not a static data member, nor a variable template"
4682 " specialization?");
4693 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
4701 case TSK_ImplicitInstantiation:
4706 "instantiating variable definition");
4713 DefinitionRequired);
4719 for (
auto DD : Pattern->
ddiags()) {
4720 switch (DD->getKind()) {
Defines the clang::ASTContext interface.
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...
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.
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 InstantiatedLocal(const Decl *D, Decl *Inst)
LateTemplateParserCB * LateTemplateParser
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.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
LateParsedTemplateMapT LateParsedTemplateMap
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.
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.
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
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
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.
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
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...
The current expression is potentially evaluated at run time, which means that code may be generated t...
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)
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsExplicitSpecialization)
Perform semantic checking of a new function declaration.
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)
chain_range chain() const
TypeLoc getPatternLoc() const
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed...
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
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)
bool hasErrorOccurred() const
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, bool AllowFunctionParameters)
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, const TemplateArgument *Args, unsigned NumArgs, ClassTemplateSpecializationDecl *PrevDecl)
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.
Represents a C++ constructor within a class.
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
InClassInitStyle getInClassInitStyle() const
getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has...
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
void setInstantiatedFromUsingDecl(UsingDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
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)
virtual void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, LateParsedTemplate * > &LPTMap)
Read the set of late parsed template functions for this source.
RAII object that enters a new expression evaluation context.
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
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)
DiagnosticsEngine & Diags
bool SubstQualifier(const DeclaratorDecl *OldDecl, DeclaratorDecl *NewDecl)
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
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)
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.
void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto)
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
unsigned getStaticLocalNumber(const VarDecl *VD) const
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Base wrapper for a particular "section" of type source info.
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
RecordDecl - Represents a struct/union/class.
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)
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
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.
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)
bool isPure() const
Whether this virtual function is pure, i.e.
void startDefinition()
Starts the definition of this tag declaration.
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
ParmVarDecl * getParam(unsigned i) const
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)
void Exit()
Exit this local instantiation scope early.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
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...
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
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.
void PopExpressionEvaluationContext()
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 TemplateArgumentList * CreateCopy(ASTContext &Context, const TemplateArgument *Args, unsigned NumArgs)
Create a new template argument list that copies the given set of template arguments.
Represents the results of name lookup.
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.
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.
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...
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
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
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, AttributeList *AttrList, bool IsInstantiation, bool HasTypenameKeyword, SourceLocation TypenameLoc)
Builds a using declaration.
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 getRBraceLoc() const
SourceLocation getRAngleLoc() const
void DiagnoseUnusedDecl(const NamedDecl *ND)
DiagnoseUnusedDecl - Emit warnings about declarations that are not used unless they are marked attr(u...
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)
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)
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted)
Check that the given template arguments can be be provided to the given template, converting the argu...
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
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.
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.
param_iterator param_begin()
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.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
QualType getTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon=QualType()) const
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.
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit, bool TypeMayContainAuto)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
static void instantiateDependentEnableIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const EnableIfAttr *A, const Decl *Tmpl, Decl *New)
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.
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.
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.
ID
Defines the set of possible language-specific address spaces.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
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)
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.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
const Type * getTypeForDecl() const
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(NamedDecl *D, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
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)
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
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)
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, ClassTemplateDecl *PrevDecl)
Create a class template node.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Expr * getBitWidth() 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.
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
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
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
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 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.
ASTMutationListener * getASTMutationListener() const
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...
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, const TemplateArgument *Args, unsigned NumArgs, const TemplateArgumentListInfo &ArgInfos, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
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.
SmallVector< ActiveTemplateInstantiation, 16 > ActiveTemplateInstantiations
List of active template instantiations.
void setLocation(SourceLocation L)
NamedDecl * getInstantiatedFromUsingDecl(UsingDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
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.
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
TypeSourceInfo * getTypeSourceInfo() const
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.
const Expr * getAnyInitializer() const
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached...
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)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
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
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, 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...
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.
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...
Encodes a location in the source.
enumerator_range enumerators() const
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.
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
const TemplateArgumentListInfo & getTemplateArgsInfo() 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)
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.
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)
QualType CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
Decl * VisitDecl(Decl *D)
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...
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
SourceLocation getLAngleLoc() const
Decl * VisitVarDecl(VarDecl *D, bool InstantiatingVarTemplate)
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.
const IdentifierInfo * getIdentifier() const
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.
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
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.
void setLAngleLoc(SourceLocation Loc)
QualType getType() const
Return the type wrapped by this type source info.
unsigned getManglingNumber(const NamedDecl *ND) const
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
void setVirtualAsWritten(bool V)
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a pack expansion of types.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
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.
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. ...
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
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...
bool SubstParmTypes(SourceLocation Loc, ParmVarDecl **Params, unsigned NumParams, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams=nullptr)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
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.
A template instantiation that is currently in progress.
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
SourceLocation getEllipsisLoc() const
void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, SourceLocation RBraceLoc, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, AttributeList *Attr)
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
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)
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.
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.
bool isUsed(bool CheckUsedAttr=true) const
Whether this declaration was used, meaning that a definition is required.
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition - Returns whether this specific declaration of the function is also a de...
SourceLocation getLocStart() const LLVM_READONLY
EnumDecl - Represents an enum.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
detail::InMemoryDirectory::const_iterator E
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void setPreviousDeclInSameBlockScope(bool Same)
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
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 InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false)
Instantiate the definition of the given function from its template.
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.
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs, const TemplateArgumentListInfo &ArgInfos)
bool empty() const
Return true if no decls were found.
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)
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs)
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.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
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.
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.
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.
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...
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.
static bool isInvalid(SourceLocation Loc, bool *Invalid)
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)
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...
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
A template argument list.
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
Call-style initialization (C++98)
Represents a field declaration created by an @defs(...).
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.
Represents a C++ struct/union/class.
void setTSCSpec(ThreadStorageClassSpecifier TSC)
void MergeVarDecl(VarDecl *New, LookupResult &Previous)
MergeVarDecl - We just parsed a variable 'New' which has the same name and scope as a previous declar...
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...
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
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.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
static bool anyDependentTemplateArguments(const TemplateArgumentLoc *Args, unsigned NumArgs, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
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...
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs)
Find the instantiation of the given declaration within the current instantiation. ...
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads, Expr *MinBlocks, unsigned SpellingListIndex)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration. ...
void setUnsupportedFriend(bool Unsupported)
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
Declaration of a class template.
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)
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, NamedDecl **CH, unsigned CHS)
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.
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.
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
virtual bool HandleTopLevelDecl(DeclGroupRef D)
HandleTopLevelDecl - Handle the specified top-level declaration.
Contains a late templated function.
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false)
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.
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.
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.
void setNRVOVariable(bool NRVO)
NamespaceDecl * getStdNamespace() const
void setType(QualType newType)
const TemplateArgument & getArgument() const
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.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity)
Perform substitution on the type T with a given set of template arguments.
DeclarationNameInfo getNameInfo() const
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
unsigned getNumTemplateParameterLists() const
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)