36#include "llvm/Support/TimeProfiler.h"
52template<
typename DeclT>
55 if (!OldDecl->getQualifierLoc())
58 assert((NewDecl->getFriendObjectKind() ||
59 !OldDecl->getLexicalDeclContext()->isDependentContext()) &&
60 "non-friend with qualified name defined in dependent context");
63 const_cast<DeclContext *
>(NewDecl->getFriendObjectKind()
64 ? NewDecl->getLexicalDeclContext()
65 : OldDecl->getLexicalDeclContext()));
74 NewDecl->setQualifierInfo(NewQualifierLoc);
80 return ::SubstQualifier(SemaRef, OldDecl, NewDecl, TemplateArgs);
85 return ::SubstQualifier(SemaRef, OldDecl, NewDecl, TemplateArgs);
89#include "clang/Sema/AttrTemplateInstantiate.inc"
93 const AlignedAttr *Aligned,
Decl *
New,
bool IsPackExpansion) {
94 if (Aligned->isAlignmentExpr()) {
99 if (!Result.isInvalid())
103 S.
SubstType(Aligned->getAlignmentType(), TemplateArgs,
106 Aligned->getLocation(),
107 Result->getTypeLoc().getSourceRange()))
115 const AlignedAttr *Aligned,
Decl *
New) {
116 if (!Aligned->isPackExpansion()) {
122 if (Aligned->isAlignmentExpr())
128 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
131 bool Expand =
true, RetainExpansion =
false;
136 Unexpanded, TemplateArgs,
138 Expand, RetainExpansion, NumExpansions))
145 for (
unsigned I = 0; I != *NumExpansions; ++I) {
154 const AssumeAlignedAttr *Aligned,
Decl *
New) {
159 Expr *E, *OE =
nullptr;
161 if (Result.isInvalid())
163 E = Result.getAs<
Expr>();
165 if (Aligned->getOffset()) {
166 Result = S.
SubstExpr(Aligned->getOffset(), TemplateArgs);
167 if (Result.isInvalid())
169 OE = Result.getAs<
Expr>();
177 const AlignValueAttr *Aligned,
Decl *
New) {
182 if (!Result.isInvalid())
188 const AllocAlignAttr *Align,
Decl *
New) {
191 llvm::APInt(64, Align->getParamIndex().getSourceIndex()),
204 bool HasDelayedArgs =
Attr->delayedArgs_size();
213 false, TemplateArgs, Args))
216 StringRef Str =
Attr->getAnnotation();
217 if (HasDelayedArgs) {
218 if (Args.size() < 1) {
228 ActualArgs.insert(ActualArgs.begin(), Args.begin() + 1, Args.end());
229 std::swap(Args, ActualArgs);
237template <
typename Attr>
241 Expr *tempInstPriority =
nullptr;
246 if (Result.isInvalid())
248 if (Result.isUsable()) {
249 tempInstPriority = Result.get();
250 if (std::optional<llvm::APSInt> CE =
254 if (!CE->isIntN(32)) {
256 <<
toString(*CE, 10,
false) << 32 << 1;
262 New->addAttr(Attr::Create(
C, tempInstPriority, *A));
274 if (Result.isInvalid())
278 if (!
Cond->isTypeDependent()) {
288 S.
Diag(A->
getLocation(), diag::err_attr_cond_never_constant_expr) << A;
289 for (
const auto &P : Diags)
290 S.
Diag(P.first, P.second);
300 S, TemplateArgs, EIA, EIA->getCond(), Tmpl,
New);
304 Cond, EIA->getMessage()));
311 S, TemplateArgs, DIA, DIA->getCond(), Tmpl,
New);
316 DIA->getDefaultSeverity(), DIA->getWarningGroup(),
317 DIA->getArgDependent(),
New));
330 if (Result.isInvalid())
332 Expr *MaxThreads = Result.getAs<
Expr>();
334 Expr *MinBlocks =
nullptr;
335 if (
Attr.getMinBlocks()) {
337 if (Result.isInvalid())
342 Expr *MaxBlocks =
nullptr;
343 if (
Attr.getMaxBlocks()) {
345 if (Result.isInvalid())
347 MaxBlocks = Result.getAs<
Expr>();
366 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(
New))
367 New = FTD->getTemplatedDecl();
369 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
374 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
375 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
378 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
379 Local.InstantiatedLocal(
380 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
384 FD->isCXXInstanceMember());
400 if (
auto *E =
Attr.getSimdlen())
403 if (
Attr.uniforms_size() > 0) {
404 for(
auto *E :
Attr.uniforms()) {
408 Uniforms.push_back(Inst.
get());
412 auto AI =
Attr.alignments_begin();
413 for (
auto *E :
Attr.aligneds()) {
417 Aligneds.push_back(Inst.
get());
421 Alignments.push_back(Inst.
get());
425 auto SI =
Attr.steps_begin();
426 for (
auto *E :
Attr.linears()) {
430 Linears.push_back(Inst.
get());
434 Steps.push_back(Inst.
get());
437 LinModifiers.append(
Attr.modifiers_begin(),
Attr.modifiers_end());
440 Uniforms, Aligneds, Alignments, Linears, LinModifiers, Steps,
449 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(
New))
450 New = FTD->getTemplatedDecl();
452 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
454 auto &&SubstExpr = [FD, ThisContext, &S, &TemplateArgs](
Expr *E) {
455 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
456 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
459 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
460 Local.InstantiatedLocal(
461 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
465 FD->isCXXInstanceMember());
471 auto &&Subst = [&SubstExpr, &S](
Expr *E) {
481 if (
Expr *E =
Attr.getVariantFuncRef()) {
486 VariantFuncRef = Subst(E);
492 TI = *
Attr.getTraitInfos();
495 auto SubstScoreOrConditionExpr = [&S, Subst](
Expr *&E,
bool) {
510 Expr *E = VariantFuncRef.
get();
514 std::optional<std::pair<FunctionDecl *, Expr *>> DeclVarData =
522 E = DeclVarData->second;
523 FD = DeclVarData->first;
525 if (
auto *VariantDRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) {
526 if (
auto *VariantFD = dyn_cast<FunctionDecl>(VariantDRE->getDecl())) {
527 if (
auto *VariantFTD = VariantFD->getDescribedFunctionTemplate()) {
528 if (!VariantFTD->isThisDeclarationADefinition())
539 SubstFD->getType(), FD->getType(),
545 New->getLocation(), SubstFD,
true,
547 SubstFD->setInstantiationIsPending(!SubstFD->isDefined());
551 SubstFD->getLocation(),
562 for (
Expr *E :
Attr.adjustArgsNothing()) {
566 NothingExprs.push_back(ER.
get());
568 for (
Expr *E :
Attr.adjustArgsNeedDevicePtr()) {
572 NeedDevicePtrExprs.push_back(ER.
get());
574 for (
Expr *E :
Attr.adjustArgsNeedDeviceAddr()) {
578 NeedDeviceAddrExprs.push_back(ER.
get());
582 AppendArgs.emplace_back(II.IsTarget, II.IsTargetSync);
586 FD, E, TI, NothingExprs, NeedDevicePtrExprs, NeedDeviceAddrExprs,
592 const AMDGPUFlatWorkGroupSizeAttr &
Attr,
Decl *
New) {
598 if (Result.isInvalid())
600 Expr *MinExpr = Result.getAs<
Expr>();
603 if (Result.isInvalid())
605 Expr *MaxExpr = Result.getAs<
Expr>();
618 if (Result.isInvalid())
623 if (Result.isInvalid())
628 if (Result.isInvalid())
633 New->addAttr(::new (Context) ReqdWorkGroupSizeAttr(Context,
Attr,
X, Y, Z));
652 if (!
Cond->isTypeDependent())
665 if (Result.isInvalid())
667 Expr *MinExpr = Result.getAs<
Expr>();
669 Expr *MaxExpr =
nullptr;
670 if (
auto Max =
Attr.getMax()) {
672 if (Result.isInvalid())
682 const AMDGPUMaxNumWorkGroupsAttr &
Attr,
Decl *
New) {
686 Expr *XExpr =
nullptr;
687 Expr *YExpr =
nullptr;
688 Expr *ZExpr =
nullptr;
690 if (
Attr.getMaxNumWorkGroupsX()) {
696 if (
Attr.getMaxNumWorkGroupsY()) {
702 if (
Attr.getMaxNumWorkGroupsZ()) {
718 auto SubstElt = [&S, &TemplateArgs](
Expr *E) {
719 return E ? S.
SubstExpr(E, TemplateArgs).
get() :
nullptr;
722 Expr *XExpr = SubstElt(
Attr.getX());
723 Expr *YExpr = SubstElt(
Attr.getY());
724 Expr *ZExpr = SubstElt(
Attr.getZ());
744 if (
const auto *PNA = dyn_cast<PreferredNameAttr>(A)) {
747 if (!T->isDependentType() && !RD->isDependentContext() &&
750 for (
const auto *ExistingPNA : D->
specific_attrs<PreferredNameAttr>())
752 PNA->getTypedefType()))
757 if (
const auto *BA = dyn_cast<BuiltinAttr>(A)) {
759 switch (BA->getID()) {
760 case Builtin::BIforward:
770 case Builtin::BImove:
771 case Builtin::BImove_if_noexcept:
798 <<
Attr <<
"'groupshared'";
810 "out or inout parameter type must be a reference and restrict qualified");
814 const MallocSpanAttr *
Attr,
829 for (
const auto *TmplAttr : Tmpl->
attrs()) {
836 *
this, dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext()),
840 TmplAttr,
Context, *
this, TemplateArgs);
842 New->addAttr(NewAttr);
850 case clang::attr::CFConsumed:
852 case clang::attr::OSConsumed:
854 case clang::attr::NSConsumed:
857 llvm_unreachable(
"Wrong argument supplied");
864 const OpenACCRoutineDeclAttr *OldAttr,
const Decl *Old,
Decl *
New);
870 for (
const auto *TmplAttr : Tmpl->
attrs()) {
875 const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
876 if (Aligned && Aligned->isAlignmentDependent()) {
881 if (
const auto *AssumeAligned = dyn_cast<AssumeAlignedAttr>(TmplAttr)) {
886 if (
const auto *AlignValue = dyn_cast<AlignValueAttr>(TmplAttr)) {
891 if (
const auto *AllocAlign = dyn_cast<AllocAlignAttr>(TmplAttr)) {
896 if (
const auto *Annotate = dyn_cast<AnnotateAttr>(TmplAttr)) {
901 if (
auto *
Constructor = dyn_cast<ConstructorAttr>(TmplAttr)) {
907 if (
auto *
Destructor = dyn_cast<DestructorAttr>(TmplAttr)) {
913 if (
const auto *EnableIf = dyn_cast<EnableIfAttr>(TmplAttr)) {
919 if (
const auto *DiagnoseIf = dyn_cast<DiagnoseIfAttr>(TmplAttr)) {
925 if (
const auto *CUDALaunchBounds =
926 dyn_cast<CUDALaunchBoundsAttr>(TmplAttr)) {
928 *CUDALaunchBounds,
New);
932 if (
const auto *Mode = dyn_cast<ModeAttr>(TmplAttr)) {
937 if (
const auto *OMPAttr = dyn_cast<OMPDeclareSimdDeclAttr>(TmplAttr)) {
942 if (
const auto *OMPAttr = dyn_cast<OMPDeclareVariantAttr>(TmplAttr)) {
947 if (
const auto *ReqdWorkGroupSize =
948 dyn_cast<ReqdWorkGroupSizeAttr>(TmplAttr)) {
950 *ReqdWorkGroupSize,
New);
953 if (
const auto *AMDGPUFlatWorkGroupSize =
954 dyn_cast<AMDGPUFlatWorkGroupSizeAttr>(TmplAttr)) {
956 *
this, TemplateArgs, *AMDGPUFlatWorkGroupSize,
New);
959 if (
const auto *AMDGPUFlatWorkGroupSize =
960 dyn_cast<AMDGPUWavesPerEUAttr>(TmplAttr)) {
962 *AMDGPUFlatWorkGroupSize,
New);
965 if (
const auto *AMDGPUMaxNumWorkGroups =
966 dyn_cast<AMDGPUMaxNumWorkGroupsAttr>(TmplAttr)) {
968 *
this, TemplateArgs, *AMDGPUMaxNumWorkGroups,
New);
971 if (
const auto *CUDAClusterDims = dyn_cast<CUDAClusterDimsAttr>(TmplAttr)) {
973 *CUDAClusterDims,
New);
976 if (
const auto *ParamAttr = dyn_cast<HLSLParamModifierAttr>(TmplAttr)) {
982 if (
const auto *RoutineAttr = dyn_cast<OpenACCRoutineDeclAttr>(TmplAttr)) {
984 RoutineAttr, Tmpl,
New);
989 if (TmplAttr->getKind() == attr::DLLExport ||
990 TmplAttr->getKind() == attr::DLLImport) {
991 if (
New->hasAttr<DLLExportAttr>() ||
New->hasAttr<DLLImportAttr>()) {
996 if (
const auto *ABIAttr = dyn_cast<ParameterABIAttr>(TmplAttr)) {
1009 if (
auto *A = dyn_cast<PointerAttr>(TmplAttr)) {
1010 if (!
New->hasAttr<PointerAttr>())
1015 if (
auto *A = dyn_cast<OwnerAttr>(TmplAttr)) {
1016 if (!
New->hasAttr<OwnerAttr>())
1021 if (
auto *A = dyn_cast<SYCLKernelAttr>(TmplAttr)) {
1026 if (
auto *A = dyn_cast<CUDAGridConstantAttr>(TmplAttr)) {
1027 if (!
New->hasAttr<CUDAGridConstantAttr>())
1032 if (
auto *A = dyn_cast<MallocSpanAttr>(TmplAttr)) {
1037 if (
auto *A = dyn_cast<CleanupAttr>(TmplAttr)) {
1038 if (!
New->hasAttr<CleanupAttr>()) {
1039 auto *NewAttr = A->clone(
Context);
1040 NewAttr->setArgLoc(A->getArgLoc());
1041 New->addAttr(NewAttr);
1046 assert(!TmplAttr->isPackExpansion());
1047 if (TmplAttr->isLateParsed() && LateAttrs) {
1057 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext());
1059 ND->isCXXInstanceMember());
1062 *
this, TemplateArgs);
1064 New->addAttr(NewAttr);
1070 for (
const auto *
Attr : Pattern->
attrs()) {
1071 if (
auto *A = dyn_cast<StrictFPAttr>(
Attr)) {
1072 if (!Inst->
hasAttr<StrictFPAttr>())
1080 assert(
Context.getTargetInfo().getCXXABI().isMicrosoft() &&
1085 DLLExportAttr *
Attr = Ctor->
getAttr<DLLExportAttr>();
1088 for (
unsigned I = 0; I != NumParams; ++I) {
1099template<
typename DeclT>
1101 DeclT *Result = D->getPreviousDecl();
1107 D->getLexicalDeclContext() != Result->getLexicalDeclContext())
1115 llvm_unreachable(
"Translation units cannot be instantiated");
1119 llvm_unreachable(
"HLSL buffer declarations cannot be instantiated");
1122Decl *TemplateDeclInstantiator::VisitHLSLRootSignatureDecl(
1124 llvm_unreachable(
"HLSL root signature declarations cannot be instantiated");
1129 llvm_unreachable(
"pragma comment cannot be instantiated");
1132Decl *TemplateDeclInstantiator::VisitPragmaDetectMismatchDecl(
1134 llvm_unreachable(
"pragma comment cannot be instantiated");
1139 llvm_unreachable(
"extern \"C\" context cannot be instantiated");
1143 llvm_unreachable(
"GUID declaration cannot be instantiated");
1146Decl *TemplateDeclInstantiator::VisitUnnamedGlobalConstantDecl(
1148 llvm_unreachable(
"UnnamedGlobalConstantDecl cannot be instantiated");
1151Decl *TemplateDeclInstantiator::VisitTemplateParamObjectDecl(
1153 llvm_unreachable(
"template parameter objects cannot be instantiated");
1157TemplateDeclInstantiator::VisitLabelDecl(
LabelDecl *D) {
1160 SemaRef.InstantiateAttrs(TemplateArgs, D, Inst, LateAttrs, StartingScope);
1161 Owner->addDecl(Inst);
1166TemplateDeclInstantiator::VisitNamespaceDecl(
NamespaceDecl *D) {
1167 llvm_unreachable(
"Namespaces cannot be instantiated");
1171class OpenACCDeclClauseInstantiator final
1174 const MultiLevelTemplateArgumentList &MLTAL;
1175 ArrayRef<OpenACCClause *> ExistingClauses;
1176 SemaOpenACC::OpenACCParsedClause &ParsedClause;
1177 OpenACCClause *NewClause =
nullptr;
1180 OpenACCDeclClauseInstantiator(Sema &S,
1181 const MultiLevelTemplateArgumentList &MLTAL,
1182 ArrayRef<OpenACCClause *> ExistingClauses,
1183 SemaOpenACC::OpenACCParsedClause &ParsedClause)
1184 : SemaRef(S), MLTAL(MLTAL), ExistingClauses(ExistingClauses),
1185 ParsedClause(ParsedClause) {}
1187 OpenACCClause *CreatedClause() {
return NewClause; }
1188#define VISIT_CLAUSE(CLAUSE_NAME) \
1189 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
1190#include "clang/Basic/OpenACCClauses.def"
1194 for (
Expr *CurVar : VarList) {
1195 ExprResult Res = SemaRef.SubstExpr(CurVar, MLTAL);
1204 InstantiatedVarList.push_back(Res.
get());
1206 return InstantiatedVarList;
1210#define CLAUSE_NOT_ON_DECLS(CLAUSE_NAME) \
1211 void OpenACCDeclClauseInstantiator::Visit##CLAUSE_NAME##Clause( \
1212 const OpenACC##CLAUSE_NAME##Clause &) { \
1213 llvm_unreachable("Clause type invalid on declaration construct, or " \
1214 "instantiation not implemented"); \
1243#undef CLAUSE_NOT_ON_DECLS
1245void OpenACCDeclClauseInstantiator::VisitGangClause(
1249 assert(
C.getNumExprs() <= 1 &&
1250 "Only 1 expression allowed on gang clause in routine");
1252 if (
C.getNumExprs() > 0) {
1254 "Only dim allowed on routine");
1256 SemaRef.SubstExpr(
const_cast<Expr *
>(
C.getExpr(0).second), MLTAL);
1258 ER = SemaRef.OpenACC().CheckGangExpr(ExistingClauses,
1259 ParsedClause.getDirectiveKind(),
1260 C.getExpr(0).first, ER.
get());
1263 TransformedIntExprs.push_back(ER.
get());
1268 NewClause = SemaRef.OpenACC().CheckGangClause(
1269 ParsedClause.getDirectiveKind(), ExistingClauses,
1270 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
1271 TransformedGangKinds, TransformedIntExprs, ParsedClause.getEndLoc());
1276 ParsedClause.getBeginLoc(),
1277 ParsedClause.getEndLoc());
1279void OpenACCDeclClauseInstantiator::VisitNoHostClause(
1282 ParsedClause.getBeginLoc(),
1283 ParsedClause.getEndLoc());
1286void OpenACCDeclClauseInstantiator::VisitDeviceTypeClause(
1290 SemaRef.getASTContext(),
C.getClauseKind(), ParsedClause.getBeginLoc(),
1291 ParsedClause.getLParenLoc(),
C.getArchitectures(),
1292 ParsedClause.getEndLoc());
1295void OpenACCDeclClauseInstantiator::VisitWorkerClause(
1297 assert(!
C.hasIntExpr() &&
"Int Expr not allowed on routine 'worker' clause");
1299 ParsedClause.getBeginLoc(), {},
1300 nullptr, ParsedClause.getEndLoc());
1303void OpenACCDeclClauseInstantiator::VisitVectorClause(
1305 assert(!
C.hasIntExpr() &&
"Int Expr not allowed on routine 'vector' clause");
1307 ParsedClause.getBeginLoc(), {},
1308 nullptr, ParsedClause.getEndLoc());
1311void OpenACCDeclClauseInstantiator::VisitCopyClause(
1313 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
1314 C.getModifierList());
1315 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
C.getModifierList()))
1318 SemaRef.getASTContext(), ParsedClause.getClauseKind(),
1319 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
1320 ParsedClause.getModifierList(), ParsedClause.getVarList(),
1321 ParsedClause.getEndLoc());
1324void OpenACCDeclClauseInstantiator::VisitLinkClause(
1326 ParsedClause.setVarListDetails(
1327 SemaRef.OpenACC().CheckLinkClauseVarList(VisitVarList(
C.getVarList())),
1330 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
1335 SemaRef.getASTContext(), ParsedClause.getBeginLoc(),
1336 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
1337 ParsedClause.getEndLoc());
1340void OpenACCDeclClauseInstantiator::VisitDeviceResidentClause(
1342 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
1344 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
1348 SemaRef.getASTContext(), ParsedClause.getBeginLoc(),
1349 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
1350 ParsedClause.getEndLoc());
1353void OpenACCDeclClauseInstantiator::VisitCopyInClause(
1355 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
1356 C.getModifierList());
1358 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
C.getModifierList()))
1361 SemaRef.getASTContext(), ParsedClause.getClauseKind(),
1362 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
1363 ParsedClause.getModifierList(), ParsedClause.getVarList(),
1364 ParsedClause.getEndLoc());
1366void OpenACCDeclClauseInstantiator::VisitCopyOutClause(
1368 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
1369 C.getModifierList());
1371 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
C.getModifierList()))
1374 SemaRef.getASTContext(), ParsedClause.getClauseKind(),
1375 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
1376 ParsedClause.getModifierList(), ParsedClause.getVarList(),
1377 ParsedClause.getEndLoc());
1379void OpenACCDeclClauseInstantiator::VisitCreateClause(
1381 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
1382 C.getModifierList());
1384 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
C.getModifierList()))
1387 SemaRef.getASTContext(), ParsedClause.getClauseKind(),
1388 ParsedClause.getBeginLoc(), ParsedClause.getLParenLoc(),
1389 ParsedClause.getModifierList(), ParsedClause.getVarList(),
1390 ParsedClause.getEndLoc());
1392void OpenACCDeclClauseInstantiator::VisitPresentClause(
1394 ParsedClause.setVarListDetails(VisitVarList(
C.getVarList()),
1396 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
1400 SemaRef.getASTContext(), ParsedClause.getBeginLoc(),
1401 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
1402 ParsedClause.getEndLoc());
1404void OpenACCDeclClauseInstantiator::VisitDevicePtrClause(
1408 llvm::erase_if(VarList, [&](
Expr *E) {
1413 if (SemaRef.OpenACC().CheckDeclareClause(ParsedClause,
1417 SemaRef.getASTContext(), ParsedClause.getBeginLoc(),
1418 ParsedClause.getLParenLoc(), ParsedClause.getVarList(),
1419 ParsedClause.getEndLoc());
1422void OpenACCDeclClauseInstantiator::VisitBindClause(
1425 if (
C.isStringArgument())
1427 SemaRef.getASTContext(), ParsedClause.getBeginLoc(),
1428 ParsedClause.getLParenLoc(),
C.getStringArgument(),
1429 ParsedClause.getEndLoc());
1432 SemaRef.getASTContext(), ParsedClause.getBeginLoc(),
1433 ParsedClause.getLParenLoc(),
C.getIdentifierArgument(),
1434 ParsedClause.getEndLoc());
1442 for (
const auto *Clause : ClauseList) {
1444 Clause->getBeginLoc());
1445 ParsedClause.setEndLoc(Clause->getEndLoc());
1446 if (
const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(Clause))
1447 ParsedClause.setLParenLoc(WithParms->getLParenLoc());
1449 OpenACCDeclClauseInstantiator Instantiator{S, MLTAL, TransformedClauses,
1451 Instantiator.Visit(Clause);
1452 if (Instantiator.CreatedClause())
1453 TransformedClauses.push_back(Instantiator.CreatedClause());
1455 return TransformedClauses;
1462 const OpenACCRoutineDeclAttr *OldAttr,
const Decl *OldDecl,
Decl *NewDecl) {
1463 OpenACCRoutineDeclAttr *A =
1464 OpenACCRoutineDeclAttr::Create(S.
getASTContext(), OldAttr->getLocation());
1466 if (!OldAttr->Clauses.empty()) {
1468 InstantiateOpenACCClauseList(
1470 A->Clauses.assign(TransformedClauses.begin(), TransformedClauses.end());
1481 llvm::SmallVector<OpenACCClause *> TransformedClauses =
1485 if (SemaRef.OpenACC().ActOnStartDeclDirective(
1489 DeclGroupRef Res = SemaRef.OpenACC().ActOnEndDeclDirective(
1501 llvm::SmallVector<OpenACCClause *> TransformedClauses =
1509 FuncRef = SemaRef.OpenACC().ActOnRoutineName(FuncRef.
get());
1514 if (SemaRef.OpenACC().ActOnStartDeclDirective(
1518 DeclGroupRef Res = SemaRef.OpenACC().ActOnEndRoutineDeclDirective(
1530 NamespaceAliasDecl *Inst
1538 Owner->addDecl(Inst);
1548 TSI = SemaRef.SubstType(TSI, TemplateArgs, D->
getLocation(),
1552 TSI = SemaRef.Context.getTrivialTypeSourceInfo(SemaRef.Context.IntTy);
1563 if (SemaRef.getPreprocessor().NeedsStdLibCxxWorkaroundBefore(2014'04'22)) {
1564 const DecltypeType *DT = TSI->
getType()->
getAs<DecltypeType>();
1567 DT->isReferenceType() &&
1568 RD->getEnclosingNamespaceContext() == SemaRef.getStdNamespace() &&
1569 RD->getIdentifier() && RD->getIdentifier()->isStr(
"common_type") &&
1571 SemaRef.getSourceManager().isInSystemHeader(D->
getBeginLoc()))
1573 TSI = SemaRef.Context.getTrivialTypeSourceInfo(
1591 TagDecl *oldTag = oldTagType->getDecl();
1608 SemaRef.isIncompatibleTypedef(InstPrevTypedef,
Typedef);
1610 Typedef->setPreviousDecl(InstPrevTypedef);
1613 SemaRef.InstantiateAttrs(TemplateArgs, D,
Typedef);
1616 SemaRef.inferGslPointerAttribute(
Typedef);
1665 if (!
Found.empty()) {
1666 PrevAliasTemplate = dyn_cast<TypeAliasTemplateDecl>(
Found.front());
1679 if (PrevAliasTemplate)
1684 if (!PrevAliasTemplate)
1711 SmallVector<BindingDecl*, 16> NewBindings;
1712 BindingDecl *OldBindingPack =
nullptr;
1713 for (
auto *OldBD : D->
bindings()) {
1714 Expr *BindingExpr = OldBD->getBinding();
1715 if (isa_and_present<FunctionParmPackExpr>(BindingExpr)) {
1717 assert(!OldBindingPack &&
"no more than one pack is allowed");
1718 OldBindingPack = OldBD;
1722 ArrayRef<BindingDecl*> NewBindingArray = NewBindings;
1724 auto *NewDD = cast_if_present<DecompositionDecl>(
1727 if (!NewDD || NewDD->isInvalidDecl()) {
1728 for (
auto *NewBD : NewBindings)
1729 NewBD->setInvalidDecl();
1730 }
else if (OldBindingPack) {
1733 BindingDecl *NewBindingPack = *llvm::find_if(
1735 assert(NewBindingPack !=
nullptr &&
"new bindings should also have a pack");
1736 llvm::ArrayRef<BindingDecl *> OldDecls =
1738 llvm::ArrayRef<BindingDecl *> NewDecls =
1740 assert(OldDecls.size() == NewDecls.size());
1741 for (
unsigned I = 0; I < OldDecls.size(); I++)
1742 SemaRef.CurrentInstantiationScope->InstantiatedLocal(OldDecls[I],
1754 bool InstantiatingVarTemplate,
1765 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
1798 StartingScope, InstantiatingVarTemplate);
1801 if (
auto *F = dyn_cast<FunctionDecl>(DC))
1802 RT = F->getReturnType();
1807 llvm_unreachable(
"Unknown context type");
1828 SemaRef.CheckStaticLocalForDllExport(Var);
1831 SemaRef.CheckThreadLocalForLargeAlignment(Var);
1833 if (SemaRef.getLangOpts().OpenACC)
1834 SemaRef.OpenACC().ActOnVariableDeclarator(Var);
1843 Owner->addHiddenDecl(AD);
1847Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
1852 TSI = SemaRef.SubstType(TSI, TemplateArgs, D->
getLocation(),
1864 SemaRef.Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
1875 else if (BitWidth) {
1881 = SemaRef.SubstExpr(BitWidth, TemplateArgs);
1886 BitWidth = InstantiatedBitWidth.
getAs<Expr>();
1889 FieldDecl *
Field = SemaRef.CheckFieldDecl(
1898 SemaRef.InstantiateAttrs(TemplateArgs, D, Field, LateAttrs, StartingScope);
1900 if (
Field->hasAttrs())
1901 SemaRef.CheckAlignasUnderalignment(Field);
1904 Field->setInvalidDecl();
1906 if (!
Field->getDeclName() ||
Field->isPlaceholderVar(SemaRef.getLangOpts())) {
1908 SemaRef.Context.setInstantiatedFromUnnamedFieldDecl(Field, D);
1910 if (CXXRecordDecl *Parent= dyn_cast<CXXRecordDecl>(
Field->getDeclContext())) {
1911 if (Parent->isAnonymousStructOrUnion() &&
1912 Parent->getRedeclContext()->isFunctionOrMethod())
1913 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Field);
1918 Owner->addDecl(Field);
1928 SemaRef.Diag(D->
getLocation(), diag::err_property_is_variably_modified)
1932 TSI = SemaRef.SubstType(TSI, TemplateArgs, D->
getLocation(),
1944 SemaRef.Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
1957 SemaRef.InstantiateAttrs(TemplateArgs, D,
Property, LateAttrs,
1970 NamedDecl **NamedChain =
1974 for (
auto *PI : D->
chain()) {
1980 NamedChain[i++] =
Next;
1986 {NamedChain, D->getChainingSize()});
1988 for (
const auto *Attr : D->
attrs())
1989 IndirectField->
addAttr(Attr->clone(SemaRef.Context));
1993 Owner->addDecl(IndirectField);
1994 return IndirectField;
2001 TypeSourceInfo *InstTy;
2010 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
2011 SemaRef.collectUnexpandedParameterPacks(Ty->getTypeLoc(), Unexpanded);
2012 assert(!Unexpanded.empty() &&
"Pack expansion without packs");
2014 bool ShouldExpand =
true;
2015 bool RetainExpansion =
false;
2016 UnsignedOrNone NumExpansions = std::nullopt;
2017 if (SemaRef.CheckParameterPacksForExpansion(
2020 ShouldExpand, RetainExpansion, NumExpansions))
2023 assert(!RetainExpansion &&
2024 "should never retain an expansion for a variadic friend decl");
2027 SmallVector<FriendDecl *> Decls;
2028 for (
unsigned I = 0; I != *NumExpansions; I++) {
2029 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, I);
2030 TypeSourceInfo *TSI = SemaRef.SubstType(
2041 Decls.push_back(FD);
2049 InstTy = SemaRef.SubstType(Ty, TemplateArgs, D->
getLocation(),
2064 assert(ND &&
"friend decl must be a decl or a type!");
2071 if (!NewND)
return nullptr;
2090 = SemaRef.SubstExpr(AssertExpr, TemplateArgs);
2095 SemaRef.SubstExpr(D->
getMessage(), TemplateArgs);
2096 if (InstantiatedMessageExpr.
isInvalid())
2099 return SemaRef.BuildStaticAssertDeclaration(
2104Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
2105 EnumDecl *PrevDecl =
nullptr;
2107 NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->
getLocation(),
2110 if (!Prev)
return nullptr;
2123 SourceLocation UnderlyingLoc = TI->getTypeLoc().getBeginLoc();
2124 TypeSourceInfo *NewTI = SemaRef.SubstType(TI, TemplateArgs, UnderlyingLoc,
2126 if (!NewTI || SemaRef.CheckEnumUnderlyingType(NewTI))
2127 Enum->setIntegerType(SemaRef.Context.IntTy);
2137 Enum->setIntegerTypeSourceInfo(NewTI);
2147 QualType UnderlyingType =
Enum->getIntegerType();
2148 Enum->setPromotionType(
2149 SemaRef.Context.isPromotableIntegerType(UnderlyingType)
2150 ? SemaRef.Context.getPromotedIntegerType(UnderlyingType)
2154 &&
"Dependent type without type source info");
2159 SemaRef.InstantiateAttrs(TemplateArgs, D,
Enum);
2164 SemaRef.Context.setManglingNumber(
Enum, SemaRef.Context.getManglingNumber(D));
2167 if (DeclaratorDecl *DD = SemaRef.Context.getDeclaratorForUnnamedTagDecl(D))
2168 SemaRef.Context.addDeclaratorForUnnamedTagDecl(
Enum, DD);
2171 if (TypedefNameDecl *TND = SemaRef.Context.getTypedefNameForUnnamedTagDecl(D))
2172 SemaRef.Context.addTypedefNameForUnnamedTagDecl(
Enum, TND);
2174 Owner->addDecl(
Enum);
2177 if (Def && Def != D) {
2182 SourceLocation UnderlyingLoc = TI->getTypeLoc().getBeginLoc();
2183 QualType DefnUnderlying =
2184 SemaRef.SubstType(TI->getType(), TemplateArgs,
2185 UnderlyingLoc, DeclarationName());
2187 DefnUnderlying,
true,
Enum);
2202 if (PrevDecl ==
nullptr) {
2203 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D,
Enum);
2213 Enum->startDefinition();
2224 if (
Expr *UninstValue = EC->getInitExpr()) {
2229 Value = SemaRef.SubstExpr(UninstValue, TemplateArgs);
2234 if (
Value.isInvalid()) {
2240 = SemaRef.CheckEnumConstant(
Enum, LastEnumConst,
2247 Enum->setInvalidDecl();
2251 SemaRef.InstantiateAttrs(TemplateArgs, EC, EnumConst);
2254 Enum->addDecl(EnumConst);
2255 Enumerators.push_back(EnumConst);
2256 LastEnumConst = EnumConst;
2259 !
Enum->isScoped()) {
2262 SemaRef.CurrentInstantiationScope->InstantiatedLocal(EC, EnumConst);
2267 SemaRef.ActOnEnumBody(
Enum->getLocation(),
Enum->getBraceRange(),
Enum,
2272 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
2277 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
2285 LocalInstantiationScope Scope(SemaRef);
2298 QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
2304 CXXRecordDecl *PrevDecl =
nullptr;
2305 ClassTemplateDecl *PrevClassTemplate =
nullptr;
2309 if (!
Found.empty()) {
2310 PrevClassTemplate = dyn_cast<ClassTemplateDecl>(
Found.front());
2311 if (PrevClassTemplate)
2320 DeclContext *DC = Owner;
2324 SS.
Adopt(QualifierLoc);
2325 DC = SemaRef.computeDeclContext(SS);
2326 if (!DC)
return nullptr;
2328 DC = SemaRef.FindInstantiatedContext(Pattern->
getLocation(),
2337 SemaRef.forRedeclarationInCurContext());
2338 SemaRef.LookupQualifiedName(R, DC);
2340 if (
R.isSingleResult()) {
2341 PrevClassTemplate =
R.getAsSingle<ClassTemplateDecl>();
2342 if (PrevClassTemplate)
2346 if (!PrevClassTemplate && QualifierLoc) {
2347 SemaRef.Diag(Pattern->
getLocation(), diag::err_not_tag_in_scope)
2360 SemaRef.InstantiateAttrsForDecl(TemplateArgs, Pattern, RecordInst, LateAttrs,
2363 ClassTemplateDecl *Inst
2369 assert(!Owner->isDependentContext());
2374 if (PrevClassTemplate) {
2376 const ClassTemplateDecl *MostRecentPrevCT =
2378 TemplateParameterList *PrevParams =
2382 if (!SemaRef.TemplateParameterListsAreEqual(
2389 if (SemaRef.CheckTemplateParameterList(InstParams, PrevParams,
2403 if (!PrevClassTemplate)
2420 Owner->addDecl(Inst);
2422 if (!PrevClassTemplate) {
2426 SmallVector<ClassTemplatePartialSpecializationDecl *, 4> PartialSpecs;
2428 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
2429 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
2430 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[I]));
2437TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
2448 ClassTemplateDecl *InstClassTemplate
2449 = dyn_cast<ClassTemplateDecl>(
Found.front());
2450 if (!InstClassTemplate)
2453 if (ClassTemplatePartialSpecializationDecl *
Result
2462 "Only static data member templates are allowed.");
2466 LocalInstantiationScope Scope(SemaRef);
2473 VarTemplateDecl *PrevVarTemplate =
nullptr;
2478 PrevVarTemplate = dyn_cast<VarTemplateDecl>(
Found.front());
2484 if (!VarInst)
return nullptr;
2486 DeclContext *DC = Owner;
2495 if (!PrevVarTemplate)
2503 Owner->addDecl(Inst);
2505 if (!PrevVarTemplate) {
2509 SmallVector<VarTemplatePartialSpecializationDecl *, 1> PartialSpecs;
2511 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
2512 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
2513 OutOfLineVarPartialSpecs.push_back(
2514 std::make_pair(Inst, PartialSpecs[I]));
2520Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
2523 "Only static data member templates are allowed.");
2529 assert(!
Found.empty() &&
"Instantiation found nothing?");
2531 VarTemplateDecl *InstVarTemplate = dyn_cast<VarTemplateDecl>(
Found.front());
2532 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
2534 if (VarTemplatePartialSpecializationDecl *
Result =
2547 LocalInstantiationScope Scope(SemaRef);
2548 Sema::ConstraintEvalRAII<TemplateDeclInstantiator> RAII(*
this);
2555 FunctionDecl *Instantiated =
nullptr;
2556 if (CXXMethodDecl *DMethod = dyn_cast<CXXMethodDecl>(D->
getTemplatedDecl()))
2569 FunctionTemplateDecl *InstTemplate
2572 assert(InstTemplate &&
2573 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
2585 Owner->addDecl(InstTemplate);
2588 SemaRef.CheckFriendAccess(InstTemplate);
2591 return InstTemplate;
2595 CXXRecordDecl *PrevDecl =
nullptr;
2597 NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->
getLocation(),
2600 if (!Prev)
return nullptr;
2604 CXXRecordDecl *
Record =
nullptr;
2622 SemaRef.InstantiateAttrsForDecl(TemplateArgs, D,
Record, LateAttrs,
2630 if (!IsInjectedClassName)
2636 Record->setObjectOfFriendDecl();
2640 Record->setAnonymousStructOrUnion(
true);
2643 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D,
Record);
2646 SemaRef.Context.setManglingNumber(
Record,
2647 SemaRef.Context.getManglingNumber(D));
2651 if (DeclaratorDecl *DD = SemaRef.Context.getDeclaratorForUnnamedTagDecl(D))
2652 SemaRef.Context.addDeclaratorForUnnamedTagDecl(
Record, DD);
2656 if (TypedefNameDecl *TND = SemaRef.Context.getTypedefNameForUnnamedTagDecl(D))
2657 SemaRef.Context.addTypedefNameForUnnamedTagDecl(
Record, TND);
2664 Sema::LocalEagerInstantiationScope LocalInstantiations(SemaRef,
2679 LocalInstantiations.perform();
2682 SemaRef.DiagnoseUnusedNestedTypedefs(
Record);
2684 if (IsInjectedClassName)
2685 assert(
Record->isInjectedClassName() &&
"Broken injected-class-name");
2703 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
2708 return Context.getFunctionType(NewFunc->getReturnType(),
2709 NewFunc->getParamTypes(), NewEPI);
2733 if (isFriend && Source->wasThisDeclarationADefinition(D)) {
2745 void *InsertPos =
nullptr;
2754 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
2755 Owner->isFunctionOrMethod() ||
2757 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
2761 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
2762 InstantiatedExplicitSpecifier = SemaRef.instantiateExplicitSpecifier(
2763 TemplateArgs, DGuide->getExplicitSpecifier());
2764 if (InstantiatedExplicitSpecifier.
isInvalid())
2774 if (TemplateParams && TemplateParams->
size()) {
2776 dyn_cast<TemplateTypeParmDecl>(TemplateParams->
asArray().back());
2777 if (LastParam && LastParam->isImplicit() &&
2778 LastParam->hasTypeConstraint()) {
2793 QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
2807 SemaRef.adjustContextForLocalExternDecl(DC);
2808 }
else if (isFriend && QualifierLoc) {
2810 SS.
Adopt(QualifierLoc);
2811 DC = SemaRef.computeDeclContext(SS);
2812 if (!DC)
return nullptr;
2819 = SemaRef.SubstDeclarationNameInfo(D->
getNameInfo(), TemplateArgs);
2825 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
2828 InstantiatedExplicitSpecifier, NameInfo, T, TInfo,
2830 DGuide->getDeductionCandidateKind(), TrailingRequiresClause,
2831 DGuide->getSourceDeductionGuide(),
2832 DGuide->getSourceDeductionGuideKind());
2839 TrailingRequiresClause);
2840 Function->setFriendConstraintRefersToEnclosingTemplate(
2849 Function->setQualifierInfo(QualifierLoc);
2860 LexicalDC = SemaRef.CurContext;
2864 Function->setIsTypeAwareOperatorNewOrDelete(
2866 Function->setLexicalDeclContext(LexicalDC);
2869 for (
unsigned P = 0; P < Params.size(); ++P)
2871 Params[P]->setOwningFunction(
Function);
2874 if (TrailingRequiresClause)
2875 Function->setTrailingRequiresClause(TrailingRequiresClause);
2877 if (TemplateParams) {
2905 SemaRef.CodeSynthesisContexts.back().Kind !=
2919 }
else if (!isFriend) {
2923 Function->setInstantiatedFromDecl(D);
2930 FT->setObjectOfFriendDecl();
2936 bool IsExplicitSpecialization =
false;
2943 : SemaRef.forRedeclarationInCurContext());
2947 assert(isFriend &&
"dependent specialization info on "
2948 "non-member non-friend function?");
2952 if (
const auto *ArgsWritten = DFTSI->TemplateArgumentsAsWritten) {
2953 ExplicitArgs.
setLAngleLoc(ArgsWritten->getLAngleLoc());
2954 ExplicitArgs.
setRAngleLoc(ArgsWritten->getRAngleLoc());
2955 if (SemaRef.SubstTemplateArguments(ArgsWritten->arguments(), TemplateArgs,
2963 SemaRef.FindInstantiatedDecl(D->
getLocation(), FTD, TemplateArgs))
2969 if (SemaRef.CheckFunctionTemplateSpecialization(
2971 DFTSI->TemplateArgumentsAsWritten ? &ExplicitArgs :
nullptr,
2975 IsExplicitSpecialization =
true;
2979 SemaRef.LookupQualifiedName(
Previous, DC);
2983 ArgsWritten->getRAngleLoc());
2984 if (SemaRef.SubstTemplateArguments(ArgsWritten->arguments(), TemplateArgs,
2988 if (SemaRef.CheckFunctionTemplateSpecialization(
Function,
2993 IsExplicitSpecialization =
true;
3010 if (isFriend && !QualifierLoc) {
3011 SemaRef.FilterLookupForScope(
Previous, DC,
nullptr,
3030 if (
Function->isLocalExternDecl()) {
3032 if (!PVD->hasDefaultArg())
3034 if (SemaRef.SubstDefaultArgument(D->
getInnerLocStart(), PVD, TemplateArgs)) {
3038 Expr *UninstExpr = PVD->getUninstantiatedDefaultArg();
3039 ExprResult ErrorResult = SemaRef.CreateRecoveryExpr(
3041 { UninstExpr }, UninstExpr->
getType());
3043 PVD->setDefaultArg(ErrorResult.
get());
3049 IsExplicitSpecialization,
3050 Function->isThisDeclarationADefinition());
3057 SemaRef.CheckTemplateParameterList(
3060 Function->isThisDeclarationADefinition()
3071 Function->getMemberSpecializationInfo()) {
3072 if (MSInfo->getPointOfInstantiation().isInvalid()) {
3074 MSInfo->setPointOfInstantiation(Loc);
3075 SemaRef.PendingLocalImplicitInstantiations.emplace_back(
Function, Loc);
3113 void *InsertPos =
nullptr;
3128 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
3130 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
3134 SemaRef, D, TemplateArgs,
Scope);
3138 unsigned NumTempParamLists = 0;
3140 TempParamLists.resize(NumTempParamLists);
3141 for (
unsigned I = 0; I != NumTempParamLists; ++I) {
3146 TempParamLists[I] = InstParams;
3152 const bool CouldInstantiate =
3153 InstantiatedExplicitSpecifier.getExpr() ==
nullptr ||
3154 !InstantiatedExplicitSpecifier.getExpr()->isValueDependent();
3158 if (CouldInstantiate ||
3159 SemaRef.CodeSynthesisContexts.back().Kind !=
3161 InstantiatedExplicitSpecifier = SemaRef.instantiateExplicitSpecifier(
3162 TemplateArgs, InstantiatedExplicitSpecifier);
3164 if (InstantiatedExplicitSpecifier.isInvalid())
3179 SemaRef.Context.getTrivialTypeSourceInfo(D->
getType());
3189 if (TemplateParams && TemplateParams->
size()) {
3191 dyn_cast<TemplateTypeParmDecl>(TemplateParams->
asArray().back());
3192 if (LastParam && LastParam->isImplicit() &&
3193 LastParam->hasTypeConstraint()) {
3208 QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
3218 SS.
Adopt(QualifierLoc);
3219 DC = SemaRef.computeDeclContext(SS);
3221 if (DC && SemaRef.RequireCompleteDeclContext(SS, DC))
3224 DC = SemaRef.FindInstantiatedContext(D->
getLocation(),
3228 if (!DC)
return nullptr;
3235 = SemaRef.SubstDeclarationNameInfo(D->
getNameInfo(), TemplateArgs);
3246 SemaRef.Context,
Record, StartLoc, NameInfo, T, TInfo,
3247 InstantiatedExplicitSpecifier,
Constructor->UsesFPIntrin(),
3250 TrailingRequiresClause);
3254 SemaRef.Context,
Record, StartLoc, NameInfo, T, TInfo,
3256 Destructor->getConstexprKind(), TrailingRequiresClause);
3257 Method->setIneligibleOrNotSelected(
true);
3259 Method->setDeclName(SemaRef.Context.DeclarationNames.getCXXDestructorName(
3261 SemaRef.Context.getCanonicalTagType(
Record)));
3264 SemaRef.Context,
Record, StartLoc, NameInfo, T, TInfo,
3265 Conversion->UsesFPIntrin(), Conversion->isInlineSpecified(),
3266 InstantiatedExplicitSpecifier, Conversion->getConstexprKind(),
3267 Conversion->getEndLoc(), TrailingRequiresClause);
3271 SemaRef.Context,
Record, StartLoc, NameInfo, T, TInfo, SC,
3273 D->
getEndLoc(), TrailingRequiresClause);
3277 Method->setImplicitlyInline();
3280 Method->setQualifierInfo(QualifierLoc);
3282 if (TemplateParams) {
3322 if (NumTempParamLists)
3323 Method->setTemplateParameterListsInfo(
3327 Method->setLexicalDeclContext(Owner);
3328 Method->setObjectOfFriendDecl();
3333 for (
unsigned P = 0; P < Params.size(); ++P)
3334 Params[P]->setOwningFunction(
Method);
3335 Method->setParams(Params);
3338 Method->setInvalidDecl();
3343 bool IsExplicitSpecialization =
false;
3351 if (
const auto *ArgsWritten = DFTSI->TemplateArgumentsAsWritten) {
3352 ExplicitArgs.
setLAngleLoc(ArgsWritten->getLAngleLoc());
3353 ExplicitArgs.
setRAngleLoc(ArgsWritten->getRAngleLoc());
3354 if (SemaRef.SubstTemplateArguments(ArgsWritten->arguments(), TemplateArgs,
3362 SemaRef.FindInstantiatedDecl(D->
getLocation(), FTD, TemplateArgs))
3368 if (SemaRef.CheckFunctionTemplateSpecialization(
3369 Method, DFTSI->TemplateArgumentsAsWritten ? &ExplicitArgs :
nullptr,
3371 Method->setInvalidDecl();
3373 IsExplicitSpecialization =
true;
3376 SemaRef.LookupQualifiedName(
Previous, DC);
3379 ArgsWritten->getRAngleLoc());
3381 if (SemaRef.SubstTemplateArguments(ArgsWritten->arguments(), TemplateArgs,
3385 if (SemaRef.CheckFunctionTemplateSpecialization(
Method,
3388 Method->setInvalidDecl();
3390 IsExplicitSpecialization =
true;
3418 for (
unsigned P = 0; P < Params.size(); ++P) {
3419 if (!Params[P]->hasDefaultArg())
3421 if (SemaRef.SubstDefaultArgument(StartLoc, Params[P], TemplateArgs)) {
3425 Expr *UninstExpr = Params[P]->getUninstantiatedDefaultArg();
3426 ExprResult ErrorResult = SemaRef.CreateRecoveryExpr(
3428 { UninstExpr }, UninstExpr->
getType());
3430 Params[P]->setDefaultArg(ErrorResult.
get());
3436 IsExplicitSpecialization,
3437 Method->isThisDeclarationADefinition());
3445 if (isFriend &&
Method->getPreviousDecl())
3446 Method->setAccess(
Method->getPreviousDecl()->getAccess());
3452 SemaRef.CheckOverrideControl(
Method);
3466 if (IsExplicitSpecialization && !isFriend)
3479 Method->setIneligibleOrNotSelected(
true);
3480 }
else if (
Method->isCopyAssignmentOperator() ||
3481 Method->isMoveAssignmentOperator()) {
3482 Method->setIneligibleOrNotSelected(
true);
3494 }
else if (isFriend) {
3498 SemaRef.CheckFriendAccess(
Method);
3511 if (
Method->hasAttr<UsedAttr>()) {
3512 if (
const auto *A = dyn_cast<CXXRecordDecl>(Owner)) {
3515 A->getMemberSpecializationInfo())
3516 Loc = MSInfo->getPointOfInstantiation();
3517 else if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(A))
3518 Loc = Spec->getPointOfInstantiation();
3519 SemaRef.MarkFunctionReferenced(Loc,
Method);
3539 return SemaRef.SubstParmVarDecl(D, TemplateArgs, 0,
3544Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
3548 UnsignedOrNone NumExpanded = std::nullopt;
3552 assert(TC->getTemplateArgsAsWritten() &&
3553 "type parameter can only be an expansion when explicit arguments "
3558 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
3559 for (
auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())
3560 SemaRef.collectUnexpandedParameterPacks(ArgLoc, Unexpanded);
3565 bool RetainExpansion =
false;
3566 if (SemaRef.CheckParameterPacksForExpansion(
3569 SourceRange(TC->getConceptNameLoc(),
3570 TC->hasExplicitTemplateArgs()
3571 ? TC->getTemplateArgsAsWritten()->getRAngleLoc()
3572 : TC->getConceptNameInfo().getEndLoc()),
3573 Unexpanded, TemplateArgs,
true,
3574 Expand, RetainExpansion, NumExpanded))
3592 if (SemaRef.SubstTypeConstraint(Inst, TC, TemplateArgs,
3593 EvaluateConstraints))
3598 TemplateArgumentLoc Output;
3606 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Inst);
3611Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
3615 SmallVector<TypeSourceInfo *, 4> ExpandedParameterPackTypesAsWritten;
3616 SmallVector<QualType, 4> ExpandedParameterPackTypes;
3617 bool IsExpandedParameterPack =
false;
3618 TypeSourceInfo *TSI;
3628 TypeSourceInfo *NewTSI =
3635 SemaRef.CheckNonTypeTemplateParameterType(NewTSI, D->
getLocation());
3639 ExpandedParameterPackTypesAsWritten.push_back(NewTSI);
3640 ExpandedParameterPackTypes.push_back(NewT);
3643 IsExpandedParameterPack =
true;
3650 PackExpansionTypeLoc Expansion = TL.
castAs<PackExpansionTypeLoc>();
3652 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
3653 SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
3658 bool RetainExpansion =
false;
3659 UnsignedOrNone OrigNumExpansions =
3661 UnsignedOrNone NumExpansions = OrigNumExpansions;
3662 if (SemaRef.CheckParameterPacksForExpansion(
3663 Expansion.
getEllipsisLoc(), Pattern.getSourceRange(), Unexpanded,
3664 TemplateArgs,
true, Expand,
3665 RetainExpansion, NumExpansions))
3669 for (
unsigned I = 0; I != *NumExpansions; ++I) {
3670 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, I);
3671 TypeSourceInfo *NewTSI = SemaRef.SubstType(
3677 SemaRef.CheckNonTypeTemplateParameterType(NewTSI, D->
getLocation());
3681 ExpandedParameterPackTypesAsWritten.push_back(NewTSI);
3682 ExpandedParameterPackTypes.push_back(NewT);
3688 IsExpandedParameterPack =
true;
3694 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, std::nullopt);
3695 TypeSourceInfo *NewPattern = SemaRef.SubstType(Pattern, TemplateArgs,
3701 SemaRef.CheckNonTypeTemplateParameterType(NewPattern, D->
getLocation());
3702 TSI = SemaRef.CheckPackExpansion(NewPattern, Expansion.
getEllipsisLoc(),
3717 T = SemaRef.CheckNonTypeTemplateParameterType(TSI, D->
getLocation());
3719 T = SemaRef.Context.IntTy;
3724 NonTypeTemplateParmDecl *Param;
3725 if (IsExpandedParameterPack)
3728 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
3730 ExpandedParameterPackTypes, ExpandedParameterPackTypesAsWritten);
3734 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
3738 if (AutoLoc.isConstrained()) {
3739 SourceLocation EllipsisLoc;
3740 if (IsExpandedParameterPack)
3743 else if (
auto *Constraint = dyn_cast_if_present<CXXFoldExpr>(
3745 EllipsisLoc = Constraint->getEllipsisLoc();
3749 if (SemaRef.AttachTypeConstraint(AutoLoc, Param,
3760 EnterExpressionEvaluationContext ConstantEvaluated(
3762 TemplateArgumentLoc
Result;
3770 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Param);
3778 for (
const auto &P : *Params) {
3779 if (P->isTemplateParameterPack())
3791TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
3795 TemplateParameterList *InstParams;
3796 SmallVector<TemplateParameterList*, 8> ExpandedParams;
3798 bool IsExpandedParameterPack =
false;
3807 LocalInstantiationScope Scope(SemaRef,
true);
3808 TemplateParameterList *Expansion =
3812 ExpandedParams.push_back(Expansion);
3815 IsExpandedParameterPack =
true;
3816 InstParams = TempParams;
3821 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
3828 bool RetainExpansion =
false;
3829 UnsignedOrNone NumExpansions = std::nullopt;
3830 if (SemaRef.CheckParameterPacksForExpansion(
3832 TemplateArgs,
true, Expand,
3833 RetainExpansion, NumExpansions))
3837 for (
unsigned I = 0; I != *NumExpansions; ++I) {
3838 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, I);
3839 LocalInstantiationScope Scope(SemaRef,
true);
3843 ExpandedParams.push_back(Expansion);
3849 IsExpandedParameterPack =
true;
3852 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, std::nullopt);
3854 LocalInstantiationScope Scope(SemaRef,
true);
3861 LocalInstantiationScope Scope(SemaRef,
true);
3868 TemplateTemplateParmDecl *Param;
3869 if (IsExpandedParameterPack)
3872 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
3878 D->
getDepth() - TemplateArgs.getNumSubstitutedLevels(),
3891 TemplateArgumentLoc(SemaRef.Context, TemplateArgument(TName),
3900 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Param);
3909 UsingDirectiveDecl *Inst
3919 if (!Owner->isFunctionOrMethod())
3920 Owner->addDecl(Inst);
3929 bool isFunctionScope = Owner->isFunctionOrMethod();
3931 for (
auto *Shadow : D->
shadows()) {
3935 NamedDecl *OldTarget = Shadow->getTargetDecl();
3936 if (
auto *CUSD = dyn_cast<ConstructorUsingShadowDecl>(Shadow))
3937 if (
auto *BaseShadow = CUSD->getNominatedBaseClassShadowDecl())
3938 OldTarget = BaseShadow;
3942 dyn_cast<UnresolvedUsingIfExistsDecl>(Shadow->getTargetDecl())) {
3944 SemaRef.Context, Owner, EmptyD->getLocation(), EmptyD->getDeclName());
3946 InstTarget = cast_or_null<NamedDecl>(SemaRef.FindInstantiatedDecl(
3947 Shadow->getLocation(), OldTarget, TemplateArgs));
3954 SemaRef.CheckUsingShadowDecl(Inst, InstTarget, *Lookup, PrevDecl))
3958 PrevDecl = cast_or_null<UsingShadowDecl>(SemaRef.FindInstantiatedDecl(
3959 Shadow->getLocation(), OldPrev, TemplateArgs));
3962 nullptr, Inst, InstTarget, PrevDecl);
3963 SemaRef.Context.setInstantiatedFromUsingShadowDecl(InstShadow, Shadow);
3965 if (isFunctionScope)
3966 SemaRef.CurrentInstantiationScope->InstantiatedLocal(Shadow, InstShadow);
3972Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
3993 if (
auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.
CurContext))
3999 bool CheckRedeclaration = Owner->
isRecord();
4010 SS.
Adopt(QualifierLoc);
4011 if (CheckRedeclaration) {
4012 Prev.setHideTags(
false);
4045 EnumDecl *EnumD = cast_or_null<EnumDecl>(SemaRef.FindInstantiatedDecl(
4048 if (SemaRef.RequireCompleteEnumDecl(EnumD, EnumD->
getLocation()))
4051 TypeSourceInfo *TSI = SemaRef.SubstType(D->
getEnumType(), TemplateArgs,
4057 UsingEnumDecl *NewUD =
4061 SemaRef.Context.setInstantiatedFromUsingEnumDecl(NewUD, D);
4063 Owner->addDecl(NewUD);
4081Decl *TemplateDeclInstantiator::VisitConstructorUsingShadowDecl(
4087template <
typename T>
4088Decl *TemplateDeclInstantiator::instantiateUnresolvedUsingDecl(
4089 T *D,
bool InstantiatingPackElement) {
4091 if (D->isPackExpansion() && !InstantiatingPackElement) {
4092 SmallVector<UnexpandedParameterPack, 2> Unexpanded;
4093 SemaRef.collectUnexpandedParameterPacks(D->getQualifierLoc(), Unexpanded);
4094 SemaRef.collectUnexpandedParameterPacks(D->getNameInfo(), Unexpanded);
4099 bool RetainExpansion =
false;
4100 UnsignedOrNone NumExpansions = std::nullopt;
4101 if (SemaRef.CheckParameterPacksForExpansion(
4102 D->getEllipsisLoc(), D->getSourceRange(), Unexpanded, TemplateArgs,
4103 true, Expand, RetainExpansion,
4109 assert(!RetainExpansion &&
4110 "should never need to retain an expansion for UsingPackDecl");
4115 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, std::nullopt);
4116 return instantiateUnresolvedUsingDecl(D,
true);
4126 if (D->getDeclContext()->isFunctionOrMethod() && *NumExpansions > 1) {
4127 SemaRef.Diag(D->getEllipsisLoc(),
4128 diag::err_using_decl_redeclaration_expansion);
4133 SmallVector<NamedDecl*, 8> Expansions;
4134 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4135 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, I);
4136 Decl *Slice = instantiateUnresolvedUsingDecl(D,
true);
4146 auto *NewD = SemaRef.BuildUsingPackDecl(D, Expansions);
4148 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewD);
4152 UnresolvedUsingTypenameDecl *TD = dyn_cast<UnresolvedUsingTypenameDecl>(D);
4153 SourceLocation TypenameLoc = TD ? TD->
getTypenameLoc() : SourceLocation();
4155 NestedNameSpecifierLoc QualifierLoc
4156 = SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(),
4162 SS.
Adopt(QualifierLoc);
4164 DeclarationNameInfo NameInfo
4165 = SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs);
4169 bool InstantiatingSlice =
4170 D->getEllipsisLoc().isValid() && SemaRef.ArgPackSubstIndex;
4171 SourceLocation EllipsisLoc =
4172 InstantiatingSlice ? SourceLocation() : D->getEllipsisLoc();
4175 NamedDecl *UD = SemaRef.BuildUsingDeclaration(
4176 nullptr, D->getAccess(), D->getUsingLoc(),
4177 TD, TypenameLoc, SS, NameInfo, EllipsisLoc,
4178 ParsedAttributesView(),
4179 true, IsUsingIfExists);
4181 SemaRef.InstantiateAttrs(TemplateArgs, D, UD);
4182 SemaRef.Context.setInstantiatedFromUsingDecl(UD, D);
4188Decl *TemplateDeclInstantiator::VisitUnresolvedUsingTypenameDecl(
4190 return instantiateUnresolvedUsingDecl(D);
4193Decl *TemplateDeclInstantiator::VisitUnresolvedUsingValueDecl(
4195 return instantiateUnresolvedUsingDecl(D);
4198Decl *TemplateDeclInstantiator::VisitUnresolvedUsingIfExistsDecl(
4200 llvm_unreachable(
"referring to unresolved decl out of UsingShadowDecl");
4204 SmallVector<NamedDecl*, 8> Expansions;
4206 if (NamedDecl *NewUD =
4207 SemaRef.FindInstantiatedDecl(D->
getLocation(), UD, TemplateArgs))
4208 Expansions.push_back(NewUD);
4213 auto *NewD = SemaRef.BuildUsingPackDecl(D, Expansions);
4215 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewD);
4219Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
4221 SmallVector<Expr *, 5> Vars;
4222 for (
auto *I : D->
varlist()) {
4223 Expr *Var = SemaRef.SubstExpr(I, TemplateArgs).get();
4225 Vars.push_back(Var);
4228 OMPThreadPrivateDecl *TD =
4229 SemaRef.OpenMP().CheckOMPThreadPrivateDecl(D->
getLocation(), Vars);
4239 SmallVector<Expr *, 5> Vars;
4240 for (
auto *I : D->
varlist()) {
4241 Expr *Var = SemaRef.SubstExpr(I, TemplateArgs).get();
4243 Vars.push_back(Var);
4246 OMPGroupPrivateDecl *TD =
4247 SemaRef.OpenMP().CheckOMPGroupPrivateDecl(D->
getLocation(), Vars);
4256 SmallVector<Expr *, 5> Vars;
4257 for (
auto *I : D->
varlist()) {
4258 Expr *Var = SemaRef.SubstExpr(I, TemplateArgs).get();
4260 Vars.push_back(Var);
4262 SmallVector<OMPClause *, 4> Clauses;
4265 OMPClause *IC =
nullptr;
4266 if (
auto *AC = dyn_cast<OMPAllocatorClause>(
C)) {
4267 ExprResult NewE = SemaRef.SubstExpr(AC->getAllocator(), TemplateArgs);
4270 IC = SemaRef.OpenMP().ActOnOpenMPAllocatorClause(
4271 NewE.
get(), AC->
getBeginLoc(), AC->getLParenLoc(), AC->getEndLoc());
4272 }
else if (
auto *AC = dyn_cast<OMPAlignClause>(
C)) {
4273 ExprResult NewE = SemaRef.SubstExpr(AC->getAlignment(), TemplateArgs);
4276 IC = SemaRef.OpenMP().ActOnOpenMPAlignClause(
4277 NewE.
get(), AC->
getBeginLoc(), AC->getLParenLoc(), AC->getEndLoc());
4282 Clauses.push_back(IC);
4294 "Requires directive cannot be instantiated within a dependent context");
4297Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
4300 const bool RequiresInstantiation =
4304 QualType SubstReductionType;
4305 if (RequiresInstantiation) {
4306 SubstReductionType = SemaRef.OpenMP().ActOnOpenMPDeclareReductionType(
4311 SubstReductionType = D->
getType();
4313 if (SubstReductionType.
isNull())
4317 bool IsCorrect =
true;
4319 std::pair<QualType, SourceLocation> ReductionTypes[] = {
4320 std::make_pair(SubstReductionType, D->
getLocation())};
4322 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
4324 cast<Decl *>(*SemaRef.CurrentInstantiationScope->findInstantiationOf(
4327 auto DRD = SemaRef.OpenMP().ActOnOpenMPDeclareReductionDirectiveStart(
4331 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewDRD);
4332 Expr *SubstCombiner =
nullptr;
4333 Expr *SubstInitializer =
nullptr;
4336 SemaRef.OpenMP().ActOnOpenMPDeclareReductionCombinerStart(
4338 SemaRef.CurrentInstantiationScope->InstantiatedLocal(
4341 SemaRef.CurrentInstantiationScope->InstantiatedLocal(
4344 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
4345 Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, Qualifiers(),
4347 SubstCombiner = SemaRef.SubstExpr(Combiner, TemplateArgs).get();
4348 SemaRef.OpenMP().ActOnOpenMPDeclareReductionCombinerEnd(NewDRD,
4353 VarDecl *OmpPrivParm =
4354 SemaRef.OpenMP().ActOnOpenMPDeclareReductionInitializerStart(
4356 SemaRef.CurrentInstantiationScope->InstantiatedLocal(
4359 SemaRef.CurrentInstantiationScope->InstantiatedLocal(
4363 SubstInitializer = SemaRef.SubstExpr(
Init, TemplateArgs).get();
4367 IsCorrect = IsCorrect && OldPrivParm->hasInit();
4369 SemaRef.InstantiateVariableInitializer(OmpPrivParm, OldPrivParm,
4372 SemaRef.OpenMP().ActOnOpenMPDeclareReductionInitializerEnd(
4373 NewDRD, SubstInitializer, OmpPrivParm);
4375 IsCorrect = IsCorrect && SubstCombiner &&
4378 SubstInitializer) ||
4380 !SubstInitializer));
4382 (void)SemaRef.OpenMP().ActOnOpenMPDeclareReductionDirectiveEnd(
4391 const bool RequiresInstantiation =
4395 QualType SubstMapperTy;
4397 if (RequiresInstantiation) {
4398 SubstMapperTy = SemaRef.OpenMP().ActOnOpenMPDeclareMapperType(
4405 if (SubstMapperTy.
isNull())
4409 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
4411 cast<Decl *>(*SemaRef.CurrentInstantiationScope->findInstantiationOf(
4414 bool IsCorrect =
true;
4415 SmallVector<OMPClause *, 6> Clauses;
4417 DeclarationNameInfo DirName;
4418 SemaRef.OpenMP().StartOpenMPDSABlock(llvm::omp::OMPD_declare_mapper, DirName,
4422 SemaRef.OpenMP().ActOnOpenMPDeclareMapperDirectiveVarDecl(
4424 SemaRef.CurrentInstantiationScope->InstantiatedLocal(
4427 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
4428 Sema::CXXThisScopeRAII ThisScope(SemaRef, ThisContext, Qualifiers(),
4433 SmallVector<Expr *, 4> NewVars;
4434 for (Expr *OE : OldC->varlist()) {
4435 Expr *
NE = SemaRef.SubstExpr(OE, TemplateArgs).get();
4440 NewVars.push_back(NE);
4444 NestedNameSpecifierLoc NewQualifierLoc =
4445 SemaRef.SubstNestedNameSpecifierLoc(OldC->getMapperQualifierLoc(),
4448 SS.
Adopt(NewQualifierLoc);
4449 DeclarationNameInfo NewNameInfo =
4450 SemaRef.SubstDeclarationNameInfo(OldC->getMapperIdInfo(), TemplateArgs);
4451 OMPVarListLocTy Locs(OldC->getBeginLoc(), OldC->getLParenLoc(),
4453 OMPClause *NewC = SemaRef.OpenMP().ActOnOpenMPMapClause(
4454 OldC->getIteratorModifier(), OldC->getMapTypeModifiers(),
4455 OldC->getMapTypeModifiersLoc(), SS, NewNameInfo, OldC->getMapType(),
4456 OldC->isImplicitMapType(), OldC->getMapLoc(), OldC->getColonLoc(),
4458 Clauses.push_back(NewC);
4460 SemaRef.OpenMP().EndOpenMPDSABlock(
nullptr);
4465 VN, D->
getAccess(), MapperVarRef.
get(), Clauses, PrevDeclInScope);
4467 SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, NewDMD);
4471Decl *TemplateDeclInstantiator::VisitOMPCapturedExprDecl(
4473 llvm_unreachable(
"Should not be met in templates");
4484 Owner->addDecl(Inst);
4493 llvm_unreachable(
"There are only CXXRecordDecls in C++");
4497TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
4504 "can only instantiate an explicit specialization "
4505 "for a member class template");
4509 ClassTemplateDecl *InstClassTemplate =
4510 cast_or_null<ClassTemplateDecl>(SemaRef.FindInstantiatedDecl(
4512 if (!InstClassTemplate)
4517 TemplateArgumentListInfo InstTemplateArgs;
4518 if (
const ASTTemplateArgumentListInfo *TemplateArgsInfo =
4520 InstTemplateArgs.
setLAngleLoc(TemplateArgsInfo->getLAngleLoc());
4521 InstTemplateArgs.
setRAngleLoc(TemplateArgsInfo->getRAngleLoc());
4523 if (SemaRef.SubstTemplateArguments(TemplateArgsInfo->arguments(),
4524 TemplateArgs, InstTemplateArgs))
4530 Sema::CheckTemplateArgumentInfo CTAI;
4531 if (SemaRef.CheckTemplateArgumentList(
4532 InstClassTemplate, D->
getLocation(), InstTemplateArgs,
4539 void *InsertPos =
nullptr;
4540 ClassTemplateSpecializationDecl *PrevDecl =
4547 SemaRef.CheckSpecializationInstantiationRedecl(D->
getLocation(),
4569 SemaRef.Diag(D->
getLocation(), diag::err_redefinition) << PrevDecl;
4571 diag::note_previous_definition);
4576 ClassTemplateSpecializationDecl *InstD =
4598 Owner->addDecl(InstD);
4605 SemaRef.InstantiateClass(D->
getLocation(), InstD, D, TemplateArgs,
4619 "A template specialization without specialized template?");
4622 cast_or_null<VarTemplateDecl>(SemaRef.FindInstantiatedDecl(
4624 if (!InstVarTemplate)
4630 VarTemplateArgsInfo.
setLAngleLoc(TemplateArgsInfo->getLAngleLoc());
4631 VarTemplateArgsInfo.
setRAngleLoc(TemplateArgsInfo->getRAngleLoc());
4633 if (SemaRef.SubstTemplateArguments(TemplateArgsInfo->arguments(),
4634 TemplateArgs, VarTemplateArgsInfo))
4640 if (SemaRef.CheckTemplateArgumentList(
4641 InstVarTemplate, D->
getLocation(), VarTemplateArgsInfo,
4647 void *InsertPos =
nullptr;
4654 if (PrevDecl && SemaRef.CheckSpecializationInstantiationRedecl(
4662 VTSD->setTemplateArgsAsWritten(VarTemplateArgsInfo);
4682 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
4692 void *InsertPos =
nullptr;
4693 VarTemplate->findSpecialization(Converted, InsertPos);
4697 if (SemaRef.getLangOpts().OpenCL)
4698 SemaRef.deduceOpenCLAddressSpace(Var);
4704 SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
4705 StartingScope,
false, PrevDecl);
4711 llvm_unreachable(
"@defs is not supported in Objective-C++");
4716 unsigned DiagID = SemaRef.getDiagnostics().getCustomDiagID(
4718 "cannot instantiate %0 yet");
4726 llvm_unreachable(
"Concept definitions cannot reside inside a template");
4729Decl *TemplateDeclInstantiator::VisitImplicitConceptSpecializationDecl(
4731 llvm_unreachable(
"Concept specializations cannot reside inside a template");
4741 llvm_unreachable(
"Unexpected decl");
4752 SubstD = Instantiator.Visit(D);
4766 T = SemaRef.Context.getFunctionType(
4767 SemaRef.Context.BoolTy, FPT->getParamTypes(), FPT->getExtProtoInfo());
4776 SemaRef.Context.getTrivialTypeSourceInfo(T, Orig->
getEndLoc());
4778 assert(OldLoc &&
"type of function is not a function type?");
4780 for (
unsigned I = 0, N = OldLoc.getNumParams(); I != N; ++I)
4781 NewLoc.
setParam(I, OldLoc.getParam(I));
4786 SemaRef.Context.DeclarationNames.getCXXOperatorName(OO_EqualEqual));
4791 if (Spaceship->isInvalidDecl())
4803 if (
auto *MD = dyn_cast<CXXMethodDecl>(Spaceship)) {
4808 assert(Spaceship->getFriendObjectKind() &&
4809 "defaulted spaceship is neither a member nor a friend");
4823 return cast_or_null<FunctionDecl>(R);
4837 unsigned N = L->
size();
4841 for (
auto &P : *L) {
4843 Params.push_back(D);
4863 bool EvaluateConstraints) {
4902 if (SemaRef.SubstTemplateArguments(TemplArgInfo->
arguments(), TemplateArgs,
4909 if (SemaRef.CheckTemplateArgumentList(
4910 ClassTemplate, PartialSpec->
getLocation(), InstTemplateArgs,
4916 if (SemaRef.CheckTemplatePartialSpecializationArgs(
4923 void *InsertPos =
nullptr;
4926 InstParams, InsertPos);
4931 SemaRef.Context, PartialSpec->
getTagKind(), Owner,
4962 diag::err_partial_spec_redeclared)
4964 SemaRef.Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
4965 << SemaRef.Context.getCanonicalTagType(PrevDecl);
4970 SemaRef.CheckTemplatePartialSpecialization(InstPartialSpec);
4976 return InstPartialSpec;
5012 if (SemaRef.SubstTemplateArguments(TemplArgInfo->
arguments(), TemplateArgs,
5020 InstTemplateArgs, {},
5025 if (SemaRef.CheckTemplatePartialSpecializationArgs(
5032 void *InsertPos =
nullptr;
5035 InstParams, InsertPos);
5046 diag::err_variable_instantiates_to_function)
5083 diag::err_var_partial_spec_redeclared)
5086 diag::note_var_prev_partial_spec_here);
5090 SemaRef.CheckTemplatePartialSpecialization(InstPartialSpec);
5094 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
5096 SemaRef.BuildVariableInstantiation(InstPartialSpec, PartialSpec, TemplateArgs,
5097 LateAttrs, Owner, StartingScope);
5099 return InstPartialSpec;
5106 assert(OldTInfo &&
"substituting function without type source info");
5107 assert(Params.empty() &&
"parameter vector is non-empty at start");
5113 ThisTypeQuals =
Method->getFunctionObjectParameterType().getQualifiers();
5118 ThisContext, ThisTypeQuals, EvaluateConstraints);
5124 if (NewTInfo != OldTInfo) {
5128 unsigned NewIdx = 0;
5129 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
5130 OldIdx != NumOldParams; ++OldIdx) {
5131 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
5139 NumArgumentsInExpansion =
5140 SemaRef.getNumArgumentsInExpansion(OldParam->
getType(),
5142 if (!NumArgumentsInExpansion) {
5146 Params.push_back(NewParam);
5147 Scope->InstantiatedLocal(OldParam, NewParam);
5150 Scope->MakeInstantiatedLocalArgPack(OldParam);
5151 for (
unsigned I = 0; I != *NumArgumentsInExpansion; ++I) {
5153 Params.push_back(NewParam);
5154 Scope->InstantiatedLocalPackArg(OldParam, NewParam);
5164 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
5168 Params.push_back(SemaRef.BuildParmVarDeclForTypedef(
5174 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
5177 Params.push_back(Parm);
5194 TemplateArgs, ParamTypes, &Params,
5207 for (
auto *
decl : PatternDecl->
decls()) {
5214 auto it = llvm::find_if(
Function->decls(), [&](
Decl *inst) {
5215 VarDecl *InstVD = dyn_cast<VarDecl>(inst);
5216 return InstVD && InstVD->isLocalVarDecl() &&
5217 InstVD->getIdentifier() == II;
5223 Scope.InstantiatedLocal(VD, *it);
5230bool Sema::addInstantiatedParametersToScope(
5234 unsigned FParamIdx = 0;
5235 for (
unsigned I = 0, N = PatternDecl->
getNumParams(); I != N; ++I) {
5236 const ParmVarDecl *PatternParam = PatternDecl->
getParamDecl(I);
5239 assert(FParamIdx < Function->getNumParams());
5264 UnsignedOrNone NumArgumentsInExpansion =
5266 if (NumArgumentsInExpansion) {
5267 QualType PatternType =
5268 PatternParam->
getType()->
castAs<PackExpansionType>()->getPattern();
5269 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
5273 Sema::ArgPackSubstIndexRAII SubstIndex(*
this, Arg);
5293 assert(Param->hasUninstantiatedDefaultArg());
5325 false, std::nullopt,
5334 L->DefaultArgumentInstantiated(Param);
5347 if (AlreadyInstantiating) {
5350 Diag(PointOfInstantiation, diag::err_exception_spec_cycle) <<
Decl;
5372 false, std::nullopt,
5405 SemaRef.Context.setManglingNumber(
New,
5406 SemaRef.Context.getManglingNumber(Tmpl));
5419 ActiveInstType &ActiveInst = SemaRef.CodeSynthesisContexts.back();
5420 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
5421 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
5423 SemaRef.CurrentSFINAEContext =
nullptr;
5424 atTemplateEnd(SemaRef.TemplateInstCallbacks, SemaRef, ActiveInst);
5425 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
5426 ActiveInst.Entity =
New;
5432 assert(Proto &&
"Function template without prototype?");
5441 if (SemaRef.getLangOpts().CPlusPlus11 &&
5456 assert(NewProto &&
"Template instantiation without function prototype?");
5461 New->setType(SemaRef.Context.getFunctionType(
5465 SemaRef.SubstExceptionSpec(
New, Proto, TemplateArgs);
5474 LateAttrs, StartingScope);
5495 New->setVirtualAsWritten(
true);
5506 Lookups.reserve(DFI->getUnqualifiedLookups().size());
5507 bool AnyChanged =
false;
5509 NamedDecl *D = SemaRef.FindInstantiatedDecl(
New->getLocation(),
5510 DA.getDecl(), TemplateArgs);
5513 AnyChanged |= (D != DA.getDecl());
5519 New->setDefaultedOrDeletedInfo(
5521 SemaRef.Context, Lookups)
5548 bool DefinitionRequired,
5556 Function->getTemplateSpecializationKindForInstantiation();
5563 !DefinitionRequired)
5568 if (
Function->isDefined(ExistingDefn,
5583 assert(!AlreadyInstantiating &&
"should have been caught by caller");
5588 assert(PatternDecl &&
"instantiating a non-template");
5591 Stmt *Pattern =
nullptr;
5593 Pattern = PatternDef->
getBody(PatternDef);
5594 PatternDecl = PatternDef;
5596 PatternDef =
nullptr;
5600 bool Unreachable =
false;
5605 Function->getInstantiatedFromMemberFunction(), PatternDecl,
5607 DefinitionRequired, &Unreachable)) {
5608 if (DefinitionRequired)
5611 (
Function->isConstexpr() && !Recursive)) {
5615 Function->setInstantiationIsPending(
true);
5618 if (llvm::isTimeTraceVerbose()) {
5619 llvm::timeTraceAddInstantEvent(
"DeferInstantiation", [&] {
5621 llvm::raw_string_ostream
OS(Name);
5630 Diag(PointOfInstantiation, diag::warn_func_template_missing)
5636 diag::note_unreachable_template_decl);
5640 Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
5652 Function->setInstantiationIsPending(
true);
5654 std::make_pair(
Function, PointOfInstantiation));
5658 llvm::TimeTraceScope TimeScope(
"InstantiateFunction", [&]() {
5659 llvm::TimeTraceMetadata M;
5660 llvm::raw_string_ostream
OS(M.Detail);
5663 if (llvm::isTimeTraceVerbose()) {
5666 M.Line =
SourceMgr.getExpansionLineNumber(Loc);
5692 "missing LateParsedTemplate");
5694 Pattern = PatternDecl->
getBody(PatternDecl);
5701 "unexpected kind of function template definition");
5716 for (
auto *D =
Function->getMostRecentDecl(); ;
5718 D->setImplicitlyInline();
5729 "instantiating function definition");
5733 Function->setVisibleDespiteOwningModule();
5759 auto NameLocPointsToPattern = [&] {
5770 return PatternNameLoc;
5780 return PatternNameLoc;
5788 assert(PatternTSI &&
"Pattern is supposed to have an associated TSI");
5796 Function->setDeclarationNameLoc(NameLocPointsToPattern());
5804 ThisContext =
Method->getParent();
5805 ThisTypeQuals =
Method->getMethodQualifiers();
5815 bool MergeWithParentScope =
false;
5817 MergeWithParentScope =
5818 Rec->isLocalClass() && !
Function->isFunctionTemplateSpecialization();
5821 auto RebuildTypeSourceInfoForDefaultSpecialMembers = [&]() {
5827 "Special member needs to be defaulted");
5835 auto *NewRec = dyn_cast<CXXRecordDecl>(
Function->getDeclContext());
5836 const auto *PatternRec =
5838 if (!NewRec || !PatternRec)
5840 if (!PatternRec->isLambda())
5843 struct SpecialMemberTypeInfoRebuilder
5863 getDerived().TransformDecl(TL.
getNameLoc(), T->getDecl()));
5865 return Base::TransformRecordType(TLB, TL);
5879 } IR{*
this, PatternRec, NewRec};
5882 assert(NewSI &&
"Type Transform failed?");
5884 Function->setTypeSourceInfo(NewSI);
5888 assert(NewParmSI &&
"Type transformation failed.");
5894 RebuildTypeSourceInfoForDefaultSpecialMembers();
5898 std::optional<ArrayRef<TemplateArgument>> Innermost;
5899 if (
auto *Primary =
Function->getPrimaryTemplate();
5902 Function->getTemplateSpecializationKind() !=
5904 auto It = llvm::find_if(Primary->redecls(),
5906 return cast<FunctionTemplateDecl>(RTD)
5907 ->isCompatibleWithDefinition();
5909 assert(It != Primary->redecls().end() &&
5910 "Should't get here without a definition");
5912 ->getTemplatedDecl()
5916 DC = (*It)->getLexicalDeclContext();
5917 Innermost.emplace(
Function->getTemplateSpecializationArgs()->asArray());
5920 Function, DC,
false, Innermost,
false, PatternDecl);
5938 if (addInstantiatedParametersToScope(
Function, PatternDecl,
Scope,
5954 if (
Context.getTargetInfo().getCXXABI().isMicrosoft() &&
5955 Ctor->isDefaultConstructor()) {
5961 Body =
SubstStmt(Pattern, TemplateArgs);
5970 checkReferenceToTULocalFromOtherTU(
Function, PointOfInstantiation);
5976 Listener->FunctionDefinitionInstantiated(
Function);
5986 bool ShouldSkipCG = [&] {
5987 auto *RD = dyn_cast<CXXRecordDecl>(
Function->getParent());
5988 if (!RD || !RD->isLambda())
5992 return Context.isUnevaluated() ||
Context.isImmediateFunctionContext();
5995 if (!ShouldSkipCG) {
6002 LocalInstantiations.
perform();
6004 GlobalInstantiations.perform();
6030 bool IsMemberSpec =
false;
6032 if (
auto *PartialSpec =
6033 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar)) {
6034 assert(PartialSpecArgs);
6035 IsMemberSpec = PartialSpec->isMemberSpecialization();
6037 PartialSpec, PartialSpecArgs->
asArray(),
false);
6040 IsMemberSpec =
VarTemplate->isMemberSpecialization();
6060 "don't have a definition to instantiate from");
6089 bool InstantiatingVarTemplate,
6093 bool InstantiatingVarTemplatePartialSpec =
6098 bool InstantiatingSpecFromTemplate =
6124 if (OldVar->
isUsed(
false))
6149 }
else if (PrevDeclForVarTemplateSpecialization) {
6150 Previous.addDecl(PrevDeclForVarTemplateSpecialization);
6154 if (!InstantiatingVarTemplate) {
6172 !InstantiatingSpecFromTemplate)
6179 dyn_cast<VarTemplateSpecializationDecl>(OldVar)) {
6187 Context.setManglingNumber(NewVar,
Context.getManglingNumber(OldVar));
6188 Context.setStaticLocalNumber(NewVar,
Context.getStaticLocalNumber(OldVar));
6191 if (InstantiatingVarTemplate || InstantiatingVarTemplatePartialSpec) {
6196 }
else if (InstantiatingSpecFromTemplate ||
6218 L->VariableDefinitionInstantiated(Var);
6248 if (!
Init.isInvalid()) {
6251 if (Var->
hasAttr<DLLImportAttr>() &&
6255 }
else if (InitExpr) {
6291 bool DefinitionRequired,
bool AtEndOfTU) {
6303 if (AlreadyInstantiating)
6308 assert(PatternDecl &&
"no pattern for templated variable");
6313 dyn_cast<VarTemplateSpecializationDecl>(Var);
6324 (PatternDecl = PatternDecl->
getFirstDecl())->hasInit() &&
6333 "instantiating variable initializer");
6344 Recursive, AtEndOfTU);
6353 PreviousContext.
pop();
6357 LocalInstantiations.
perform();
6359 GlobalInstantiations.
perform();
6363 "not a static data member?");
6372 if (!Def && !DefinitionRequired) {
6379 Diag(PointOfInstantiation, diag::warn_var_template_missing)
6383 Diag(PointOfInstantiation, diag::note_inst_declaration_hint) << Var;
6394 PatternDecl, Def, TSK,
6395 DefinitionRequired))
6412 struct PassToConsumerRAII {
6419 ~PassToConsumerRAII() {
6420 Consumer.HandleCXXStaticMemberVarInstantiation(Var);
6422 } PassToConsumerRAII(
Consumer, Var);
6429 PointOfInstantiation);
6438 "instantiating variable definition");
6460 }
else if (!VarSpec) {
6505 PreviousContext.
pop();
6508 PassToConsumerRAII.Var = Var;
6517 LocalInstantiations.
perform();
6519 GlobalInstantiations.
perform();
6531 for (
const auto *
Init : Tmpl->
inits()) {
6534 if (!
Init->isWritten())
6539 if (
Init->isPackExpansion()) {
6541 TypeLoc BaseTL =
Init->getTypeSourceInfo()->getTypeLoc();
6545 bool ShouldExpand =
false;
6546 bool RetainExpansion =
false;
6550 TemplateArgs,
true, ShouldExpand,
6551 RetainExpansion, NumExpansions)) {
6553 New->setInvalidDecl();
6556 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
6559 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6573 Init->getSourceLocation(),
6574 New->getDeclName());
6582 BaseTInfo, TempInit.
get(),
6590 NewInits.push_back(NewInit.
get());
6605 if (
Init->isDelegatingInitializer() ||
Init->isBaseInitializer()) {
6608 Init->getSourceLocation(),
6609 New->getDeclName());
6612 New->setInvalidDecl();
6616 if (
Init->isBaseInitializer())
6618 New->getParent(), EllipsisLoc);
6622 }
else if (
Init->isMemberInitializer()) {
6624 Init->getMemberLocation(),
6629 New->setInvalidDecl();
6634 Init->getSourceLocation());
6635 }
else if (
Init->isIndirectMemberInitializer()) {
6638 Init->getMemberLocation(),
6639 Init->getIndirectMember(), TemplateArgs));
6641 if (!IndirectMember) {
6643 New->setInvalidDecl();
6648 Init->getSourceLocation());
6653 New->setInvalidDecl();
6655 NewInits.push_back(NewInit.
get());
6674 Instance = Instance->getCanonicalDecl();
6675 if (Pattern == Instance)
return true;
6676 Instance = Instance->getInstantiatedFromMemberTemplate();
6687 Instance = Instance->getCanonicalDecl();
6688 if (Pattern == Instance)
return true;
6689 Instance = Instance->getInstantiatedFromMemberTemplate();
6702 Instance->getCanonicalDecl());
6703 if (Pattern == Instance)
6705 Instance = Instance->getInstantiatedFromMember();
6716 Instance = Instance->getCanonicalDecl();
6717 if (Pattern == Instance)
return true;
6718 Instance = Instance->getInstantiatedFromMemberClass();
6729 Instance = Instance->getCanonicalDecl();
6730 if (Pattern == Instance)
return true;
6731 Instance = Instance->getInstantiatedFromMemberFunction();
6742 Instance = Instance->getCanonicalDecl();
6743 if (Pattern == Instance)
return true;
6744 Instance = Instance->getInstantiatedFromMemberEnum();
6771 bool OtherIsPackExpansion;
6773 if (
auto *OtherUUD = dyn_cast<T>(
Other)) {
6774 OtherIsPackExpansion = OtherUUD->isPackExpansion();
6776 }
else if (
auto *OtherUPD = dyn_cast<UsingPackDecl>(
Other)) {
6777 OtherIsPackExpansion =
true;
6778 OtherFrom = OtherUPD->getInstantiatedFromUsingDecl();
6779 }
else if (
auto *OtherUD = dyn_cast<UsingDecl>(
Other)) {
6780 OtherIsPackExpansion =
false;
6785 return Pattern->isPackExpansion() == OtherIsPackExpansion &&
6791 assert(Instance->isStaticDataMember());
6796 Instance = Instance->getCanonicalDecl();
6797 if (Pattern == Instance)
return true;
6798 Instance = Instance->getInstantiatedFromStaticDataMember();
6807 if (
auto *UUD = dyn_cast<UnresolvedUsingTypenameDecl>(D))
6810 if (
auto *UUD = dyn_cast<UnresolvedUsingValueDecl>(D))
6816 if (
auto *
Record = dyn_cast<CXXRecordDecl>(
Other))
6819 if (
auto *Function = dyn_cast<FunctionDecl>(
Other))
6822 if (
auto *
Enum = dyn_cast<EnumDecl>(
Other))
6825 if (
auto *Var = dyn_cast<VarDecl>(
Other))
6829 if (
auto *Temp = dyn_cast<ClassTemplateDecl>(
Other))
6832 if (
auto *Temp = dyn_cast<FunctionTemplateDecl>(
Other))
6835 if (
auto *PartialSpec =
6836 dyn_cast<ClassTemplatePartialSpecializationDecl>(
Other))
6840 if (
auto *Field = dyn_cast<FieldDecl>(
Other)) {
6841 if (!Field->getDeclName()) {
6848 if (
auto *Using = dyn_cast<UsingDecl>(
Other))
6851 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(
Other))
6858template<
typename ForwardIterator>
6861 ForwardIterator first,
6862 ForwardIterator last) {
6863 for (; first != last; ++first)
6872 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
6874 return cast_or_null<DeclContext>(ID);
6889 return cast<Decl>(DC)->getTemplateDepth() > Level;
6894 bool FindingInstantiatedContext) {
6932 if (
auto *BD = dyn_cast<BindingDecl>(FD);
6940 "found declaration pack but not pack expanding");
6970 bool NeedInstantiate =
false;
6972 NeedInstantiate = RD->isLocalClass();
6975 NeedInstantiate =
true;
6978 if (NeedInstantiate) {
6989 assert(Inst &&
"Failed to instantiate label??");
6996 if (!
Record->isDependentContext())
7005 dyn_cast<ClassTemplateSpecializationDecl>(
Record))
7006 ClassTemplate = Spec->getSpecializedTemplate()->getCanonicalDecl();
7017 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
7021 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
7041 auto *Guide = dyn_cast<CXXDeductionGuideDecl>(FD);
7042 if (Guide && Guide->isImplicit()) {
7050 Unpacked = Arg.pack_elements();
7063 if (T.isNull() || T->containsErrors())
7073 assert(
SemaRef.RebuildingImmediateInvocation ||
7086 if (FindingInstantiatedContext &&
7089 Diag(Loc, diag::err_specialization_not_primary_template)
7106 if (!ParentDependsOnArgs)
7120 bool IsBeingInstantiated =
false;
7121 if (
auto *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
7122 if (!Spec->isDependentContext()) {
7123 if (Spec->isEntityBeingDefined())
7124 IsBeingInstantiated =
true;
7126 diag::err_incomplete_type))
7129 ParentDC = Spec->getDefinitionOrSelf();
7168 }
else if (IsBeingInstantiated) {
7174 Diag(Loc, diag::err_member_not_yet_instantiated)
7187 Diag(Loc, diag::err_enumerator_does_not_exist)
7191 <<
Context.getCanonicalTagType(Spec);
7194 llvm_unreachable(
"Unable to find instantiation of declaration!");
7205 std::deque<PendingImplicitInstantiation> DelayedImplicitInstantiations;
7210 bool LocalInstantiation =
false;
7217 LocalInstantiation =
true;
7222 bool DefinitionRequired =
Function->getTemplateSpecializationKind() ==
7227 [
this, Inst, DefinitionRequired, AtEndOfTU](
FunctionDecl *CurFD) {
7229 DefinitionRequired, AtEndOfTU);
7235 DefinitionRequired, AtEndOfTU);
7237 Function->setInstantiationIsPending(
false);
7240 if (!LocalOnly &&
LangOpts.PCHInstantiateTemplates &&
7242 DelayedImplicitInstantiations.push_back(Inst);
7243 else if (!AtEndOfTU &&
Function->instantiationIsPending() &&
7244 !LocalInstantiation)
7245 DelayedImplicitInstantiations.push_back(Inst);
7254 "Not a static data member, nor a variable template"
7255 " specialization?");
7267 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
7282 "instantiating variable definition");
7289 DefinitionRequired, AtEndOfTU);
7292 if (!DelayedImplicitInstantiations.empty())
7298 for (
auto *DD : Pattern->
ddiags()) {
7299 switch (DD->getKind()) {
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::MachO::Record Record
@ ForExternalRedeclaration
The lookup results will be used for redeclaration of a name with external linkage; non-visible lookup...
@ ForVisibleRedeclaration
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
This file declares semantic analysis functions specific to AMDGPU.
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
This file declares semantic analysis for CUDA constructs.
static const NamedDecl * getDefinition(const Decl *D)
This file declares semantic analysis for HLSL constructs.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis functions specific to Swift.
static void instantiateDependentAMDGPUWavesPerEUAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AMDGPUWavesPerEUAttr &Attr, Decl *New)
static NamedDecl * findInstantiationOf(ASTContext &Ctx, NamedDecl *D, ForwardIterator first, ForwardIterator last)
static void instantiateDependentAMDGPUMaxNumWorkGroupsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AMDGPUMaxNumWorkGroupsAttr &Attr, Decl *New)
static void instantiateDependentAMDGPUFlatWorkGroupSizeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AMDGPUFlatWorkGroupSizeAttr &Attr, Decl *New)
static void instantiateDependentCUDAClusterDimsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const CUDAClusterDimsAttr &Attr, Decl *New)
static void sharedInstantiateConstructorDestructorAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, Decl *New, ASTContext &C)
static void instantiateDependentDiagnoseIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const DiagnoseIfAttr *DIA, const Decl *Tmpl, FunctionDecl *New)
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...
static bool isRelevantAttr(Sema &S, const Decl *D, const Attr *A)
Determine whether the attribute A might be relevant to the declaration D.
static void instantiateDependentReqdWorkGroupSizeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const ReqdWorkGroupSizeAttr &Attr, Decl *New)
#define CLAUSE_NOT_ON_DECLS(CLAUSE_NAME)
static void instantiateDependentMallocSpanAttr(Sema &S, const MallocSpanAttr *Attr, Decl *New)
static bool isDependentContextAtLevel(DeclContext *DC, unsigned Level)
Determine whether the given context is dependent on template parameters at level Level or below.
static void instantiateDependentModeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const ModeAttr &Attr, Decl *New)
static void instantiateDependentCUDALaunchBoundsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const CUDALaunchBoundsAttr &Attr, Decl *New)
static bool isDeclWithinFunction(const Decl *D)
static void instantiateDependentAssumeAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AssumeAlignedAttr *Aligned, Decl *New)
static bool SubstQualifier(Sema &SemaRef, const DeclT *OldDecl, DeclT *NewDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
static void collectUnexpandedParameterPacks(Sema &S, TemplateParameterList *Params, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
static void instantiateDependentHLSLParamModifierAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const HLSLParamModifierAttr *Attr, const Decl *Old, Decl *New)
static DeclT * getPreviousDeclForInstantiation(DeclT *D)
Get the previous declaration of a declaration for the purposes of template instantiation.
static Expr * instantiateDependentFunctionAttrCondition(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, Expr *OldCond, const Decl *Tmpl, FunctionDecl *New)
static bool isInstantiationOf(ClassTemplateDecl *Pattern, ClassTemplateDecl *Instance)
static void instantiateDependentAllocAlignAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AllocAlignAttr *Align, Decl *New)
static bool isInstantiationOfStaticDataMember(VarDecl *Pattern, VarDecl *Instance)
static void instantiateOMPDeclareSimdDeclAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareSimdDeclAttr &Attr, Decl *New)
Instantiation of 'declare simd' attribute and its arguments.
static void instantiateDependentSYCLKernelAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLKernelAttr &Attr, Decl *New)
static void instantiateDependentAlignValueAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignValueAttr *Aligned, Decl *New)
static void instantiateDependentAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignedAttr *Aligned, Decl *New, bool IsPackExpansion)
static void instantiateOMPDeclareVariantAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareVariantAttr &Attr, Decl *New)
Instantiation of 'declare variant' attribute and its arguments.
static void instantiateDependentEnableIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const EnableIfAttr *EIA, const Decl *Tmpl, FunctionDecl *New)
static void instantiateDependentAnnotationAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AnnotateAttr *Attr, Decl *New)
static Sema::RetainOwnershipKind attrToRetainOwnershipKind(const Attr *A)
static void instantiateDependentOpenACCRoutineDeclAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OpenACCRoutineDeclAttr *OldAttr, const Decl *Old, Decl *New)
static bool isInstantiationOfUnresolvedUsingDecl(T *Pattern, Decl *Other, ASTContext &Ctx)
static bool isInvalid(LocType Loc, bool *Invalid)
Defines the SourceManager interface.
Defines the clang::TypeLoc interface and its subclasses.
bool anyScoreOrCondition(llvm::function_ref< bool(Expr *&, bool)> Cond)
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template.
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool AllowCXX=false, bool IsConditionalOperator=false)
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field) const
CanQualType UnsignedLongLongTy
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
CanQualType getCanonicalTagType(const TagDecl *TD) const
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Represents an access specifier followed by colon ':'.
static AccessSpecDecl * Create(ASTContext &C, AccessSpecifier AS, DeclContext *DC, SourceLocation ASLoc, SourceLocation ColonLoc)
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
SourceLocation getAccessSpecifierLoc() const
The location of the access specifier.
Attr - This represents one attribute.
attr::Kind getKind() const
Attr * clone(ASTContext &C) const
SourceLocation getLocation() const
SourceRange getRange() const
SourceLocation getLoc() const
Represents a C++ declaration that introduces decls from somewhere else.
shadow_range shadows() const
A binding in a decomposition declaration.
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
ArrayRef< BindingDecl * > getBindingPackDecls() const
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
Represents a C++ constructor within a class.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), const AssociatedConstraint &TrailingRequiresClause={})
Represents a C++ conversion function within a class.
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, const AssociatedConstraint &TrailingRequiresClause={})
Represents a C++ deduction guide declaration.
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstructorDecl *Ctor=nullptr, DeductionCandidate Kind=DeductionCandidate::Normal, const AssociatedConstraint &TrailingRequiresClause={}, const CXXDeductionGuideDecl *SourceDG=nullptr, SourceDeductionGuideKind SK=SourceDeductionGuideKind::None)
Represents a C++ destructor within a class.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, const AssociatedConstraint &TrailingRequiresClause={})
Represents a static or instance method of a struct/union/class.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, const AssociatedConstraint &TrailingRequiresClause={})
Represents a C++ struct/union/class.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr)
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e.
unsigned getLambdaDependencyKind() const
const FunctionDecl * isLocalClass() const
If the class is a local class [class.local], returns the enclosing function declaration.
bool isLambda() const
Determine whether this class describes a lambda function object.
CXXRecordDecl * getDefinition() const
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
TypeSourceInfo * getLambdaTypeInfo() const
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
LambdaCaptureDefault getLambdaCaptureDefault() const
void setDescribedClassTemplate(ClassTemplateDecl *Template)
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ nested-name-specifier or a global scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Declaration of a class template.
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
ClassTemplateDecl * getMostRecentDecl()
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a class template node.
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
void setCommonPtr(Common *C)
Common * getCommonPtr() const
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, CanQualType CanonInjectedTST, ClassTemplatePartialSpecializationDecl *PrevDecl)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a class template specialization, which refers to a class template with a given set of temp...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, bool StrictPackMatch, ClassTemplateSpecializationDecl *PrevDecl)
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
void setExternKeywordLoc(SourceLocation Loc)
Sets the location of the extern keyword.
void setSpecializationKind(TemplateSpecializationKind TSK)
SourceLocation getExternKeywordLoc() const
Gets the location of the extern keyword, if present.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
Declaration of a C++20 concept.
const TypeClass * getTypePtr() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC.
bool isFileContext() const
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
DeclContextLookupResult lookup_result
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
decl_iterator decls_end() const
ddiag_range ddiags() const
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
bool isFunctionOrMethod() const
void addHiddenDecl(Decl *D)
Add the declaration D to this context without modifying any lookup tables.
decl_iterator decls_begin() const
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr, NonOdrUseReason NOUR=NOUR_None)
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
SourceLocation getEndLoc() const LLVM_READONLY
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void setLocalExternDecl()
Changes the namespace of this declaration to reflect that it's a function-local extern declaration.
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isInIdentifierNamespace(unsigned NS) const
@ FOK_None
Not a friend object.
bool isReferenced() const
Whether any declaration of this entity was referenced.
unsigned getTemplateDepth() const
Determine the number of levels of template parameter surrounding this declaration.
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
bool isInLocalScopeForInstantiation() const
Determine whether a substitution into this declaration would occur as part of a substitution into a d...
DeclContext * getNonTransparentDeclContext()
Return the non transparent context.
bool isInvalidDecl() const
bool isLocalExternDecl() const
Determine whether this is a block-scope declaration with linkage.
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
void setAccess(AccessSpecifier AS)
SourceLocation getLocation() const
const char * getDeclKindName() const
@ IDNS_Ordinary
Ordinary names.
void setImplicit(bool I=true)
void setReferenced(bool R=true)
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
void setNonMemberOperator()
Specifies that this declaration is a C++ overloaded non-member.
void setLexicalDeclContext(DeclContext *DC)
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible.
DeclarationNameLoc - Additional source/type location info for a declaration name.
static DeclarationNameLoc makeNamedTypeLoc(TypeSourceInfo *TInfo)
Construct location information for a constructor, destructor or conversion operator.
The name of a declaration.
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
TemplateParameterList * getTemplateParameterList(unsigned index) const
SourceLocation getTypeSpecStartLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
const AssociatedConstraint & getTrailingRequiresClause() const
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
unsigned getNumTemplateParameterLists() const
void setTypeSourceInfo(TypeSourceInfo *TI)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
TypeSourceInfo * getTypeSourceInfo() const
A decomposition declaration.
ArrayRef< BindingDecl * > bindings() const
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
Provides information about a dependent function-template specialization declaration.
RAII object that enters a new function expression evaluation context.
RAII object that enters a new expression evaluation context.
An instance of this object exists for each enum constant that is defined.
enumerator_range enumerators() const
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
EnumDecl * getDefinition() const
TemplateSpecializationKind getTemplateSpecializationKind() const
If this enumeration is a member of a specialization of a templated class, determine what kind of temp...
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
bool isInvalid() const
Determine if the explicit specifier is invalid.
static ExplicitSpecifier Invalid()
const Expr * getExpr() const
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
This represents one expression.
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExprUnevaluated - Return true if this expression might be usable in a constant exp...
bool isValueDependent() const
Determines whether the value of this expression depends on.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
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,...
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Declaration context for names declared as extern "C" in C++.
Abstract interface for external sources of AST nodes.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
bool isMutable() const
Determines whether this field is mutable (C++ only).
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, SourceLocation EllipsisLoc={}, ArrayRef< TemplateParameterList * > FriendTypeTPLists={})
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
void setUnsupportedFriend(bool Unsupported)
SourceRange getSourceRange() const override LLVM_READONLY
Retrieves the source range for the friend declaration.
SourceLocation getEllipsisLoc() const
Retrieves the location of the '...', if present.
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
bool isPackExpansion() const
Declaration of a friend template.
static DefaultedOrDeletedFunctionInfo * Create(ASTContext &Context, ArrayRef< DeclAccessPair > Lookups, StringLiteral *DeletedMessage=nullptr)
Represents a function declaration or definition.
void setInstantiationIsPending(bool IC)
State that the instantiation of this function is pending.
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin=false, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, const AssociatedConstraint &TrailingRequiresClause={})
const ParmVarDecl * getParamDecl(unsigned i) const
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
ConstexprSpecKind getConstexprKind() const
DefaultedOrDeletedFunctionInfo * getDefaultedOrDeletedInfo() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
StringLiteral * getDeletedMessage() const
Get the message that indicates why this function was deleted.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool UsesFPIntrin() const
Determine whether the function was declared in source context that requires constrained FP intrinsics...
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
bool hasWrittenPrototype() const
Whether this function has a written prototype.
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
bool isDeleted() const
Whether this function has been deleted.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function.
bool FriendConstraintRefersToEnclosingTemplate() const
bool isDeletedAsWritten() const
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
FunctionDecl * getDefinition()
Get the definition for this declaration.
bool isTypeAwareOperatorNewOrDelete() const
Determine whether this is a type aware operator new or delete.
bool isThisDeclarationInstantiatedFromAFriendDefinition() const
Determine whether this specific declaration of the function is a friend declaration that was instanti...
bool isDefaulted() const
Whether this function is defaulted.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
DeclarationNameInfo getNameInfo() const
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
FunctionDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
const ASTTemplateArgumentListInfo * getTemplateSpecializationArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
QualType getParamType(unsigned i) const
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
ExtProtoInfo getExtProtoInfo() const
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
ArrayRef< QualType > getParamTypes() const
Declaration of a template function.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
void setInstantiatedFromMemberTemplate(FunctionTemplateDecl *D)
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
ParmVarDecl * getParam(unsigned i) const
void setParam(unsigned i, ParmVarDecl *VD)
ExtInfo getExtInfo() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
QualType getReturnType() const
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Represents a field injected from an anonymous union/struct into the parent scope.
unsigned getChainingSize() const
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, const IdentifierInfo *Id, QualType T, MutableArrayRef< NamedDecl * > CH)
ArrayRef< NamedDecl * > chain() const
Description of a constructor that was inherited from a base class.
const TypeClass * getTypePtr() const
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
An lvalue reference type, per C++11 [dcl.ref].
Represents the declaration of a label.
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
A stack-allocated class that identifies which local variable declaration instantiations are present i...
SmallVector< ValueDecl *, 4 > DeclArgumentPack
A set of declarations.
void InstantiatedLocal(const Decl *D, Decl *Inst)
void InstantiatedLocalPackArg(const Decl *D, VarDecl *Inst)
void MakeInstantiatedLocalArgPack(const Decl *D)
Represents the results of name lookup.
An instance of this class represents the declaration of a property member.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
IdentifierInfo * getGetterId() const
IdentifierInfo * getSetterId() const
Provides information a specialization of a member of a class template, which may be a member function...
Data structure that captures multiple levels of template argument lists for use in template instantia...
const ArgList & getInnermost() const
Retrieve the innermost template argument list.
void addOuterTemplateArguments(Decl *AssociatedDecl, ArgList Args, bool Final)
Add a new outmost level to the multi-level template argument list.
void setKind(TemplateSubstitutionKind K)
void addOuterRetainedLevels(unsigned Num)
unsigned getNumRetainedOuterLevels() const
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
bool hasLinkage() const
Determine whether this declaration has linkage.
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
Represents a C++ namespace alias.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamespaceBaseDecl *Namespace)
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
bool hasQualifier() const
Evaluates true when this nested-name-specifier location is non-empty.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
unsigned getDepth() const
Get the nesting depth of the template parameter.
Expr * getPlaceholderTypeConstraint() const
Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
This represents 'pragma omp allocate ...' directive.
clauselist_range clauselists()
Pseudo declaration for capturing expressions.
This represents 'pragma omp declare mapper ...' directive.
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name.
clauselist_iterator clauselist_begin()
clauselist_range clauselists()
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
Expr * getMapperVarRef()
Get the variable declared in the mapper.
This represents 'pragma omp declare reduction ...' directive.
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Expr * getInitPriv()
Get Priv variable of the initializer.
Expr * getCombinerOut()
Get Out variable of the combiner.
Expr * getCombinerIn()
Get In variable of the combiner.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name.
Expr * getInitOrig()
Get Orig variable of the initializer.
OMPDeclareReductionInitKind getInitializerKind() const
Get initializer kind.
This represents 'pragma omp groupprivate ...' directive.
This represents 'pragma omp requires...' directive.
This represents 'pragma omp threadprivate ...' directive.
Represents a field declaration created by an @defs(...).
static OpaquePtr make(QualType P)
static OpenACCBindClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, const IdentifierInfo *ID, SourceLocation EndLoc)
OpenACCDirectiveKind getDirectiveKind() const
ArrayRef< const OpenACCClause * > clauses() const
SourceLocation getDirectiveLoc() const
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCModifierKind Mods, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceResidentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCLinkClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNoHostClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
SourceLocation getRParenLoc() const
const Expr * getFunctionReference() const
SourceLocation getLParenLoc() const
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
Represents a parameter to a function.
Represents a #pragma detect_mismatch line.
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
A (possibly-)qualified type.
bool isRestrictQualified() const
Determine whether this type is restrict-qualified.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getAtomicUnqualifiedType() const
Remove all qualifiers including _Atomic.
The collection of all-type qualifiers we support.
Represents a struct/union/class.
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Wrapper for source info for record types.
Declaration of a redeclarable template.
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
Represents the body of a requires-expression.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
Scope - A scope is a transient data structure that is used while parsing the program.
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
void addAMDGPUMaxNumWorkGroupsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XExpr, Expr *YExpr, Expr *ZExpr)
addAMDGPUMaxNumWorkGroupsAttr - Adds an amdgpu_max_num_work_groups attribute to a particular declarat...
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
void checkAllowedInitializer(VarDecl *VD)
QualType getInoutParameterType(QualType Ty)
bool inferObjCARCLifetime(ValueDecl *decl)
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, Sema::RetainOwnershipKind K, bool IsTemplateInstantiation)
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
OpenACCDirectiveKind getDirectiveKind() const
OpenACCClauseKind getClauseKind() const
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< Expr * > AdjustArgsNothing, ArrayRef< Expr * > AdjustArgsNeedDevicePtr, ArrayRef< Expr * > AdjustArgsNeedDeviceAddr, ArrayRef< OMPInteropInfo > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
std::optional< std::pair< FunctionDecl *, Expr * > > checkOpenMPDeclareVariantFunction(DeclGroupPtrTy DG, Expr *VariantRef, OMPTraitInfo &TI, unsigned NumAppendArgs, SourceRange SR)
Checks '#pragma omp declare variant' variant function and original functions after parsing of the ass...
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI abi)
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
CXXSpecialMemberKind asSpecialMember() const
A helper class for building up ExtParameterInfos.
Records and restores the CurFPFeatures state on entry/exit of compound statements.
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Sema - This implements semantic analysis and AST building for C.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc, NamedDecl *TemplateParam=nullptr)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc, const LookupResult *R=nullptr, const UsingDecl *UD=nullptr)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD)
Determine the kind of defaulting that would be done for a given function.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupUsingDeclName
Look up all declarations in a scope with the given name, including resolved using declarations.
@ LookupRedeclarationWithLinkage
Look up an ordinary name that is going to be redeclared as a name with linkage.
Decl * ActOnSkippedFunctionBody(Decl *Decl)
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation.
void deduceOpenCLAddressSpace(VarDecl *decl)
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
PragmaStack< FPOptionsOverride > FpPragmaStack
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc, CodeSynthesisContext::SynthesisKind CSC=CodeSynthesisContext::ExplicitTemplateArgumentSubstitution)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec)
tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList *PartialSpecArgs, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation=false, bool RetainFunctionScopeInfo=false)
Performs semantic analysis at the end of a function body.
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
ExpressionEvaluationContextRecord & parentEvaluationContext()
LateParsedTemplateMapT LateParsedTemplateMap
bool SubstExprs(ArrayRef< Expr * > Exprs, bool IsCall, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< Expr * > &Outputs)
Substitute the given template arguments into a list of expressions, expanding pack expansions if requ...
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
DiagnosticsEngine & getDiagnostics() const
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool FailOnPackProducingTemplates, bool &ShouldExpand, bool &RetainExpansion, UnsignedOrNone &NumExpansions, bool Diagnose=true)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, const IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
void CleanupVarDeclMarking()
ASTContext & getASTContext() const
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
SmallVector< LateInstantiatedAttribute, 1 > LateInstantiatedAttrVec
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
@ TPL_TemplateMatch
We are matching the template parameter lists of two templates that might be redeclarations.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
NamedReturnInfo getNamedReturnInfo(Expr *&E, SimplerImplicitMoveMode Mode=SimplerImplicitMoveMode::Normal)
Determine whether the given expression might be move-eligible or copy-elidable in either a (co_)retur...
Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TranslationUnitKind TUKind=TU_Complete, CodeCompleteConsumer *CompletionConsumer=nullptr)
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
const LangOptions & getLangOpts() const
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
const LangOptions & LangOpts
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr, FnBodyKind BodyKind=FnBodyKind::Other)
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst)
Update instantiation attributes after template was late parsed.
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
const VarDecl * getCopyElisionCandidate(NamedReturnInfo &Info, QualType ReturnType)
Updates given NamedReturnInfo's move-eligible and copy-elidable statuses, considering the function re...
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
UnsignedOrNone getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
ExplicitSpecifier instantiateExplicitSpecifier(const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES)
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument > > Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false, bool ForDefaultArgumentSubstitution=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
SourceManager & getSourceManager() const
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='.
void PerformPendingInstantiations(bool LocalOnly=false, bool AtEndOfTU=true)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraints=true)
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
UnsignedOrNone ArgPackSubstIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
QualType CheckTemplateIdType(ElaboratedTypeKeyword Keyword, TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, Scope *Scope, bool ForNestedNameSpecifier)
RedeclarationKind forRedeclarationInCurContext() const
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.
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.
bool SubstDefaultArgument(SourceLocation Loc, ParmVarDecl *Param, const MultiLevelTemplateArgumentList &TemplateArgs, bool ForCallExpr=false)
Substitute the given template arguments into the default argument.
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
IntrusiveRefCntPtr< ExternalSemaSource > ExternalSource
Source of additional semantic information.
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
bool hasUncompilableErrorOccurred() const
Whether uncompilable error has occurred.
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
void addClusterDimsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *X, Expr *Y, Expr *Z)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
LateTemplateParserCB * LateTemplateParser
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true, bool *Unreachable=nullptr)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
SourceManager & SourceMgr
bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo, SourceLocation OpLoc, SourceRange R)
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
Attr * CreateAnnotationAttr(const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
CreateAnnotationAttr - Creates an annotation Annot with Args arguments.
@ TPC_FriendFunctionTemplate
@ TPC_FriendFunctionTemplateDefinition
void DiagnoseUnusedDecl(const NamedDecl *ND)
void ActOnUninitializedDecl(Decl *dcl)
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
bool CheckSpanLikeType(const AttributeCommonInfo &CI, const QualType &Ty)
Check that the type is a plain record with one field being a pointer type and the other field being a...
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false, VarTemplateSpecializationDecl *PrevVTSD=nullptr)
BuildVariableInstantiation - Used after a new variable has been created.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument E is a ASCII string literal.
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr, bool SkipImmediateInvocations=true)
Instantiate or parse a C++ default argument expression as necessary.
ASTMutationListener * getASTMutationListener() const
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
Represents a C++11 static_assert declaration.
SourceLocation getRParenLoc() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
Represents the declaration of a struct/union/class/enum.
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
TypedefNameDecl * getTypedefNameForAnonDecl() const
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type?
TagKind getTagKind() const
SourceLocation getNameLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
A template argument list.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
SourceLocation getTemplateKWLoc() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Represents a template argument.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
@ Pack
The template argument is actually a parameter pack.
@ RewriteSpaceshipAsEqualEqual
void setEvaluateConstraints(bool B)
Decl * VisitDecl(Decl *D)
VarTemplateSpecializationDecl * VisitVarTemplateSpecializationDecl(VarTemplateDecl *VarTemplate, VarDecl *FromVar, ArrayRef< TemplateArgument > Converted, VarTemplateSpecializationDecl *PrevDecl=nullptr)
Decl * VisitVarDecl(VarDecl *D, bool InstantiatingVarTemplate, ArrayRef< BindingDecl * > *Bindings=nullptr)
bool InitMethodInstantiation(CXXMethodDecl *New, CXXMethodDecl *Tmpl)
Initializes common fields of an instantiated method declaration (New) from the corresponding fields o...
bool InitFunctionInstantiation(FunctionDecl *New, FunctionDecl *Tmpl)
Initializes the common fields of an instantiation function declaration (New) from the corresponding f...
VarTemplatePartialSpecializationDecl * InstantiateVarTemplatePartialSpecialization(VarTemplateDecl *VarTemplate, VarTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a variable template partial specialization.
void adjustForRewrite(RewriteKind RK, FunctionDecl *Orig, QualType &T, TypeSourceInfo *&TInfo, DeclarationNameInfo &NameInfo)
TypeSourceInfo * SubstFunctionType(FunctionDecl *D, SmallVectorImpl< ParmVarDecl * > &Params)
void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern)
Decl * VisitFunctionDecl(FunctionDecl *D, TemplateParameterList *TemplateParams, RewriteKind RK=RewriteKind::None)
Normal class members are of more specific types and therefore don't make it here.
Decl * VisitCXXMethodDecl(CXXMethodDecl *D, TemplateParameterList *TemplateParams, RewriteKind RK=RewriteKind::None)
Decl * InstantiateTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
Decl * VisitBaseUsingDecls(BaseUsingDecl *D, BaseUsingDecl *Inst, LookupResult *Lookup)
bool SubstQualifier(const DeclaratorDecl *OldDecl, DeclaratorDecl *NewDecl)
TemplateParameterList * SubstTemplateParams(TemplateParameterList *List)
Instantiates a nested template parameter list in the current instantiation context.
Decl * InstantiateTypedefNameDecl(TypedefNameDecl *D, bool IsTypeAlias)
ClassTemplatePartialSpecializationDecl * InstantiateClassTemplatePartialSpecialization(ClassTemplateDecl *ClassTemplate, ClassTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a class template partial specialization.
bool SubstDefaultedFunction(FunctionDecl *New, FunctionDecl *Tmpl)
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isNull() const
Determine whether this template name is NULL.
A template parameter object.
Stores a list of template parameters for a TemplateDecl and its derived classes.
SourceRange getSourceRange() const LLVM_READONLY
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
SourceLocation getRAngleLoc() const
SourceLocation getLAngleLoc() const
ArrayRef< NamedDecl * > asArray()
SourceLocation getTemplateLoc() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool wasDeclaredWithTypename() const
Whether this template template parameter was declared with the 'typename' keyword.
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
TemplateNameKind templateParameterKind() const
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateNameKind ParameterKind, bool Typename, TemplateParameterList *Params)
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
unsigned getIndex() const
Retrieve the index of the template parameter.
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
UnsignedOrNone getNumExpansionParameters() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
bool isParameterPack() const
Returns whether this is a parameter pack.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, UnsignedOrNone NumExpanded=std::nullopt)
unsigned getDepth() const
Retrieve the depth of the template parameter.
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
The top declaration context.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
Declaration of an alias template.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
const Type * getTypeForDecl() const
SourceLocation getBeginLoc() const LLVM_READONLY
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
void pushTrivial(ASTContext &Context, QualType T, SourceLocation Loc)
Pushes 'T' with all locations pointing to 'Loc'.
Base wrapper for a particular "section" of type source info.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
TypeLoc IgnoreParens() const
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
bool isRValueReferenceType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isLValueReferenceType() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isTemplateTypeParmType() const
bool isAtomicType() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
bool isFunctionType() const
const T * getAs() const
Member-template getAs<specific type>'.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
Base class for declarations which introduce a typedef-name.
TypeSourceInfo * getTypeSourceInfo() const
QualType getUnderlyingType() const
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
static UnresolvedUsingIfExistsDecl * Create(ASTContext &Ctx, DeclContext *DC, SourceLocation Loc, DeclarationName Name)
Represents a dependent using declaration which was marked with typename.
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Represents a dependent using declaration which was not marked with typename.
Represents a C++ using-declaration.
bool hasTypename() const
Return true if the using declaration has 'typename'.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
DeclarationNameInfo getNameInfo() const
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Represents C++ using-directive.
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
SourceLocation getIdentLocation() const
Returns the location of this using declaration's identifier.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Represents a C++ using-enum-declaration.
SourceLocation getEnumLoc() const
The source location of the 'enum' keyword.
EnumDecl * getEnumDecl() const
TypeSourceInfo * getEnumType() const
static UsingEnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, SourceLocation EnumL, SourceLocation NameL, TypeSourceInfo *EnumType)
SourceLocation getUsingLoc() const
The source location of the 'using' keyword.
Represents a pack of using declarations that a single using-declarator pack-expanded into.
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
void setType(QualType newType)
bool isParameterPack() const
Determine whether this value is actually a function parameter pack, init-capture pack,...
Represents a variable declaration or definition.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
void setObjCForDecl(bool FRD)
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
void setCXXForRangeDecl(bool FRD)
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
TLSKind getTLSKind() const
void setInitStyle(InitializationStyle Style)
VarDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
void setInitCapture(bool IC)
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member.
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
@ CallInit
Call-style initialization (C++98)
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C.
void setPreviousDeclInSameBlockScope(bool Same)
bool isInlineSpecified() const
bool isStaticDataMember() const
Determines whether this is a static data member.
VarDecl * getTemplateInstantiationPattern() const
Retrieve the variable declaration from which this variable could be instantiated, if it is an instant...
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
bool mightBeUsableInConstantExpressions(const ASTContext &C) const
Determine whether this variable's value might be usable in a constant expression, according to the re...
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
void setInlineSpecified()
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template,...
void setTSCSpec(ThreadStorageClassSpecifier TSC)
void setNRVOVariable(bool NRVO)
bool isInline() const
Whether this variable is (C++1z) inline.
ThreadStorageClassSpecifier getTSCSpec() const
const Expr * getInit() const
void setConstexpr(bool IC)
void setDescribedVarTemplate(VarTemplateDecl *Template)
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
StorageClass getStorageClass() const
Returns the storage class as written in the source.
void setImplicitlyInline()
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
VarDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
TemplateSpecializationKind getTemplateSpecializationKindForInstantiation() const
Get the template specialization kind of this variable for the purposes of template instantiation.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Declaration of a variable template.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
VarTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(VarTemplatePartialSpecializationDecl *D)
Find a variable template partial specialization which was instantiated from the given member partial ...
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void setCompleteDefinition()
Decl * Visit(PTR(Decl) D)
QualType FunctionType
BlockType - The function type of the block, if one was given.
void addCapture(ValueDecl *Var, bool isBlock, bool isByref, bool isNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, bool Invalid)
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool NE(InterpState &S, CodePtr OpPC)
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
Attr * instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
Attr * instantiateTemplateAttributeForDecl(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
void atTemplateEnd(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
bool isa(CodeGen::Address addr)
void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
@ Rewrite
We are substituting template parameters for (typically) other template parameters in order to rewrite...
QualType getFunctionOrMethodResultType(const Decl *D)
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ VectorLength
'vector_length' clause, allowed on 'parallel', 'kernels', 'parallel loop', and 'kernels loop' constru...
@ Async
'async' clause, allowed on Compute, Data, 'update', 'wait', and Combined constructs.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ NumGangs
'num_gangs' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ UseDevice
'use_device' clause, allowed on 'host_data' construct.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ FirstPrivate
'firstprivate' clause, allowed on 'parallel', 'serial', 'parallel loop', and 'serial loop' constructs...
@ Tile
'tile' clause, allowed on 'loop' and Combined constructs.
@ Independent
'independent' clause, allowed on 'loop' directives.
@ NumWorkers
'num_workers' clause, allowed on 'parallel', 'kernels', parallel loop', and 'kernels loop' constructs...
@ IfPresent
'if_present' clause, allowed on 'host_data' and 'update' directives.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
@ Delete
'delete' clause, allowed on the 'exit data' construct.
@ Finalize
'finalize' clause, allowed on 'exit data' directive.
StorageClass
Storage classes.
bool isGenericLambdaCallOperatorOrStaticInvokerSpecialization(const DeclContext *DC)
@ Property
The type of a property.
@ Result
The result type of a method or function.
ActionResult< CXXCtorInitializer * > MemInitResult
@ Template
We are parsing a template declaration.
@ FunctionTemplate
The name was classified as a function template name.
@ VarTemplate
The name was classified as a variable template name.
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
U cast(CodeGen::Address addr)
@ None
No keyword precedes the qualified type name.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
bool isLambdaMethod(const DeclContext *DC)
ActionResult< Expr * > ExprResult
@ Other
Other implicit parameter.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_None
no exception specification
@ EST_BasicNoexcept
noexcept
@ EST_Unevaluated
not evaluated yet, for special member function
ActionResult< Stmt * > StmtResult
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
ArrayRef< TemplateArgumentLoc > arguments() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
const DeclarationNameLoc & getInfo() const
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
Holds information about the various types of exception specification.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionType::ExtInfo ExtInfo
bool StrictPackMatch
Is set to true when, in the context of TTP matching, a pack parameter matches non-pack arguments.
SmallVector< TemplateArgument, 4 > CanonicalConverted
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
SynthesisKind
The kind of template instantiation we are performing.
@ BuildingDeductionGuides
We are building deduction guides for a class.
@ DeducedTemplateArgumentSubstitution
We are substituting template argument determined as part of template argument deduction for either a ...
bool InLifetimeExtendingContext
Whether we are currently in a context in which all temporaries must be lifetime-extended,...
bool RebuildDefaultArgOrDefaultInit
Whether we should rebuild CXXDefaultArgExpr and CXXDefaultInitExpr.
VarDecl * DeclForInitializer
Declaration for initializer if one is currently being parsed.
A stack object to be created when performing template instantiation.
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.