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 S.
AddModeAttr(Attr.getRange(), New, Attr.getMode(),
235 Attr.getSpellingListIndex(),
true);
241 const OMPDeclareSimdDeclAttr &
Attr,
Decl *New) {
243 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
244 New = FTD->getTemplatedDecl();
245 auto *FD = cast<FunctionDecl>(New);
246 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
251 if (
auto *DRE = dyn_cast<DeclRefExpr>(
E->IgnoreParenImpCasts()))
252 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
255 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
257 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
261 FD->isCXXInstanceMember());
266 if (
auto *
E = Attr.getSimdlen())
269 if (Attr.uniforms_size() > 0) {
270 for(
auto *
E : Attr.uniforms()) {
274 Uniforms.push_back(Inst.
get());
278 auto AI = Attr.alignments_begin();
279 for (
auto *
E : Attr.aligneds()) {
283 Aligneds.push_back(Inst.
get());
287 Alignments.push_back(Inst.
get());
291 auto SI = Attr.steps_begin();
292 for (
auto *
E : Attr.linears()) {
296 Linears.push_back(Inst.
get());
300 Steps.push_back(Inst.
get());
303 LinModifiers.append(Attr.modifiers_begin(), Attr.modifiers_end());
306 Uniforms, Aligneds, Alignments, Linears, LinModifiers, Steps,
314 for (
const auto *TmplAttr : Tmpl->attrs()) {
316 const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
317 if (Aligned && Aligned->isAlignmentDependent()) {
322 const AssumeAlignedAttr *AssumeAligned = dyn_cast<AssumeAlignedAttr>(TmplAttr);
328 const AlignValueAttr *AlignValue = dyn_cast<AlignValueAttr>(TmplAttr);
334 const EnableIfAttr *EnableIf = dyn_cast<EnableIfAttr>(TmplAttr);
335 if (EnableIf && EnableIf->getCond()->isValueDependent()) {
341 if (
const CUDALaunchBoundsAttr *CUDALaunchBounds =
342 dyn_cast<CUDALaunchBoundsAttr>(TmplAttr)) {
344 *CUDALaunchBounds, New);
348 if (
const ModeAttr *Mode = dyn_cast<ModeAttr>(TmplAttr)) {
353 if (
const auto *OMPAttr = dyn_cast<OMPDeclareSimdDeclAttr>(TmplAttr)) {
359 if (TmplAttr->getKind() == attr::DLLExport ||
360 TmplAttr->getKind() == attr::DLLImport) {
361 if (New->hasAttr<DLLExportAttr>() || New->hasAttr<DLLImportAttr>()) {
366 if (
auto ABIAttr = dyn_cast<ParameterABIAttr>(TmplAttr)) {
368 ABIAttr->getSpellingListIndex());
372 if (isa<NSConsumedAttr>(TmplAttr) || isa<CFConsumedAttr>(TmplAttr)) {
374 TmplAttr->getSpellingListIndex(),
375 isa<NSConsumedAttr>(TmplAttr),
380 assert(!TmplAttr->isPackExpansion());
381 if (TmplAttr->isLateParsed() && LateAttrs) {
392 dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext());
397 *
this, TemplateArgs);
399 New->addAttr(NewAttr);
408 template<
typename DeclT>
410 DeclT *
Result = D->getPreviousDecl();
415 if (Result && isa<CXXRecordDecl>(D->getDeclContext()) &&
416 D->getLexicalDeclContext() != Result->getLexicalDeclContext())
424 llvm_unreachable(
"Translation units cannot be instantiated");
429 llvm_unreachable(
"pragma comment cannot be instantiated");
432 Decl *TemplateDeclInstantiator::VisitPragmaDetectMismatchDecl(
434 llvm_unreachable(
"pragma comment cannot be instantiated");
439 llvm_unreachable(
"extern \"C\" context cannot be instantiated");
443 TemplateDeclInstantiator::VisitLabelDecl(
LabelDecl *D) {
451 TemplateDeclInstantiator::VisitNamespaceDecl(
NamespaceDecl *D) {
452 llvm_unreachable(
"Namespaces cannot be instantiated");
471 bool Invalid =
false;
510 Typedef->setInvalidDecl();
515 TagDecl *oldTag = oldTagType->getDecl();
534 Typedef->setPreviousDecl(InstPrevTypedef);
539 Typedef->setAccess(D->getAccess());
572 if (getPreviousDeclForInstantiation<TypedefNameDecl>(Pattern)) {
574 if (!Found.
empty()) {
588 if (PrevAliasTemplate)
591 Inst->setAccess(D->getAccess());
593 if (!PrevAliasTemplate)
606 bool InstantiatingVarTemplate) {
617 SemaRef.
Diag(D->getLocation(), diag::err_variable_instantiates_to_function)
623 if (D->isLocalExternDecl())
634 Var->setInvalidDecl();
641 StartingScope, InstantiatingVarTemplate);
644 QualType ReturnType = cast<FunctionDecl>(DC)->getReturnType();
649 Var->setImplicit(D->isImplicit());
662 Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
679 SemaRef.
Diag(D->getLocation(), diag::err_field_instantiates_to_function)
696 = SemaRef.
SubstExpr(BitWidth, TemplateArgs);
701 BitWidth = InstantiatedBitWidth.
getAs<
Expr>();
706 cast<RecordDecl>(Owner),
715 cast<Decl>(Owner)->setInvalidDecl();
721 if (Field->hasAttrs())
725 Field->setInvalidDecl();
731 if (
CXXRecordDecl *Parent= dyn_cast<CXXRecordDecl>(Field->getDeclContext())) {
732 if (Parent->isAnonymousStructOrUnion() &&
733 Parent->getRedeclContext()->isFunctionOrMethod())
737 Field->setImplicit(D->isImplicit());
738 Field->setAccess(D->getAccess());
745 bool Invalid =
false;
749 SemaRef.
Diag(D->getLocation(), diag::err_property_is_variably_modified)
765 SemaRef.
Diag(D->getLocation(), diag::err_field_instantiates_to_function)
781 Property->setInvalidDecl();
783 Property->setAccess(D->getAccess());
794 for (
auto *PI : D->
chain()) {
800 NamedChain[i++] =
Next;
803 QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
808 for (
const auto *
Attr : D->attrs())
811 IndirectField->setImplicit(D->isImplicit());
812 IndirectField->setAccess(D->getAccess());
814 return IndirectField;
829 InstTy = SemaRef.
SubstType(Ty, TemplateArgs,
847 assert(ND &&
"friend decl must be a decl or a type!");
854 if (!NewND)
return nullptr;
873 = SemaRef.
SubstExpr(AssertExpr, TemplateArgs);
878 InstantiatedAssertExpr.
get(),
884 Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
890 if (!Prev)
return nullptr;
891 PrevDecl = cast<EnumDecl>(Prev);
912 &&
"Dependent type without type source info");
920 Enum->setAccess(D->getAccess());
935 if (Def && Def != D) {
942 SemaRef.
SubstType(TI->getType(), TemplateArgs,
970 Enum->setLocation(Pattern->getLocation());
978 if (
Expr *UninstValue = EC->getInitExpr()) {
983 Value = SemaRef.
SubstExpr(UninstValue, TemplateArgs);
1000 EnumConst->setInvalidDecl();
1001 Enum->setInvalidDecl();
1007 EnumConst->setAccess(Enum->getAccess());
1009 Enumerators.push_back(EnumConst);
1010 LastEnumConst = EnumConst;
1027 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
1032 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
1036 bool isFriend = (D->getFriendObjectKind() != Decl::FOK_None);
1064 if (!Found.
empty()) {
1066 if (PrevClassTemplate)
1079 SS.
Adopt(QualifierLoc);
1081 if (!DC)
return nullptr;
1084 Pattern->getDeclContext(),
1094 if (R.isSingleResult()) {
1096 if (PrevClassTemplate)
1100 if (!PrevClassTemplate && QualifierLoc) {
1101 SemaRef.
Diag(Pattern->getLocation(), diag::err_not_tag_in_scope)
1107 bool AdoptedPreviousTemplateParams =
false;
1108 if (PrevClassTemplate) {
1109 bool Complain =
true;
1126 if (cast<Decl>(DCParent)->isInStdNamespace())
1141 AdoptedPreviousTemplateParams =
true;
1142 InstParams = PrevParams;
1147 if (!AdoptedPreviousTemplateParams &&
1167 RecordInst->setDescribedClassTemplate(Inst);
1170 if (PrevClassTemplate)
1171 Inst->setAccess(PrevClassTemplate->getAccess());
1173 Inst->setAccess(D->getAccess());
1175 Inst->setObjectOfFriendDecl();
1179 Inst->setAccess(D->getAccess());
1180 if (!PrevClassTemplate)
1191 Inst->setLexicalDeclContext(Owner);
1192 RecordInst->setLexicalDeclContext(Owner);
1196 if (D->isOutOfLine()) {
1197 Inst->setLexicalDeclContext(D->getLexicalDeclContext());
1198 RecordInst->setLexicalDeclContext(D->getLexicalDeclContext());
1203 if (!PrevClassTemplate) {
1209 for (
unsigned I = 0, N = PartialSpecs.size();
I != N; ++
I)
1210 if (PartialSpecs[
I]->getFirstDecl()->isOutOfLine())
1211 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[
I]));
1218 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
1231 if (!InstClassTemplate)
1243 "Only static data member templates are allowed.");
1259 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
1265 if (!VarInst)
return nullptr;
1275 Inst->setAccess(D->getAccess());
1276 if (!PrevVarTemplate)
1279 if (D->isOutOfLine()) {
1280 Inst->setLexicalDeclContext(D->getLexicalDeclContext());
1281 VarInst->setLexicalDeclContext(D->getLexicalDeclContext());
1286 if (!PrevVarTemplate) {
1292 for (
unsigned I = 0, N = PartialSpecs.size();
I != N; ++
I)
1293 if (PartialSpecs[
I]->getFirstDecl()->isOutOfLine())
1294 OutOfLineVarPartialSpecs.push_back(
1295 std::make_pair(Inst, PartialSpecs[
I]));
1301 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
1304 "Only static data member templates are allowed.");
1310 assert(!Found.
empty() &&
"Instantiation found nothing?");
1313 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
1316 InstVarTemplate->findPartialSpecInstantiatedFromMember(D))
1350 = Instantiated->getDescribedFunctionTemplate();
1351 InstTemplate->setAccess(D->getAccess());
1352 assert(InstTemplate &&
1353 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
1355 bool isFriend = (InstTemplate->getFriendObjectKind() != Decl::FOK_None);
1366 }
else if (InstTemplate->getDeclContext()->isRecord() &&
1371 return InstTemplate;
1377 PrevDecl = cast<CXXRecordDecl>(Owner);
1382 if (!Prev)
return nullptr;
1383 PrevDecl = cast<CXXRecordDecl>(Prev);
1395 Record->setImplicit(D->isImplicit());
1399 if (D->getAccess() !=
AS_none)
1400 Record->setAccess(D->getAccess());
1406 if (D->getFriendObjectKind())
1407 Record->setObjectOfFriendDecl();
1436 SavedPendingLocalImplicitInstantiations(SemaRef);
1468 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
1474 NewFunc->getParamTypes(), NewEPI);
1486 if (FunctionTemplate && !TemplateParams) {
1489 void *InsertPos =
nullptr;
1499 if (FunctionTemplate)
1500 isFriend = (FunctionTemplate->getFriendObjectKind() != Decl::FOK_None);
1502 isFriend = (D->getFriendObjectKind() != Decl::FOK_None);
1504 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1506 !(isa<Decl>(Owner) &&
1507 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1528 if (D->isLocalExternDecl()) {
1531 }
else if (isFriend && QualifierLoc) {
1533 SS.
Adopt(QualifierLoc);
1535 if (!DC)
return nullptr;
1555 if (D->isLocalExternDecl())
1556 Function->setLocalExternDecl();
1559 if (!isFriend && D->
isOutOfLine() && !D->isLocalExternDecl()) {
1561 LexicalDC = D->getDeclContext();
1564 Function->setLexicalDeclContext(LexicalDC);
1567 for (
unsigned P = 0;
P < Params.size(); ++
P)
1569 Params[
P]->setOwningFunction(Function);
1570 Function->setParams(Params);
1573 if (TemplateParams) {
1589 Function->getLocation(),
1591 TemplateParams, Function);
1594 FunctionTemplate->setLexicalDeclContext(LexicalDC);
1602 }
else if (FunctionTemplate) {
1605 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1609 }
else if (isFriend) {
1616 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1620 Function->setInvalidDecl();
1622 bool isExplicitSpecialization =
false;
1632 assert(isFriend &&
"non-friend has dependent specialization info?");
1635 Function->setObjectOfFriendDecl();
1639 Info->getRAngleLoc());
1640 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
1641 ExplicitArgs, TemplateArgs))
1645 for (
unsigned I = 0,
E = Info->getNumTemplates();
I !=
E; ++
I) {
1647 Info->getTemplate(
I),
1649 if (!Temp)
return nullptr;
1651 Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
1657 Function->setInvalidDecl();
1659 isExplicitSpecialization =
true;
1661 }
else if (TemplateParams || !FunctionTemplate) {
1676 isExplicitSpecialization);
1678 NamedDecl *PrincipalDecl = (TemplateParams
1679 ? cast<NamedDecl>(FunctionTemplate)
1685 PrincipalDecl->setObjectOfFriendDecl();
1688 bool QueuedInstantiation =
false;
1701 SemaRef.
Diag(Function->getLocation(), diag::err_redefinition)
1703 SemaRef.
Diag(Definition->getLocation(), diag::note_previous_definition);
1707 else for (
auto R : Function->
redecls()) {
1713 if (!QueuedInstantiation && R->isUsed(
false)) {
1716 if (MSInfo->getPointOfInstantiation().isInvalid()) {
1718 MSInfo->setPointOfInstantiation(Loc);
1720 std::make_pair(Function, Loc));
1721 QueuedInstantiation =
true;
1728 if (R->getFriendObjectKind()) {
1731 if (RPattern->isDefined(RPattern)) {
1732 SemaRef.
Diag(Function->getLocation(), diag::err_redefinition)
1734 SemaRef.
Diag(R->getLocation(), diag::note_previous_definition);
1747 PrincipalDecl->isInIdentifierNamespace(Decl::IDNS_Ordinary))
1748 PrincipalDecl->setNonMemberOperator();
1750 assert(!D->
isDefaulted() &&
"only methods should be defaulted");
1757 bool IsClassScopeSpecialization) {
1759 if (FunctionTemplate && !TemplateParams) {
1765 void *InsertPos =
nullptr;
1775 if (FunctionTemplate)
1776 isFriend = (FunctionTemplate->getFriendObjectKind() != Decl::FOK_None);
1778 isFriend = (D->getFriendObjectKind() != Decl::FOK_None);
1780 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1781 !(isa<Decl>(Owner) &&
1782 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1787 unsigned NumTempParamLists = 0;
1789 TempParamLists.resize(NumTempParamLists);
1790 for (
unsigned I = 0;
I != NumTempParamLists; ++
I) {
1795 TempParamLists[
I] = InstParams;
1817 SS.
Adopt(QualifierLoc);
1824 D->getDeclContext(),
1827 if (!DC)
return nullptr;
1839 StartLoc, NameInfo, T, TInfo,
1840 Constructor->isExplicit(),
1841 Constructor->isInlineSpecified(),
1842 false, Constructor->isConstexpr());
1845 StartLoc, NameInfo, T, TInfo,
1846 Destructor->isInlineSpecified(),
1850 StartLoc, NameInfo, T, TInfo,
1851 Conversion->isInlineSpecified(),
1852 Conversion->isExplicit(),
1853 Conversion->isConstexpr(),
1854 Conversion->getLocEnd());
1858 StartLoc, NameInfo, T, TInfo,
1867 Method->setQualifierInfo(QualifierLoc);
1869 if (TemplateParams) {
1884 Method->getLocation(),
1886 TemplateParams, Method);
1888 FunctionTemplate->setLexicalDeclContext(Owner);
1889 FunctionTemplate->setObjectOfFriendDecl();
1891 FunctionTemplate->setLexicalDeclContext(D->getLexicalDeclContext());
1892 Method->setDescribedFunctionTemplate(FunctionTemplate);
1893 }
else if (FunctionTemplate) {
1896 Method->setFunctionTemplateSpecialization(FunctionTemplate,
1900 }
else if (!isFriend) {
1902 Method->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1909 if (NumTempParamLists)
1910 Method->setTemplateParameterListsInfo(
1912 llvm::makeArrayRef(TempParamLists.data(), NumTempParamLists));
1914 Method->setLexicalDeclContext(Owner);
1915 Method->setObjectOfFriendDecl();
1917 Method->setLexicalDeclContext(D->getLexicalDeclContext());
1920 for (
unsigned P = 0;
P < Params.size(); ++
P)
1921 Params[
P]->setOwningFunction(Method);
1922 Method->setParams(Params);
1925 Method->setInvalidDecl();
1930 if (!FunctionTemplate || TemplateParams || isFriend) {
1941 if (!IsClassScopeSpecialization)
1950 if (isFriend && Method->getPreviousDecl())
1951 Method->setAccess(Method->getPreviousDecl()->getAccess());
1953 Method->setAccess(D->getAccess());
1954 if (FunctionTemplate)
1955 FunctionTemplate->setAccess(Method->getAccess());
1966 if (FunctionTemplate) {
1970 }
else if (Method->isInvalidDecl() && !Previous.
empty()) {
1974 }
else if (isFriend) {
1985 }
else if (!IsClassScopeSpecialization) {
2009 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
2017 D->
getDepth() - TemplateArgs.getNumLevels(),
2027 if (InstantiatedDefaultArg)
2028 Inst->setDefaultArgument(InstantiatedDefaultArg);
2038 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
2044 bool IsExpandedParameterPack =
false;
2047 bool Invalid =
false;
2062 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2067 ExpandedParameterPackTypes.push_back(NewT);
2070 IsExpandedParameterPack =
true;
2085 bool RetainExpansion =
false;
2090 Pattern.getSourceRange(),
2093 Expand, RetainExpansion,
2098 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
2106 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2112 ExpandedParameterPackTypes.push_back(NewT);
2118 IsExpandedParameterPack =
true;
2155 if (IsExpandedParameterPack)
2160 ExpandedParameterPackTypesAsWritten);
2165 D->
getDepth() - TemplateArgs.getNumLevels(),
2172 Param->setInvalidDecl();
2179 Param->setDefaultArgument(Value.
get());
2192 for (
const auto &
P : *Params) {
2193 if (
P->isTemplateParameterPack())
2205 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
2212 bool IsExpandedParameterPack =
false;
2226 ExpandedParams.push_back(Expansion);
2229 IsExpandedParameterPack =
true;
2230 InstParams = TempParams;
2242 bool RetainExpansion =
false;
2248 Expand, RetainExpansion,
2253 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
2259 ExpandedParams.push_back(Expansion);
2265 IsExpandedParameterPack =
true;
2266 InstParams = TempParams;
2288 if (IsExpandedParameterPack)
2291 D->
getDepth() - TemplateArgs.getNumLevels(),
2298 D->
getDepth() - TemplateArgs.getNumLevels(),
2311 Param->setDefaultArgument(
2346 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
2367 if (
auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.
CurContext))
2374 bool CheckRedeclaration = Owner->
isRecord();
2386 SS.
Adopt(QualifierLoc);
2387 if (CheckRedeclaration) {
2388 Prev.setHideTags(
false);
2394 D->getLocation(), Prev))
2395 NewUD->setInvalidDecl();
2399 if (!NewUD->isInvalidDecl() &&
2402 NewUD->setInvalidDecl();
2405 NewUD->setAccess(D->getAccess());
2409 if (NewUD->isInvalidDecl())
2418 for (
auto *Shadow : D->
shadows()) {
2421 NamedDecl *OldTarget = Shadow->getTargetDecl();
2422 if (
auto *CUSD = dyn_cast<ConstructorUsingShadowDecl>(Shadow))
2423 if (
auto *BaseShadow = CUSD->getNominatedBaseClassShadowDecl())
2424 OldTarget = BaseShadow;
2428 Shadow->getLocation(), OldTarget, TemplateArgs));
2433 if (CheckRedeclaration) {
2439 Shadow->getLocation(), OldPrev, TemplateArgs));
2447 if (isFunctionScope)
2459 Decl *TemplateDeclInstantiator::VisitConstructorUsingShadowDecl(
2465 Decl * TemplateDeclInstantiator
2474 SS.
Adopt(QualifierLoc);
2490 Decl * TemplateDeclInstantiator
2498 SS.
Adopt(QualifierLoc);
2515 Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
2530 TemplateArgsPtr = &TemplateArgs;
2536 NewFD->setInvalidDecl();
2542 assert(Specialization &&
"Class scope Specialization is null");
2548 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
2553 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
2554 Vars.push_back(Var);
2566 Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
2573 if (SubstReductionType.
isNull())
2575 bool IsCorrect = !SubstReductionType.
isNull();
2577 std::pair<QualType, SourceLocation> ReductionTypes[] = {
2578 std::make_pair(SubstReductionType, D->getLocation())};
2580 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
2581 PrevDeclInScope = cast<OMPDeclareReductionDecl>(
2586 nullptr, Owner, D->
getDeclName(), ReductionTypes, D->getAccess(),
2588 auto *NewDRD = cast<OMPDeclareReductionDecl>(DRD.get().getSingleDecl());
2591 Expr *SubstCombiner =
nullptr;
2592 Expr *SubstInitializer =
nullptr;
2597 const char *
Names[] = {
"omp_in",
"omp_out"};
2598 for (
auto &
Name : Names) {
2600 auto OldLookup = D->
lookup(DN);
2601 auto Lookup = NewDRD->lookup(DN);
2602 if (!OldLookup.empty() && !Lookup.empty()) {
2603 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2614 const char *Names[] = {
"omp_orig",
"omp_priv"};
2615 for (
auto &
Name : Names) {
2617 auto OldLookup = D->
lookup(DN);
2618 auto Lookup = NewDRD->lookup(DN);
2619 if (!OldLookup.empty() && !Lookup.empty()) {
2620 assert(Lookup.size() == 1 && OldLookup.size() == 1);
2622 OldLookup.front(), Lookup.front());
2630 IsCorrect = IsCorrect && SubstCombiner &&
2641 Decl *TemplateDeclInstantiator::VisitOMPCapturedExprDecl(
2643 llvm_unreachable(
"Should not be met in templates");
2654 Decl *TemplateDeclInstantiator::VisitRecordDecl(
RecordDecl *D) {
2655 llvm_unreachable(
"There are only CXXRecordDecls in C++");
2659 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
2664 assert(ClassTemplate->getDeclContext()->isRecord() &&
2666 "can only instantiate an explicit specialization "
2667 "for a member class template");
2677 if (!InstClassTemplate)
2683 castAs<TemplateSpecializationTypeLoc>();
2689 if (SemaRef.
Subst(ArgLocs.data(), ArgLocs.size(),
2690 InstTemplateArgs, TemplateArgs))
2705 void *InsertPos =
nullptr;
2735 SemaRef.
Diag(D->getLocation(), diag::err_redefinition) << PrevDecl;
2737 diag::note_previous_definition);
2775 TemplateName(InstClassTemplate), D->getLocation(), InstTemplateArgs,
2778 InstD->setAccess(D->getAccess());
2804 assert(VarTemplate &&
2805 "A template specialization without specialized template?");
2813 TemplateArgsInfo.
size(), VarTemplateArgsInfo, TemplateArgs))
2819 VarTemplate, VarTemplate->getLocStart(),
2826 void *InsertPos =
nullptr;
2828 Converted, InsertPos))
2833 VarTemplateArgsInfo, Converted);
2849 SemaRef.
Diag(D->getLocation(), diag::err_variable_instantiates_to_function)
2867 Owner, StartingScope);
2873 llvm_unreachable(
"@defs is not supported in Objective-C++");
2880 "cannot instantiate %0 yet");
2881 SemaRef.
Diag(D->getLocation(), DiagID)
2882 << D->getDeclKindName();
2888 llvm_unreachable(
"Unexpected decl");
2894 if (D->isInvalidDecl())
2897 return Instantiator.
Visit(D);
2909 bool Invalid =
false;
2911 unsigned N = L->
size();
2915 for (
auto &
P : *L) {
2917 Params.push_back(D);
2918 Invalid = Invalid || !D || D->isInvalidDecl();
2927 L->getLAngleLoc(), Params,
2967 InstTemplateArgs, TemplateArgs))
2974 PartialSpec->getLocation(),
2982 void *InsertPos =
nullptr;
3002 PartialSpec->getLocation(),
3022 SemaRef.
Diag(PartialSpec->getLocation(), diag::err_partial_spec_redeclared)
3024 SemaRef.
Diag(PrevDecl->getLocation(), diag::note_prev_partial_spec_here)
3036 PartialSpec->getLocation(),
3052 ClassTemplate->AddPartialSpecialization(InstPartialSpec,
3054 return InstPartialSpec;
3092 InstTemplateArgs, TemplateArgs))
3099 InstTemplateArgs,
false, Converted))
3104 void *InsertPos =
nullptr;
3121 TemplateName(VarTemplate), PartialSpec->getLocation(), InstTemplateArgs,
3140 SemaRef.
Diag(PartialSpec->getLocation(),
3141 diag::err_var_partial_spec_redeclared)
3143 SemaRef.
Diag(PrevDecl->getLocation(),
3144 diag::note_var_prev_partial_spec_here);
3156 SemaRef.
Diag(PartialSpec->getLocation(),
3157 diag::err_variable_instantiates_to_function)
3166 PartialSpec->getLocation(), InstParams, VarTemplate, DI->
getType(),
3178 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
3181 LateAttrs, Owner, StartingScope);
3183 return InstPartialSpec;
3190 assert(OldTInfo &&
"substituting function without type source info");
3191 assert(Params.empty() &&
"parameter vector is non-empty at start");
3194 unsigned ThisTypeQuals = 0;
3196 ThisContext = cast<CXXRecordDecl>(Owner);
3197 ThisTypeQuals = Method->getTypeQualifiers();
3204 ThisContext, ThisTypeQuals);
3210 if (NewTInfo != OldTInfo) {
3214 unsigned NewIdx = 0;
3215 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
3216 OldIdx != NumOldParams; ++OldIdx) {
3217 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
3222 NumArgumentsInExpansion =
3225 if (!NumArgumentsInExpansion) {
3229 Params.push_back(NewParam);
3234 for (
unsigned I = 0;
I != *NumArgumentsInExpansion; ++
I) {
3236 Params.push_back(NewParam);
3246 cast<FunctionProtoType>(OldProtoLoc.getType());
3247 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
3257 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
3260 Params.push_back(Parm);
3277 TemplateArgs, ParamTypes, &Params,
3292 unsigned FParamIdx = 0;
3297 assert(FParamIdx < Function->getNumParams());
3308 FunctionParam->getLocation(),
3324 assert(NumArgumentsInExpansion &&
3325 "should only be called when all template arguments are known");
3328 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
3334 FunctionParam->getLocation(),
3360 UpdateExceptionSpec(Decl,
EST_None);
3370 getTemplateInstantiationArgs(Decl,
nullptr,
true);
3375 UpdateExceptionSpec(Decl,
EST_None);
3407 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
3408 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
3410 = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
3411 assert(FunTmpl->getTemplatedDecl() == Tmpl &&
3412 "Deduction from the wrong function template?");
3414 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
3415 ActiveInst.Entity = New;
3420 assert(Proto &&
"Function template without prototype?");
3433 !Tmpl->isLexicallyWithinFunctionOrMethod()) {
3444 assert(NewProto &&
"Template instantiation without function prototype?");
3461 LateAttrs, StartingScope);
3477 New->setAccess(Tmpl->getAccess());
3505 bool DefinitionRequired,
3507 if (Function->isInvalidDecl() || Function->
isDefined())
3518 assert(PatternDecl &&
"instantiating a non-template");
3520 Stmt *Pattern = PatternDecl->
getBody(PatternDecl);
3521 assert(PatternDecl &&
"template definition is not a template");
3526 assert(PatternDecl &&
"template definition is not a template");
3530 !LateTemplateParser) {
3531 PendingInstantiations.push_back(
3532 std::make_pair(Function, PointOfInstantiation));
3542 SavedPendingLocalImplicitInstantiations(*
this);
3544 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
3549 LateTemplateParser) {
3551 if (PatternDecl->isFromASTFile())
3552 ExternalSource->ReadLateParsedTemplates(LateParsedTemplateMap);
3555 assert(LPT &&
"missing LateParsedTemplate");
3556 LateTemplateParser(OpaqueParser, *LPT);
3557 Pattern = PatternDecl->
getBody(PatternDecl);
3565 if (DefinitionRequired) {
3567 Diag(PointOfInstantiation,
3568 diag::err_explicit_instantiation_undefined_func_template)
3571 Diag(PointOfInstantiation,
3572 diag::err_explicit_instantiation_undefined_member)
3573 << 1 << Function->
getDeclName() << Function->getDeclContext();
3576 Diag(PatternDecl->getLocation(),
3577 diag::note_explicit_instantiation_here);
3578 Function->setInvalidDecl();
3582 PendingInstantiations.push_back(
3583 std::make_pair(Function, PointOfInstantiation));
3586 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred()) {
3587 Diag(PointOfInstantiation, diag::warn_func_template_missing)
3589 Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
3590 if (getLangOpts().CPlusPlus11)
3591 Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
3614 D = D->getPreviousDecl()) {
3615 D->setImplicitlyInline();
3625 "instantiating function definition");
3637 bool MergeWithParentScope =
false;
3638 if (
CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Function->getDeclContext()))
3639 MergeWithParentScope = Rec->isLocalClass();
3644 SetDeclDefaulted(Function, PatternDecl->getLocation());
3647 getTemplateInstantiationArgs(Function,
nullptr,
false, PatternDecl);
3655 ActOnStartOfFunctionDef(
nullptr, Function);
3667 dyn_cast<CXXConstructorDecl>(PatternDecl)) {
3668 InstantiateMemInitializers(cast<CXXConstructorDecl>(Function), Ctor,
3673 StmtResult Body = SubstStmt(Pattern, TemplateArgs);
3676 Function->setInvalidDecl();
3678 ActOnFinishFunctionBody(Function, Body.
get(),
3681 PerformDependentDiagnostics(PatternDecl, TemplateArgs);
3683 if (
auto *Listener = getASTMutationListener())
3684 Listener->FunctionDefinitionInstantiated(Function);
3690 Consumer.HandleTopLevelDecl(DG);
3694 PerformPendingInstantiations(
true);
3699 DefineUsedVTables();
3703 PerformPendingInstantiations();
3718 if (FromVar->isInvalidDecl())
3737 bool IsMemberSpec =
false;
3739 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar))
3740 IsMemberSpec = PartialSpec->isMemberSpecialization();
3742 IsMemberSpec = FromTemplate->isMemberSpecialization();
3752 return cast_or_null<VarTemplateSpecializationDecl>(
3753 Instantiator.VisitVarTemplateSpecializationDecl(
3754 VarTemplate, FromVar, InsertPos, TemplateArgsInfo, Converted));
3774 InstantiateVariableInitializer(VarSpec, PatternDecl, TemplateArgs);
3787 bool InstantiatingVarTemplate) {
3794 if (OldVar->isLocalExternDecl()) {
3795 NewVar->setLocalExternDecl();
3796 NewVar->setLexicalDeclContext(Owner);
3798 NewVar->setLexicalDeclContext(OldVar->getLexicalDeclContext());
3806 NewVar->setAccess(OldVar->getAccess());
3809 if (OldVar->isUsed(
false))
3810 NewVar->setIsUsed();
3811 NewVar->setReferenced(OldVar->isReferenced());
3814 InstantiateAttrs(TemplateArgs, OldVar, NewVar, LateAttrs, StartingScope);
3817 *
this, NewVar->
getDeclName(), NewVar->getLocation(),
3823 (!OldVar->
getPreviousDecl()->getDeclContext()->isDependentContext() ||
3824 OldVar->
getPreviousDecl()->getDeclContext()==OldVar->getDeclContext())) {
3827 if (
NamedDecl *NewPrev = FindInstantiatedDecl(
3830 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
3832 LookupQualifiedName(
Previous, NewVar->getDeclContext(),
false);
3833 CheckVariableDeclaration(NewVar,
Previous);
3835 if (!InstantiatingVarTemplate) {
3836 NewVar->getLexicalDeclContext()->addHiddenDecl(NewVar);
3838 NewVar->getDeclContext()->makeDeclVisibleInContext(NewVar);
3842 if (NewVar->getDeclContext()->isFunctionOrMethod())
3843 CurrentInstantiationScope->InstantiatedLocal(OldVar, NewVar);
3850 TSK_ImplicitInstantiation);
3859 if ((!isa<VarTemplateSpecializationDecl>(NewVar) &&
3860 !InstantiatingVarTemplate &&
3863 InstantiateVariableInitializer(NewVar, OldVar, TemplateArgs);
3867 if (!NewVar->isInvalidDecl() &&
3868 NewVar->getDeclContext()->isFunctionOrMethod() &&
3870 DiagnoseUnusedDecl(NewVar);
3899 ContextRAII SwitchContext(*
this, Var->getDeclContext());
3900 Init = SubstInitializer(OldVar->
getInit(), TemplateArgs,
3905 bool TypeMayContainAuto =
true;
3908 if (Var->hasAttr<DLLImportAttr>() &&
3912 }
else if (InitExpr) {
3914 AddInitializerToDecl(Var, InitExpr, DirectInit, TypeMayContainAuto);
3916 ActOnUninitializedDecl(Var, TypeMayContainAuto);
3920 Var->setInvalidDecl();
3923 PopExpressionEvaluationContext();
3926 ActOnUninitializedDecl(Var,
false);
3949 bool DefinitionRequired) {
3950 InstantiateVariableDefinition(PointOfInstantiation, Var, Recursive,
3951 DefinitionRequired);
3956 bool DefinitionRequired,
bool AtEndOfTU) {
3957 if (Var->isInvalidDecl())
3962 VarDecl *PatternDecl =
nullptr, *Def =
nullptr;
3964 getTemplateInstantiationArgs(Var);
3969 bool InstantiationDependent =
false;
3972 "Only instantiate variable template specializations that are "
3973 "not type-dependent");
3974 (void)InstantiationDependent;
3980 "Specialization without specialized template?");
3996 VarTemplateDecl *Tmpl = PatternPtr.get<VarTemplateDecl *>();
3997 while (VarTemplateDecl *From =
4010 if (PatternDecl->isStaticDataMember() &&
4011 (PatternDecl = PatternDecl->getFirstDecl())->hasInit() &&
4019 "instantiating variable initializer");
4025 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
4031 ContextRAII PreviousContext(*
this, Var->getDeclContext());
4032 InstantiateVariableInitializer(Var, PatternDecl, TemplateArgs);
4033 PreviousContext.pop();
4040 PerformPendingInstantiations(
true);
4046 DefineUsedVTables();
4050 PerformPendingInstantiations();
4064 assert(PatternDecl &&
"data member was not instantiated from a template?");
4065 assert(PatternDecl->isStaticDataMember() &&
"not a static data member?");
4078 if (DefinitionRequired) {
4080 Diag(PointOfInstantiation,
4081 diag::err_explicit_instantiation_undefined_var_template) << Var;
4083 Diag(PointOfInstantiation,
4084 diag::err_explicit_instantiation_undefined_member)
4085 << 2 << Var->
getDeclName() << Var->getDeclContext();
4086 Diag(PatternDecl->getLocation(),
4087 diag::note_explicit_instantiation_here);
4089 Var->setInvalidDecl();
4092 PendingInstantiations.push_back(
4093 std::make_pair(Var, PointOfInstantiation));
4097 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred()) {
4098 Diag(PointOfInstantiation, diag::warn_var_template_missing)
4100 Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
4101 if (getLangOpts().CPlusPlus11)
4102 Diag(PointOfInstantiation, diag::note_inst_declaration_hint) << Var;
4123 struct PassToConsumerRAII {
4128 : Consumer(Consumer), Var(Var) { }
4130 ~PassToConsumerRAII() {
4133 } PassToConsumerRAII(Consumer, Var);
4140 PointOfInstantiation);
4148 "instantiating variable definition");
4154 SavedPendingLocalImplicitInstantiations(*
this);
4156 SavePendingInstantiationsAndVTableUses(*
this, Recursive);
4160 ContextRAII PreviousContext(*
this, Var->getDeclContext());
4164 if (Def->isStaticDataMember() && !Def->isOutOfLine()) {
4168 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4169 }
else if (!VarSpec) {
4170 Var = cast_or_null<VarDecl>(SubstDecl(Def, Var->getDeclContext(),
4173 Var->getLexicalDeclContext()->isRecord()) {
4179 Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
4188 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
4192 LookupResult R(*
this, Var->getDeclName(), Var->getLocation(),
4193 LookupOrdinaryName, ForRedeclaration);
4195 MergeVarDecl(Var, R);
4198 InstantiateVariableInitializer(Var, Def, TemplateArgs);
4203 Var = CompleteVarTemplateSpecializationDecl(VarSpec, Def, TemplateArgs);
4205 PreviousContext.pop();
4208 PassToConsumerRAII.Var = Var;
4215 PerformPendingInstantiations(
true);
4221 DefineUsedVTables();
4225 PerformPendingInstantiations();
4238 bool AnyErrors = Tmpl->isInvalidDecl();
4241 for (
const auto *Init : Tmpl->
inits()) {
4244 if (!Init->isWritten())
4249 if (Init->isPackExpansion()) {
4251 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
4255 bool ShouldExpand =
false;
4256 bool RetainExpansion =
false;
4258 if (CheckParameterPacksForExpansion(Init->getEllipsisLoc(),
4261 TemplateArgs, ShouldExpand,
4265 New->setInvalidDecl();
4268 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
4271 for (
unsigned I = 0;
I != *NumExpansions; ++
I) {
4275 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4285 Init->getSourceLocation(),
4294 BaseTInfo, TempInit.
get(),
4302 NewInits.push_back(NewInit.
get());
4309 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
4317 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
4320 Init->getSourceLocation(),
4324 New->setInvalidDecl();
4328 if (Init->isBaseInitializer())
4329 NewInit = BuildBaseInitializer(TInfo->
getType(), TInfo, TempInit.
get(),
4332 NewInit = BuildDelegatingInitializer(TInfo, TempInit.
get(),
4333 cast<CXXRecordDecl>(CurContext->getParent()));
4334 }
else if (Init->isMemberInitializer()) {
4335 FieldDecl *Member = cast_or_null<FieldDecl>(FindInstantiatedDecl(
4336 Init->getMemberLocation(),
4341 New->setInvalidDecl();
4345 NewInit = BuildMemberInitializer(Member, TempInit.
get(),
4346 Init->getSourceLocation());
4347 }
else if (Init->isIndirectMemberInitializer()) {
4349 cast_or_null<IndirectFieldDecl>(FindInstantiatedDecl(
4350 Init->getMemberLocation(),
4351 Init->getIndirectMember(), TemplateArgs));
4353 if (!IndirectMember) {
4355 New->setInvalidDecl();
4359 NewInit = BuildMemberInitializer(IndirectMember, TempInit.
get(),
4360 Init->getSourceLocation());
4365 New->setInvalidDecl();
4367 NewInits.push_back(NewInit.
get());
4372 ActOnMemInitializers(New,
4387 if (Pattern == Instance)
return true;
4400 if (Pattern == Instance)
return true;
4411 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
4413 Instance = cast<ClassTemplatePartialSpecializationDecl>(
4415 if (Pattern == Instance)
4429 if (Pattern == Instance)
return true;
4442 if (Pattern == Instance)
return true;
4455 if (Pattern == Instance)
return true;
4495 if (Pattern == Instance)
return true;
4505 if (D->getKind() != Other->getKind()) {
4507 = dyn_cast<UnresolvedUsingTypenameDecl>(D)) {
4508 if (
UsingDecl *UD = dyn_cast<UsingDecl>(Other)) {
4514 = dyn_cast<UnresolvedUsingValueDecl>(D)) {
4515 if (
UsingDecl *UD = dyn_cast<UsingDecl>(Other)) {
4526 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
4529 if (
EnumDecl *Enum = dyn_cast<EnumDecl>(Other))
4532 if (
VarDecl *Var = dyn_cast<VarDecl>(Other))
4543 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Other))
4547 if (
FieldDecl *Field = dyn_cast<FieldDecl>(Other)) {
4551 cast<FieldDecl>(D));
4555 if (
UsingDecl *Using = dyn_cast<UsingDecl>(Other))
4561 return D->
getDeclName() && isa<NamedDecl>(Other) &&
4562 D->
getDeclName() == cast<NamedDecl>(Other)->getDeclName();
4565 template<
typename ForwardIterator>
4568 ForwardIterator first,
4569 ForwardIterator last) {
4570 for (; first != last; ++first)
4572 return cast<NamedDecl>(*first);
4583 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
4584 Decl*
ID = FindInstantiatedDecl(Loc, D, TemplateArgs);
4585 return cast_or_null<DeclContext>(
ID);
4635 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
4637 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
4638 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
4640 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda())) {
4643 if (CurrentInstantiationScope) {
4644 if (
auto Found = CurrentInstantiationScope->findInstantiationOf(D)) {
4645 if (Decl *FD = Found->dyn_cast<Decl *>())
4646 return cast<NamedDecl>(FD);
4648 int PackIdx = ArgumentPackSubstitutionIndex;
4649 assert(PackIdx != -1 &&
4650 "found declaration pack but not pack expanding");
4652 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
4659 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
4660 isa<TemplateTemplateParmDecl>(D))
4663 if (D->isInvalidDecl())
4679 bool NeedInstantiate =
false;
4681 NeedInstantiate = RD->isLocalClass();
4683 NeedInstantiate = isa<EnumDecl>(D);
4684 if (NeedInstantiate) {
4685 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4686 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4687 return cast<TypeDecl>(Inst);
4692 assert(isa<LabelDecl>(D));
4694 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
4695 assert(Inst &&
"Failed to instantiate label??");
4697 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
4698 return cast<LabelDecl>(Inst);
4704 dyn_cast<VarTemplateSpecializationDecl>(D)) {
4705 bool InstantiationDependent =
false;
4707 VarSpec->getTemplateArgsInfo();
4709 VarTemplateArgs, InstantiationDependent))
4710 D = cast<NamedDecl>(
4711 SubstDecl(D, VarSpec->getDeclContext(), TemplateArgs));
4725 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Record))
4737 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
4741 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
4754 if (FD->getFriendObjectKind() && FD->getDeclContext()->isFileContext()){
4755 DC = FD->getLexicalDeclContext();
4770 ParentDC = FindInstantiatedContext(Loc, ParentDC, TemplateArgs);
4774 if (ParentDC != D->getDeclContext()) {
4781 bool IsBeingInstantiated =
false;
4782 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
4783 if (!Spec->isDependentContext()) {
4786 assert(Tag &&
"type of non-dependent record is not a RecordType");
4788 IsBeingInstantiated =
true;
4790 RequireCompleteType(Loc, T, diag::err_incomplete_type))
4816 if (isa<UsingShadowDecl>(D)) {
4818 }
else if (Diags.hasErrorOccurred()) {
4822 }
else if (IsBeingInstantiated) {
4828 Diag(Loc, diag::err_member_not_yet_instantiated)
4831 Diag(D->getLocation(), diag::note_non_instantiated_member_here);
4836 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
4837 EnumDecl *Spec = cast<EnumDecl>(FindInstantiatedDecl(Loc, Enum,
4839 assert(Spec->getTemplateSpecializationKind() ==
4841 Diag(Loc, diag::err_enumerator_does_not_exist)
4844 Diag(Spec->getLocation(), diag::note_enum_specialized_here)
4848 llvm_unreachable(
"Unable to find instantiation of declaration!");
4861 while (!PendingLocalImplicitInstantiations.empty() ||
4862 (!LocalOnly && !PendingInstantiations.empty())) {
4865 if (PendingLocalImplicitInstantiations.empty()) {
4866 Inst = PendingInstantiations.front();
4867 PendingInstantiations.pop_front();
4869 Inst = PendingLocalImplicitInstantiations.front();
4870 PendingLocalImplicitInstantiations.pop_front();
4874 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
4875 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
4877 InstantiateFunctionDefinition(Inst.second, Function,
true,
4878 DefinitionRequired,
true);
4883 VarDecl *Var = cast<VarDecl>(Inst.first);
4886 isa<VarTemplateSpecializationDecl>(Var)) &&
4887 "Not a static data member, nor a variable template"
4888 " specialization?");
4899 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
4907 case TSK_ImplicitInstantiation:
4912 "instantiating variable definition");
4918 InstantiateVariableDefinition( Inst.second, Var,
true,
4919 DefinitionRequired,
true);
4925 for (
auto DD : Pattern->
ddiags()) {
4926 switch (DD->getKind()) {
4928 HandleDependentAccessCheck(*DD, TemplateArgs);
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
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
no exception specification
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
SourceLocation getIdentLocation() const
Returns the location of this using declaration's identifier.
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D)
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
void setAnonymousStructOrUnion(bool Anon)
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
A (possibly-)qualified type.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
void InstantiatedLocal(const Decl *D, Decl *Inst)
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
A stack-allocated class that identifies which local variable declaration instantiations are present i...
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
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.
bool isParameterPack() const
Returns whether this is a parameter pack.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
static bool isDeclWithinFunction(const Decl *D)
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
The current expression is potentially evaluated at run time, which means that code may be generated t...
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList &TemplateArgList, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, void *InsertPos, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsExplicitSpecialization)
Perform semantic checking of a new function declaration.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
QualType getUnderlyingType() const
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
void setRangeEnd(SourceLocation E)
TypeLoc getPatternLoc() const
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
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)
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)
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.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
InClassInitStyle getInClassInitStyle() const
getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has...
void setInstantiatedFromUsingDecl(UsingDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
const TemplateArgumentLoc * getArgumentArray() const
bool hasExplicitTemplateArgs() const
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
const TemplateArgumentListInfo & templateArgs() const
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void setRAngleLoc(SourceLocation Loc)
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
void InstantiatedLocalPackArg(const Decl *D, ParmVarDecl *Inst)
RAII object that enters a new expression evaluation context.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit, bool isConstexpr, SourceLocation EndLocation)
bool SubstQualifier(const DeclaratorDecl *OldDecl, DeclaratorDecl *NewDecl)
bool isInlineSpecified() const
SourceLocation getRParenLoc() const
static void instantiateDependentAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignedAttr *Aligned, Decl *New, bool IsPackExpansion)
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
Extra information about a function prototype.
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, unsigned ThisTypeQuals)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
Declaration context for names declared as extern "C" in C++.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
Represents a variable template specialization, which refers to a variable template with a given set o...
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static void instantiateDependentCUDALaunchBoundsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const CUDALaunchBoundsAttr &Attr, Decl *New)
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
Stores a list of template parameters for a TemplateDecl and its derived classes.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
decl_iterator decls_end() const
static void instantiateDependentAssumeAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AssumeAlignedAttr *Aligned, Decl *New)
bool isSingleTagDecl() const
Asks if the result is a single tag decl.
Look up an ordinary name that is going to be redeclared as a name with linkage.
ParmVarDecl - Represents a parameter to a function.
static AccessSpecDecl * Create(ASTContext &C, AccessSpecifier AS, DeclContext *DC, SourceLocation ASLoc, SourceLocation ColonLoc)
void AddParameterABIAttr(SourceRange AttrRange, Decl *D, ParameterABI ABI, unsigned SpellingListIndex)
Defines the clang::Expr interface and subclasses for C++ expressions.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
Provides information about a dependent function-template specialization declaration.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation >> ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
unsigned getStaticLocalNumber(const VarDecl *VD) const
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Base wrapper for a particular "section" of type source info.
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
RecordDecl - Represents a struct/union/class.
DeclarationName getName() const
getName - Returns the embedded declaration name.
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
void setIntegerType(QualType T)
Set the underlying integer type.
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
StringLiteral * getMessage()
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
void setManglingNumber(const NamedDecl *ND, unsigned Number)
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
The results of name lookup within a DeclContext.
unsigned getNumArgs() const
ArrayRef< QualType > getParamTypes() const
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
void AddModeAttr(SourceRange AttrRange, Decl *D, IdentifierInfo *Name, unsigned SpellingListIndex, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
bool isReferenceType() const
QualType getReturnType() const
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, AttributeList *Attr)
Decl * VisitVarTemplateSpecializationDecl(VarTemplateDecl *VarTemplate, VarDecl *FromVar, void *InsertPos, const TemplateArgumentListInfo &TemplateArgsInfo, ArrayRef< TemplateArgument > Converted)
bool isPure() const
Whether this virtual function is pure, i.e.
void startDefinition()
Starts the definition of this tag declaration.
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
ParmVarDecl * getParam(unsigned i) const
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
CXXRecordDecl * getDefinition() const
TagKind getTagKind() const
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
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...
Represents an access specifier followed by colon ':'.
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
Declaration of a function specialization at template class scope.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the ty...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Expr * getUnderlyingExpr() const
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents a C++ using-declaration.
FunctionTemplateDecl * getCanonicalDecl() override
void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE, unsigned SpellingListIndex)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
VarTemplateDecl * getInstantiatedFromMemberTemplate() const
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
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.
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer)
Finish current declare reduction construct initializer.
IdentifierInfo * getSetterId() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For an enumeration member that was instantiated from a member enumeration of a templated class...
void ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
SourceLocation getRAngleLoc() const
A convenient class for passing around template argument information.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
QualType getReturnType() const
Look up all declarations in a scope with the given name, including resolved using declarations...
bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isDefaulted() const
Whether this function is defaulted per C++0x.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool InitFunctionInstantiation(FunctionDecl *New, FunctionDecl *Tmpl)
Initializes the common fields of an instantiation function declaration (New) from the corresponding f...
NestedNameSpecifierLoc getTemplateQualifierLoc() const
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, AttributeList *AttrList, bool IsInstantiation, bool HasTypenameKeyword, SourceLocation TypenameLoc)
Builds a using declaration.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
RecordDecl * getDecl() const
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isOverloadedOperator() const
isOverloadedOperator - Whether this function declaration represents an C++ overloaded operator...
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
void setSpecializationKind(TemplateSpecializationKind TSK)
Scope - A scope is a transient data structure that is used while parsing the program.
CXXRecordDecl * getCanonicalDecl() override
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
SourceLocation getRAngleLoc() const
Represents a C++ nested-name-specifier or a global scope specifier.
SourceLocation getTemplateNameLoc() const
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted)
Check that the given template arguments can be be provided to the given template, converting the argu...
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
decl_iterator decls_begin() const
detail::InMemoryDirectory::const_iterator I
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
RAII object used to change the argument pack substitution index within a Sema object.
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
bool isDefined(const FunctionDecl *&Definition) const
isDefined - Returns true if the function is defined at all, including a deleted definition.
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
A helper class for building up ExtParameterInfos.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false)
BuildVariableInstantiation - Used after a new variable has been created.
void MakeInstantiatedLocalArgPack(const Decl *D)
ExtInfo getExtInfo() const
Sema - This implements semantic analysis and AST building for C.
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
QualType getParamType(unsigned i) const
Represents a prototype with parameter type info, e.g.
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.
DeclarationNameTable DeclarationNames
unsigned getChainingSize() const
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind NewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
static QualType adjustFunctionTypeForInstantiation(ASTContext &Context, FunctionDecl *D, TypeSourceInfo *TInfo)
Adjust the given function type for an instantiation of the given declaration, to cope with modificati...
SourceLocation getTypeSpecStartLoc() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E, unsigned SpellingListIndex)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool isDeleted() const
Whether this function has been deleted.
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
const Type * getTypeForDecl() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Expr - This represents one expression.
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
bool isDeletedAsWritten() const
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Declaration of a template type parameter.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
ClassTemplatePartialSpecializationDecl * InstantiateClassTemplatePartialSpecialization(ClassTemplateDecl *ClassTemplate, ClassTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a class template partial specialization.
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name...
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
ArrayRef< NamedDecl * > chain() const
static DeclT * getPreviousDeclForInstantiation(DeclT *D)
Get the previous declaration of a declaration for the purposes of template instantiation.
Represents a C++ destructor within a class.
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, bool AllowParamOrMoveConstructible)
const ParmVarDecl * getParamDecl(unsigned i) const
ExtProtoInfo getExtProtoInfo() const
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, Optional< unsigned > NumExpansions, bool ExpectParameterPack)
void CheckAlignasUnderalignment(Decl *D)
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
Represents the type decltype(expr) (C++11).
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given function template specialization.
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
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.
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
StorageClass
Storage classes.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFunctionOrMethod() const
Declaration of an alias template.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
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.
NamedDecl * getInstantiatedFromUsingDecl(UsingDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
DiagnosticsEngine & getDiagnostics() const
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Represents a C++ conversion function within a class.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
shadow_range shadows() const
TypeSourceInfo * getTypeSourceInfo() const
static void instantiateOMPDeclareSimdDeclAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareSimdDeclAttr &Attr, Decl *New)
Instantiation of 'declare simd' attribute and its arguments.
static void instantiateDependentModeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const ModeAttr &Attr, Decl *New)
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
bool isTemplateTypeParmType() const
TypedefNameDecl * getTypedefNameForAnonDecl() const
VarDecl * getCanonicalDecl() override
const Expr * getAnyInitializer() const
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached...
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
DeclarationNameInfo getNameInfo() const
Attr * instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
Stmt * getBody(const FunctionDecl *&Definition) const
getBody - Retrieve the body (definition) of the function.
TemplateArgumentLoc getArgLoc(unsigned i) const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
IdentifierInfo * getGetterId() const
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
ExceptionSpecificationType Type
The kind of exception specification this is.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
A stack object to be created when performing template instantiation.
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, TemplateArgumentListInfo &Result, const MultiLevelTemplateArgumentList &TemplateArgs)
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
Encodes a location in the source.
enumerator_range enumerators() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
This represents '#pragma omp declare reduction ...' directive.
Pseudo declaration for capturing expressions.
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
const TemplateArgumentListInfo & getTemplateArgsInfo() const
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
SourceRange getBraceRange() const
void InstantiateStaticDataMemberDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false)
Instantiate the definition of the given variable from its template.
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
TagDecl - Represents the declaration of a struct/union/class/enum.
TemplateParameterList * SubstTemplateParams(TemplateParameterList *List)
Instantiates a nested template parameter list in the current instantiation context.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ASTContext & getASTContext() const
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
LabelDecl - Represents the declaration of a label.
Represents a dependent using declaration which was not marked with typename.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a static or instance method of a struct/union/class.
unsigned getDepth() const
Retrieve the depth of the template parameter.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
static bool isInstantiationOf(ClassTemplateDecl *Pattern, ClassTemplateDecl *Instance)
QualType CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
EnumDecl * getCanonicalDecl() override
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
Decl * VisitDecl(Decl *D)
ArrayRef< ParmVarDecl * > parameters() const
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
static void instantiateDependentAlignValueAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignValueAttr *Aligned, Decl *New)
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
void setDeclName(DeclarationName N)
Set the name of this declaration.
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
SourceLocation getLAngleLoc() const
Decl * VisitVarDecl(VarDecl *D, bool InstantiatingVarTemplate)
ThreadStorageClassSpecifier getTSCSpec() const
void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern)
const T * castAs() const
Member-template castAs<specific type>.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
const IdentifierInfo * getIdentifier() const
bool isFileContext() const
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
Represents a C++11 static_assert declaration.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Attr * clone(ASTContext &C) const
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
void setLAngleLoc(SourceLocation Loc)
QualType getType() const
Return the type wrapped by this type source info.
unsigned getManglingNumber(const NamedDecl *ND) const
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
void setVirtualAsWritten(bool V)
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a pack expansion of types.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template...
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Base class for declarations which introduce a typedef-name.
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Whether this is an anonymous struct or union.
Represents a template argument.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
static bool isInvalid(LocType Loc, bool *Invalid)
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
static bool addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function, const FunctionDecl *PatternDecl, LocalInstantiationScope &Scope, const MultiLevelTemplateArgumentList &TemplateArgs)
Introduce the instantiated function parameters into the local instantiation scope, and set the parameter names to those used in the template.
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
void setImplicitlyInline()
Flag that this function is implicitly inline.
bool hasTypename() const
Return true if the using declaration has 'typename'.
Decl * VisitFunctionDecl(FunctionDecl *D, TemplateParameterList *TemplateParams)
Normal class members are of more specific types and therefore don't make it here. ...
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
LocalInstantiationScope * cloneScopes(LocalInstantiationScope *Outermost)
Clone this scope, and all outer scopes, down to the given outermost scope.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
A template instantiation that is currently in progress.
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
SourceLocation getEllipsisLoc() const
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool EnumUnderlyingIsImplicit, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
TypeLoc IgnoreParens() const
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
static NamedDecl * findInstantiationOf(ASTContext &Ctx, NamedDecl *D, ForwardIterator first, ForwardIterator last)
This template specialization was instantiated from a template due to an explicit instantiation declar...
bool hasWrittenPrototype() const
Represents a dependent using declaration which was marked with typename.
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
DeclarationName - The name of a declaration.
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
void AddNSConsumedAttr(SourceRange AttrRange, Decl *D, unsigned SpellingListIndex, bool isNSConsumed, bool isTemplateInstantiation)
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition - Returns whether this specific declaration of the function is also a de...
SourceLocation getLocStart() const LLVM_READONLY
EnumDecl - Represents an enum.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
void setInlineSpecified()
detail::InMemoryDirectory::const_iterator E
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void setPreviousDeclInSameBlockScope(bool Same)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
unsigned getDepth() const
Get the nesting depth of the template parameter.
void setInitCapture(bool IC)
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
isConstantInitializer - Returns true if this expression can be emitted to IR as a constant...
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
bool empty() const
Return true if no decls were found.
void setImplicitlyInline()
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
TypeSourceInfo * SubstFunctionType(FunctionDecl *D, SmallVectorImpl< ParmVarDecl * > &Params)
Location wrapper for a TemplateArgument.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
Decl * Visit(PTR(Decl) D)
SourceManager & getSourceManager() const
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
const T * getAs() const
Member-template getAs<specific type>'.
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
bool isNull() const
Determine whether this template name is NULL.
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
bool isFunctionType() const
static bool SubstQualifier(Sema &SemaRef, const DeclT *OldDecl, DeclT *NewDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
ClassTemplateDecl * getCanonicalDecl() override
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)...
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
void setCXXForRangeDecl(bool FRD)
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
void addDecl(Decl *D)
Add the declaration D into this context.
const TypeClass * getTypePtr() const
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
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.
Represents a C++ struct/union/class.
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, llvm::MutableArrayRef< NamedDecl * > CH)
void setTSCSpec(ThreadStorageClassSpecifier TSC)
void setDescribedVarTemplate(VarTemplateDecl *Template)
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
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...
bool isInline() const
Whether this variable is (C++1z) inline.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads, Expr *MinBlocks, unsigned SpellingListIndex)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration. ...
void setUnsupportedFriend(bool Unsupported)
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
Declaration of a class template.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
SourceLocation getAccessSpecifierLoc() const
The location of the access specifier.
unsigned getIndex() const
Retrieve the index of the template parameter.
static bool isInstantiationOfStaticDataMember(VarDecl *Pattern, VarDecl *Instance)
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
SourceRange getSourceRange() const override LLVM_READONLY
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
static OpaquePtr make(QualTypeP)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
TranslationUnitDecl - The top declaration context.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
Contains a late templated function.
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
An instance of this class represents the declaration of a property member.
TemplateParameterList * getTemplateParameterList(unsigned index) const
SourceLocation getLAngleLoc() const
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExprUnevaluted - Return true if this expression might be usable in a constant expr...
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
A trivial tuple used to represent a source range.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo)
Set the underlying integer type source info.
FunctionDecl * getCanonicalDecl() override
NamedDecl - This represents a decl with a name.
DeclarationNameInfo getNameInfo() const
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
EnumDecl * getDefinition() const
Represents a C++ namespace alias.
Declaration of a friend template.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
TypeSourceInfo * getTypeSourceInfo() const
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
void setNRVOVariable(bool NRVO)
NamespaceDecl * getStdNamespace() const
void setType(QualType newType)
const TemplateArgument & getArgument() const
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared, bool isConstexpr, InheritedConstructor Inherited=InheritedConstructor())
SourceRange getSourceRange() const LLVM_READONLY
bool InitMethodInstantiation(CXXMethodDecl *New, CXXMethodDecl *Tmpl)
Initializes common fields of an instantiated method declaration (New) from the corresponding fields o...
void setDeletedAsWritten(bool D=true)
Decl * VisitCXXMethodDecl(CXXMethodDecl *D, TemplateParameterList *TemplateParams, bool IsClassScopeSpecialization=false)
This represents '#pragma omp threadprivate ...' directive.
FunctionDecl * getClassScopeSpecializationPattern() const
Retrieve the class scope template pattern that this function template specialization is instantiated ...
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
ExceptionSpecInfo ExceptionSpec
Declaration of a template function.
void clear()
Clears out any current state.
Attr - This represents one attribute.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
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)