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) {
556 bool Invalid =
false;
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");
820 if (Def && Def != D) {
827 SemaRef.
SubstType(TI->getType(), TemplateArgs,
830 DefnUnderlying, Enum);
862 if (
Expr *UninstValue = EC->getInitExpr()) {
867 Value = SemaRef.
SubstExpr(UninstValue, TemplateArgs);
893 Enumerators.push_back(EnumConst);
894 LastEnumConst = EnumConst;
913 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
945 if (!Found.
empty()) {
947 if (PrevClassTemplate)
960 SS.
Adopt(QualifierLoc);
962 if (!DC)
return nullptr;
975 if (R.isSingleResult()) {
977 if (PrevClassTemplate)
981 if (!PrevClassTemplate && QualifierLoc) {
988 bool AdoptedPreviousTemplateParams =
false;
989 if (PrevClassTemplate) {
990 bool Complain =
true;
1001 cast<NamespaceDecl>(DC)->getIdentifier() &&
1002 cast<NamespaceDecl>(DC)->getIdentifier()->isStr(
"__detail")) {
1005 cast<NamespaceDecl>(DCParent)->getIdentifier() &&
1006 cast<NamespaceDecl>(DCParent)->getIdentifier()->isStr(
"tr1")) {
1007 if (cast<Decl>(DCParent)->isInStdNamespace())
1022 AdoptedPreviousTemplateParams =
true;
1023 InstParams = PrevParams;
1028 if (!AdoptedPreviousTemplateParams &&
1048 RecordInst->setDescribedClassTemplate(Inst);
1051 if (PrevClassTemplate)
1061 if (!PrevClassTemplate)
1073 RecordInst->setLexicalDeclContext(Owner);
1084 if (!PrevClassTemplate) {
1090 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1091 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1092 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[I]));
1099 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
1112 if (!InstClassTemplate)
1124 "Only static data member templates are allowed.");
1140 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
1156 if (!PrevVarTemplate)
1166 if (!PrevVarTemplate) {
1172 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1173 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1174 OutOfLineVarPartialSpecs.push_back(
1175 std::make_pair(Inst, PartialSpecs[I]));
1181 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
1184 "Only static data member templates are allowed.");
1190 assert(!Found.
empty() &&
"Instantiation found nothing?");
1193 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
1196 InstVarTemplate->findPartialSpecInstantiatedFromMember(D))
1230 = Instantiated->getDescribedFunctionTemplate();
1232 assert(InstTemplate &&
1233 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
1251 return InstTemplate;
1257 PrevDecl = cast<CXXRecordDecl>(Owner);
1262 if (!Prev)
return nullptr;
1263 PrevDecl = cast<CXXRecordDecl>(Prev);
1306 SavedPendingLocalImplicitInstantiations(SemaRef);
1338 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
1344 NewFunc->getParamTypes(), NewEPI);
1356 if (FunctionTemplate && !TemplateParams) {
1359 void *InsertPos =
nullptr;
1369 if (FunctionTemplate)
1374 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1376 !(isa<Decl>(Owner) &&
1377 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1401 }
else if (isFriend && QualifierLoc) {
1403 SS.
Adopt(QualifierLoc);
1405 if (!DC)
return nullptr;
1437 for (
unsigned P = 0;
P < Params.size(); ++
P)
1439 Params[
P]->setOwningFunction(Function);
1440 Function->setParams(Params);
1443 if (TemplateParams) {
1461 TemplateParams, Function);
1472 }
else if (FunctionTemplate) {
1475 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1480 }
else if (isFriend) {
1487 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1493 bool isExplicitSpecialization =
false;
1503 assert(isFriend &&
"non-friend has dependent specialization info?");
1510 Info->getRAngleLoc());
1511 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
1512 ExplicitArgs, TemplateArgs))
1516 for (
unsigned I = 0, E = Info->getNumTemplates(); I != E; ++I) {
1518 Info->getTemplate(I),
1520 if (!Temp)
return nullptr;
1522 Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
1530 isExplicitSpecialization =
true;
1532 }
else if (TemplateParams || !FunctionTemplate) {
1547 isExplicitSpecialization);
1549 NamedDecl *PrincipalDecl = (TemplateParams
1550 ? cast<NamedDecl>(FunctionTemplate)
1559 bool QueuedInstantiation =
false;
1574 SemaRef.
Diag(Definition->
getLocation(), diag::note_previous_definition);
1578 else for (
auto R : Function->
redecls()) {
1584 if (!QueuedInstantiation && R->isUsed(
false)) {
1587 if (MSInfo->getPointOfInstantiation().isInvalid()) {
1589 MSInfo->setPointOfInstantiation(Loc);
1591 std::make_pair(Function, Loc));
1592 QueuedInstantiation =
true;
1599 if (R->getFriendObjectKind()) {
1602 if (RPattern->isDefined(RPattern)) {
1605 SemaRef.
Diag(R->getLocation(), diag::note_previous_definition);
1621 assert(!D->
isDefaulted() &&
"only methods should be defaulted");
1628 bool IsClassScopeSpecialization) {
1630 if (FunctionTemplate && !TemplateParams) {
1636 void *InsertPos =
nullptr;
1646 if (FunctionTemplate)
1651 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1652 !(isa<Decl>(Owner) &&
1653 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1658 unsigned NumTempParamLists = 0;
1660 TempParamLists.set_size(NumTempParamLists);
1661 for (
unsigned I = 0; I != NumTempParamLists; ++I) {
1666 TempParamLists[I] = InstParams;
1688 SS.
Adopt(QualifierLoc);
1698 if (!DC)
return nullptr;
1710 StartLoc, NameInfo, T, TInfo,
1711 Constructor->isExplicit(),
1712 Constructor->isInlineSpecified(),
1713 false, Constructor->isConstexpr());
1718 Constructor->getInheritedConstructor())) {
1722 if (FunctionTemplate) {
1723 assert(!TemplateParams && Inh->getDescribedFunctionTemplate() &&
1724 !Inh->getParent()->isDependentContext() &&
1725 "inheriting constructor template in dependent context?");
1728 if (Inst.isInvalid())
1737 Inh = cast_or_null<CXXConstructorDecl>(
1738 SemaRef.
SubstDecl(Inh, Inh->getDeclContext(), InheritedArgs));
1742 cast<CXXConstructorDecl>(Method)->setInheritedConstructor(Inh);
1746 StartLoc, NameInfo, T, TInfo,
1747 Destructor->isInlineSpecified(),
1751 StartLoc, NameInfo, T, TInfo,
1752 Conversion->isInlineSpecified(),
1753 Conversion->isExplicit(),
1754 Conversion->isConstexpr(),
1755 Conversion->getLocEnd());
1759 StartLoc, NameInfo, T, TInfo,
1768 Method->setQualifierInfo(QualifierLoc);
1770 if (TemplateParams) {
1786 Method->getDeclName(),
1787 TemplateParams, Method);
1793 Method->setDescribedFunctionTemplate(FunctionTemplate);
1794 }
else if (FunctionTemplate) {
1797 Method->setFunctionTemplateSpecialization(FunctionTemplate,
1802 }
else if (!isFriend) {
1804 Method->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1811 if (NumTempParamLists)
1812 Method->setTemplateParameterListsInfo(SemaRef.
Context,
1814 TempParamLists.data());
1816 Method->setLexicalDeclContext(Owner);
1817 Method->setObjectOfFriendDecl();
1822 for (
unsigned P = 0;
P < Params.size(); ++
P)
1823 Params[
P]->setOwningFunction(Method);
1824 Method->setParams(Params);
1827 Method->setInvalidDecl();
1832 if (!FunctionTemplate || TemplateParams || isFriend) {
1843 if (!IsClassScopeSpecialization)
1852 if (isFriend && Method->getPreviousDecl())
1853 Method->setAccess(Method->getPreviousDecl()->getAccess());
1856 if (FunctionTemplate)
1857 FunctionTemplate->
setAccess(Method->getAccess());
1868 if (FunctionTemplate) {
1872 }
else if (Method->isInvalidDecl() && !Previous.
empty()) {
1876 }
else if (isFriend) {
1887 }
else if (!IsClassScopeSpecialization) {
1911 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
1919 D->
getDepth() - TemplateArgs.getNumLevels(),
1929 if (InstantiatedDefaultArg)
1930 Inst->setDefaultArgument(InstantiatedDefaultArg);
1940 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
1946 bool IsExpandedParameterPack =
false;
1949 bool Invalid =
false;
1964 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
1969 ExpandedParameterPackTypes.push_back(NewT);
1972 IsExpandedParameterPack =
true;
1987 bool RetainExpansion =
false;
1992 Pattern.getSourceRange(),
1995 Expand, RetainExpansion,
2000 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2008 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2014 ExpandedParameterPackTypes.push_back(NewT);
2020 IsExpandedParameterPack =
true;
2057 if (IsExpandedParameterPack)
2061 D->
getDepth() - TemplateArgs.getNumLevels(),
2065 ExpandedParameterPackTypes.data(),
2066 ExpandedParameterPackTypes.size(),
2067 ExpandedParameterPackTypesAsWritten.data());
2072 D->
getDepth() - TemplateArgs.getNumLevels(),
2079 Param->setInvalidDecl();
2084 Param->setDefaultArgument(Value.
get());
2097 for (
const auto &
P : *Params) {
2098 if (
P->isTemplateParameterPack())
2110 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
2117 bool IsExpandedParameterPack =
false;
2131 ExpandedParams.push_back(Expansion);
2134 IsExpandedParameterPack =
true;
2135 InstParams = TempParams;
2147 bool RetainExpansion =
false;
2153 Expand, RetainExpansion,
2158 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2164 ExpandedParams.push_back(Expansion);
2170 IsExpandedParameterPack =
true;
2171 InstParams = TempParams;
2193 if (IsExpandedParameterPack)
2196 D->
getDepth() - TemplateArgs.getNumLevels(),
2203 D->
getDepth() - TemplateArgs.getNumLevels(),
2216 Param->setDefaultArgument(
2251 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
2274 bool CheckRedeclaration = Owner->
isRecord();
2286 SS.
Adopt(QualifierLoc);
2287 if (CheckRedeclaration) {
2288 Prev.setHideTags(
false);
2320 for (
auto *Shadow : D->
shadows()) {
2323 Shadow->getLocation(), Shadow->getTargetDecl(), TemplateArgs));
2328 if (CheckRedeclaration) {
2334 Shadow->getLocation(), OldPrev, TemplateArgs));
2342 if (isFunctionScope)
2354 Decl * TemplateDeclInstantiator
2363 SS.
Adopt(QualifierLoc);
2379 Decl * TemplateDeclInstantiator
2387 SS.
Adopt(QualifierLoc);
2404 Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
2419 TemplateArgsPtr = &TemplateArgs;
2431 assert(Specialization &&
"Class scope Specialization is null");
2437 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
2442 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
2443 Vars.push_back(Var);
2463 Decl *TemplateDeclInstantiator::VisitRecordDecl(
RecordDecl *D) {
2464 llvm_unreachable(
"There are only CXXRecordDecls in C++");
2468 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
2475 "can only instantiate an explicit specialization "
2476 "for a member class template");
2486 if (!InstClassTemplate)
2492 castAs<TemplateSpecializationTypeLoc>();
2496 for (
unsigned I = 0; I != Loc.
getNumArgs(); ++I)
2498 if (SemaRef.
Subst(ArgLocs.data(), ArgLocs.size(),
2499 InstTemplateArgs, TemplateArgs))
2514 void *InsertPos =
nullptr;
2546 diag::note_previous_definition);
2574 TemplateName(InstClassTemplate), Converted.data(), Converted.size(),
2614 assert(VarTemplate &&
2615 "A template specialization without specialized template?");
2623 TemplateArgsInfo.
size(), VarTemplateArgsInfo, TemplateArgs))
2636 void *InsertPos =
nullptr;
2638 Converted, InsertPos))
2643 VarTemplateArgsInfo, Converted);
2654 if (RecordTy->getDecl()->isAnonymousStructOrUnion())
2655 if (!VisitCXXRecordDecl(cast<CXXRecordDecl>(RecordTy->getDecl())))
2666 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
2685 Owner, StartingScope);
2691 llvm_unreachable(
"@defs is not supported in Objective-C++");
2698 "cannot instantiate %0 yet");
2706 llvm_unreachable(
"Unexpected decl");
2715 return Instantiator.
Visit(D);
2727 bool Invalid =
false;
2729 unsigned N = L->
size();
2733 for (
auto &
P : *L) {
2735 Params.push_back(D);
2745 L->getLAngleLoc(), &Params.front(), N,
2785 InstTemplateArgs, TemplateArgs))
2800 void *InsertPos =
nullptr;
2841 SemaRef.
Diag(PartialSpec->
getLocation(), diag::err_partial_spec_redeclared)
2843 SemaRef.
Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
2872 ClassTemplate->AddPartialSpecialization(InstPartialSpec,
2874 return InstPartialSpec;
2912 InstTemplateArgs, TemplateArgs))
2919 InstTemplateArgs,
false, Converted))
2924 void *InsertPos =
nullptr;
2931 TemplateName(VarTemplate), Converted.data(), Converted.size());
2961 diag::err_var_partial_spec_redeclared)
2964 diag::note_var_prev_partial_spec_here);
2977 diag::err_variable_instantiates_to_function)
2988 Converted.size(), InstTemplateArgs);
2999 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
3002 LateAttrs, Owner, StartingScope);
3004 return InstPartialSpec;
3011 assert(OldTInfo &&
"substituting function without type source info");
3012 assert(Params.empty() &&
"parameter vector is non-empty at start");
3015 unsigned ThisTypeQuals = 0;
3017 ThisContext = cast<CXXRecordDecl>(Owner);
3018 ThisTypeQuals = Method->getTypeQualifiers();
3025 ThisContext, ThisTypeQuals);
3031 if (NewTInfo != OldTInfo) {
3035 unsigned NewIdx = 0;
3036 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
3037 OldIdx != NumOldParams; ++OldIdx) {
3038 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
3043 NumArgumentsInExpansion =
3046 if (!NumArgumentsInExpansion) {
3050 Params.push_back(NewParam);
3055 for (
unsigned I = 0; I != *NumArgumentsInExpansion; ++I) {
3057 Params.push_back(NewParam);
3067 cast<FunctionProtoType>(OldProtoLoc.getType());
3068 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
3078 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
3081 Params.push_back(Parm);
3112 unsigned FParamIdx = 0;
3113 for (
unsigned I = 0, N = PatternDecl->
getNumParams(); I != N; ++I) {
3117 assert(FParamIdx < Function->getNumParams());
3144 assert(NumArgumentsInExpansion &&
3145 "should only be called when all template arguments are known");
3148 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
3227 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
3228 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
3230 = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
3231 assert(FunTmpl->getTemplatedDecl() == Tmpl &&
3232 "Deduction from the wrong function template?");
3234 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
3235 ActiveInst.Entity = New;
3240 assert(Proto &&
"Function template without prototype?");
3249 bool RequireInstantiation =
false;
3251 if (Cls->isLocalClass())
3252 RequireInstantiation =
true;
3258 !RequireInstantiation) {
3269 assert(NewProto &&
"Template instantiation without function prototype?");
3286 LateAttrs, StartingScope);
3330 bool DefinitionRequired) {
3342 assert(PatternDecl &&
"instantiating a non-template");
3344 Stmt *Pattern = PatternDecl->
getBody(PatternDecl);
3345 assert(PatternDecl &&
"template definition is not a template");
3350 assert(PatternDecl &&
"template definition is not a template");
3356 std::make_pair(Function, PointOfInstantiation));
3366 SavedPendingLocalImplicitInstantiations(*
this);
3368 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
3379 assert(LPT &&
"missing LateParsedTemplate");
3381 Pattern = PatternDecl->
getBody(PatternDecl);
3385 if (DefinitionRequired) {
3387 Diag(PointOfInstantiation,
3388 diag::err_explicit_instantiation_undefined_func_template)
3391 Diag(PointOfInstantiation,
3392 diag::err_explicit_instantiation_undefined_member)
3397 diag::note_explicit_instantiation_here);
3403 std::make_pair(Function, PointOfInstantiation));
3425 D->setImplicitlyInline();
3445 bool MergeWithParentScope =
false;
3447 MergeWithParentScope = Rec->isLocalClass();
3475 dyn_cast<CXXConstructorDecl>(PatternDecl)) {
3492 Listener->FunctionDefinitionInstantiated(Function);
3545 bool IsMemberSpec =
false;
3547 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar))
3548 IsMemberSpec = PartialSpec->isMemberSpecialization();
3550 IsMemberSpec = FromTemplate->isMemberSpecialization();
3560 return cast_or_null<VarTemplateSpecializationDecl>(
3561 Instantiator.VisitVarTemplateSpecializationDecl(
3562 VarTemplate, FromVar, InsertPos, TemplateArgsInfo, Converted));
3595 bool InstantiatingVarTemplate) {
3617 if (OldVar->
isUsed(
false))
3626 TagDecl *OldTag = OldTagType->getDecl();
3651 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
3656 if (!InstantiatingVarTemplate) {
3671 TSK_ImplicitInstantiation);
3680 if ((!isa<VarTemplateSpecializationDecl>(NewVar) &&
3681 !InstantiatingVarTemplate) ||
3713 bool TypeMayContainAuto =
true;
3716 if (Var->
hasAttr<DLLImportAttr>() &&
3720 }
else if (InitExpr) {
3757 bool DefinitionRequired) {
3759 DefinitionRequired);
3764 bool DefinitionRequired) {
3770 VarDecl *PatternDecl =
nullptr, *Def =
nullptr;
3777 bool InstantiationDependent =
false;
3780 "Only instantiate variable template specializations that are "
3781 "not type-dependent");
3782 (void)InstantiationDependent;
3788 "Specialization without specialized template?");
3804 VarTemplateDecl *Tmpl = PatternPtr.get<VarTemplateDecl *>();
3805 while (VarTemplateDecl *From =
3818 if (PatternDecl->isStaticDataMember() &&
3819 (PatternDecl = PatternDecl->getFirstDecl())->hasInit() &&
3831 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
3839 PreviousContext.pop();
3870 assert(PatternDecl &&
"data member was not instantiated from a template?");
3871 assert(PatternDecl->isStaticDataMember() &&
"not a static data member?");
3872 Def = PatternDecl->getOutOfLineDefinition();
3880 if (DefinitionRequired) {
3882 Diag(PointOfInstantiation,
3883 diag::err_explicit_instantiation_undefined_var_template) << Var;
3885 Diag(PointOfInstantiation,
3886 diag::err_explicit_instantiation_undefined_member)
3888 Diag(PatternDecl->getLocation(),
3889 diag::note_explicit_instantiation_here);
3895 std::make_pair(Var, PointOfInstantiation));
3915 struct PassToConsumerRAII {
3922 ~PassToConsumerRAII() {
3925 } PassToConsumerRAII(
Consumer, Var);
3932 PointOfInstantiation);
3944 SavedPendingLocalImplicitInstantiations(*
this);
3946 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
3964 Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
3973 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
3977 LookupResult R(*
this, Var->getDeclName(), Var->getLocation(),
3990 PreviousContext.pop();
3993 PassToConsumerRAII.Var = Var;
4026 for (
const auto *Init : Tmpl->
inits()) {
4029 if (!Init->isWritten())
4034 if (Init->isPackExpansion()) {
4036 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
4040 bool ShouldExpand =
false;
4041 bool RetainExpansion =
false;
4046 TemplateArgs, ShouldExpand,
4053 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
4056 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4070 Init->getSourceLocation(),
4079 BaseTInfo, TempInit.
get(),
4087 NewInits.push_back(NewInit.
get());
4102 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
4105 Init->getSourceLocation(),
4113 if (Init->isBaseInitializer())
4119 }
else if (Init->isMemberInitializer()) {
4121 Init->getMemberLocation(),
4131 Init->getSourceLocation());
4132 }
else if (Init->isIndirectMemberInitializer()) {
4135 Init->getMemberLocation(),
4136 Init->getIndirectMember(), TemplateArgs));
4138 if (!IndirectMember) {
4145 Init->getSourceLocation());
4152 NewInits.push_back(NewInit.
get());
4172 if (Pattern == Instance)
return true;
4185 if (Pattern == Instance)
return true;
4196 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
4198 Instance = cast<ClassTemplatePartialSpecializationDecl>(
4200 if (Pattern == Instance)
4214 if (Pattern == Instance)
return true;
4227 if (Pattern == Instance)
return true;
4240 if (Pattern == Instance)
return true;
4280 if (Pattern == Instance)
return true;
4292 = dyn_cast<UnresolvedUsingTypenameDecl>(D)) {
4293 if (
UsingDecl *UD = dyn_cast<UsingDecl>(Other)) {
4299 = dyn_cast<UnresolvedUsingValueDecl>(D)) {
4300 if (
UsingDecl *UD = dyn_cast<UsingDecl>(Other)) {
4311 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
4314 if (
EnumDecl *Enum = dyn_cast<EnumDecl>(Other))
4317 if (
VarDecl *Var = dyn_cast<VarDecl>(Other))
4328 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Other))
4332 if (
FieldDecl *Field = dyn_cast<FieldDecl>(Other)) {
4336 cast<FieldDecl>(D));
4340 if (
UsingDecl *Using = dyn_cast<UsingDecl>(Other))
4346 return D->
getDeclName() && isa<NamedDecl>(Other) &&
4347 D->
getDeclName() == cast<NamedDecl>(Other)->getDeclName();
4350 template<
typename ForwardIterator>
4353 ForwardIterator first,
4354 ForwardIterator last) {
4355 for (; first != last; ++first)
4357 return cast<NamedDecl>(*first);
4368 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
4370 return cast_or_null<DeclContext>(
ID);
4420 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
4422 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
4423 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
4425 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda())) {
4430 if (Decl *FD = Found->dyn_cast<Decl *>())
4431 return cast<NamedDecl>(FD);
4434 assert(PackIdx != -1 &&
4435 "found declaration pack but not pack expanding");
4437 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
4444 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
4445 isa<TemplateTemplateParmDecl>(D))
4464 bool NeedInstantiate =
false;
4466 NeedInstantiate = RD->isLocalClass();
4468 NeedInstantiate = isa<EnumDecl>(D);
4469 if (NeedInstantiate) {
4472 return cast<TypeDecl>(Inst);
4477 assert(isa<LabelDecl>(D));
4480 assert(Inst &&
"Failed to instantiate label??");
4483 return cast<LabelDecl>(Inst);
4489 dyn_cast<VarTemplateSpecializationDecl>(D)) {
4490 bool InstantiationDependent =
false;
4492 VarSpec->getTemplateArgsInfo();
4494 VarTemplateArgs, InstantiationDependent))
4495 D = cast<NamedDecl>(
4510 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Record))
4522 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
4526 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
4566 bool IsBeingInstantiated =
false;
4567 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
4568 if (!Spec->isDependentContext()) {
4571 assert(Tag &&
"type of non-dependent record is not a RecordType");
4573 IsBeingInstantiated =
true;
4601 if (isa<UsingShadowDecl>(D)) {
4607 }
else if (IsBeingInstantiated) {
4613 Diag(Loc, diag::err_member_not_yet_instantiated)
4621 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
4624 assert(Spec->getTemplateSpecializationKind() ==
4626 Diag(Loc, diag::err_enumerator_does_not_exist)
4629 Diag(Spec->getLocation(), diag::note_enum_specialized_here)
4633 llvm_unreachable(
"Unable to find instantiation of declaration!");
4659 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
4661 "instantiating function definition");
4662 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
4665 DefinitionRequired);
4670 VarDecl *Var = cast<VarDecl>(Inst.first);
4673 isa<VarTemplateSpecializationDecl>(Var)) &&
4674 "Not a static data member, nor a variable template"
4675 " specialization?");
4686 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
4694 case TSK_ImplicitInstantiation:
4699 "instantiating variable definition");
4706 DefinitionRequired);
4712 for (
auto DD : Pattern->
ddiags()) {
4713 switch (DD->getKind()) {
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
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)
ExprResult PerformContextuallyConvertToBool(Expr *From)
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
no exception specification
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...
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)
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...
IdentifierInfo * getIdentifier() const
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. If PrevDecl is NULL, set this as the first and only 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...
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
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
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
void setRangeEnd(SourceLocation E)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, NamedDecl **Params, unsigned NumParams, SourceLocation RAngleLoc)
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
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)
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)
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
void InstantiatedLocalPackArg(const Decl *D, Decl *Inst)
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.
ExtProtoInfo - Extra information about a function prototype.
AccessSpecifier getAccess() const
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, unsigned ThisTypeQuals)
Declaration context for names declared as extern "C" in C++. This is neither the semantic nor lexical...
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>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
static void instantiateDependentCUDALaunchBoundsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const CUDALaunchBoundsAttr &Attr, Decl *New)
Stores a list of template parameters for a TemplateDecl and its derived classes.
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.
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.
void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto)
TypeSourceInfo * getFriendType() const
unsigned getStaticLocalNumber(const VarDecl *VD) const
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Base wrapper for a particular "section" of type source info.
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
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. This is either a single result (with no stable stora...
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...
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
bool isCompleteDefinition() const
bool isReferenced() const
Whether any declaration of this entity was referenced.
Decl * VisitVarTemplateSpecializationDecl(VarTemplateDecl *VarTemplate, VarDecl *FromVar, void *InsertPos, const TemplateArgumentListInfo &TemplateArgsInfo, ArrayRef< TemplateArgument > Converted)
void 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
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)
bool isThisDeclarationADefinition() const
StorageClass getStorageClass() const
Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.
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
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool isNull() const
Determine whether this template name is NULL.
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)
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...
SourceLocation getRAngleLoc() const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
QualType getReturnType() const
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
const CXXRecordDecl * getParent() const
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...
VarTemplateDecl * getInstantiatedFromMemberTemplate()
NestedNameSpecifierLoc getTemplateQualifierLoc() const
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, AttributeList *AttrList, bool IsInstantiation, bool HasTypenameKeyword, SourceLocation TypenameLoc)
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
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
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
FunctionTemplateDecl * getInstantiatedFromMemberTemplate()
void setSpecializationKind(TemplateSpecializationKind TSK)
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)
Represents a C++ nested-name-specifier or a global scope specifier.
DeclContext * getLexicalDeclContext()
SourceLocation getTemplateNameLoc() const
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember()
Retrieve the member class template partial specialization from which this particular class template p...
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...
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. Does not test the acceptance criteria...
decl_iterator decls_begin() const
FunctionDecl * SourceDecl
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
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
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
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.
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false)
void MakeInstantiatedLocalArgPack(const Decl *D)
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D)
ExtInfo getExtInfo() const
Sema - This implements semantic analysis and AST building for C.
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in. InsertPos must be obtained fro...
QualType getParamType(unsigned i) const
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit, bool TypeMayContainAuto)
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. Contains type source information through TypeSo...
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. For the computed linkage of symbol, see getLinkage.
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex)
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
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.
bool hasDeclaratorForAnonDecl() const
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...
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
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. The actual template arguments (if any) are stored a...
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)
Represents a C++ destructor within a class.
void setInvalidDecl(bool Invalid=true)
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. This will either be a local variabl...
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
Represents a C++ template name within the type system.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
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.
ClassTemplateDecl * getInstantiatedFromMemberTemplate()
bool isDependentType() const
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
DiagnosticsEngine & getDiagnostics() const
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
TemplateArgumentLoc * getTemplateArgs()
Retrieve the template arguments.
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.
bool hasNameForLinkage() const
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
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
DeclarationNameInfo getNameInfo() const
Attr * instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute. The C++11 [[noreturn]] attr...
Stmt * getBody(const FunctionDecl *&Definition) const
SourceLocation getLocStart() const LLVM_READONLY
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
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. It will iterate at least once ...
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)
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. The SourceManager can decode this to get at the full include stack...
enumerator_range enumerators() const
unsigned getNumParams() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
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)
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.
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)
bool isTypeDependent() const
lookup_result lookup(DeclarationName Name) const
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
bool isFileContext() const
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
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
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
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)
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)
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.
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
A template instantiation that is currently in progress.
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
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)
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)
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
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
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
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
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.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember()
Retrieve the member variable template partial specialization from which this particular variable temp...
FunctionDecl * SourceTemplate
TypeSourceInfo * SubstFunctionType(FunctionDecl *D, SmallVectorImpl< ParmVarDecl * > &Params)
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)
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
NamedDecl * getFriendDecl() const
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, bool IsDecltype=false)
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
void setNonMemberOperator()
Specifies that this declaration is a C++ overloaded non-member.
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
QualType getIntegerType() const
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)
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.
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. InsertPos must be obtained fro...
Represents a C++ struct/union/class.
void setTSCSpec(ThreadStorageClassSpecifier TSC)
void MergeVarDecl(VarDecl *New, LookupResult &Previous)
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
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.
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)
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.
DeclaratorDecl * getDeclaratorForAnonDecl() const
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.
void setDeclaratorForAnonDecl(DeclaratorDecl *DD)
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.
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
virtual bool HandleTopLevelDecl(DeclGroupRef D)
Contains a late templated function. Will be parsed at the end of the translation unit, used by Sema & Parser.
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, const EnumDecl *Prev)
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false)
TemplateParameterList * getTemplateParameterList(unsigned index) const
SourceLocation getLAngleLoc() const
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
static bool anyDependentTemplateArguments(const TemplateArgumentLoc *Args, unsigned NumArgs, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
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.
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
isNull - 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. This will be a class template spe...
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. For example, in the following, both 'a' and 'A::b' are threadprivate:
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)