36 #include "llvm/Support/TimeProfiler.h"
39 using namespace clang;
47 return cast<CXXRecordDecl>(DC)->isLocalClass();
52 template<
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);
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,
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;
132 std::optional<unsigned> NumExpansions;
136 Unexpanded, TemplateArgs, Expand,
137 RetainExpansion, NumExpansions))
144 for (
unsigned I = 0; I != *NumExpansions; ++I) {
153 const AssumeAlignedAttr *Aligned,
Decl *New) {
158 Expr *E, *OE =
nullptr;
160 if (Result.isInvalid())
162 E = Result.getAs<
Expr>();
164 if (Aligned->getOffset()) {
165 Result = S.
SubstExpr(Aligned->getOffset(), TemplateArgs);
166 if (Result.isInvalid())
168 OE = Result.getAs<
Expr>();
176 const AlignValueAttr *Aligned,
Decl *New) {
181 if (!Result.isInvalid())
187 const AllocAlignAttr *Align,
Decl *New) {
190 llvm::APInt(64, Align->getParamIndex().getSourceIndex()),
197 const AnnotateAttr *
Attr,
Decl *New) {
203 bool HasDelayedArgs =
Attr->delayedArgs_size();
212 false, TemplateArgs, Args))
215 StringRef Str =
Attr->getAnnotation();
216 if (HasDelayedArgs) {
217 if (Args.size() < 1) {
227 ActualArgs.insert(ActualArgs.begin(), Args.begin() + 1, Args.end());
228 std::swap(Args, ActualArgs);
236 Expr *Cond =
nullptr;
242 if (Result.isInvalid())
244 Cond = Result.getAs<
Expr>();
250 Cond = Converted.
get();
256 S.
Diag(A->
getLocation(), diag::err_attr_cond_never_constant_expr) << A;
257 for (
const auto &
P : Diags)
258 S.
Diag(
P.first,
P.second);
268 S, TemplateArgs, EIA, EIA->getCond(), Tmpl, New);
272 Cond, EIA->getMessage()));
279 S, TemplateArgs, DIA, DIA->getCond(), Tmpl, New);
284 DIA->getDiagnosticType(), DIA->getArgDependent(), New));
291 const CUDALaunchBoundsAttr &
Attr,
Decl *New) {
297 if (Result.isInvalid())
299 Expr *MaxThreads = Result.getAs<
Expr>();
301 Expr *MinBlocks =
nullptr;
302 if (
Attr.getMinBlocks()) {
304 if (Result.isInvalid())
306 MinBlocks = Result.getAs<
Expr>();
309 Expr *MaxBlocks =
nullptr;
310 if (
Attr.getMaxBlocks()) {
312 if (Result.isInvalid())
314 MaxBlocks = Result.getAs<
Expr>();
331 const OMPDeclareSimdDeclAttr &
Attr,
Decl *New) {
333 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
334 New = FTD->getTemplatedDecl();
335 auto *FD = cast<FunctionDecl>(New);
336 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
341 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
342 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
345 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
346 Local.InstantiatedLocal(
347 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
351 FD->isCXXInstanceMember());
367 if (
auto *E =
Attr.getSimdlen())
370 if (
Attr.uniforms_size() > 0) {
371 for(
auto *E :
Attr.uniforms()) {
375 Uniforms.push_back(Inst.
get());
379 auto AI =
Attr.alignments_begin();
380 for (
auto *E :
Attr.aligneds()) {
384 Aligneds.push_back(Inst.
get());
388 Alignments.push_back(Inst.
get());
392 auto SI =
Attr.steps_begin();
393 for (
auto *E :
Attr.linears()) {
397 Linears.push_back(Inst.
get());
401 Steps.push_back(Inst.
get());
404 LinModifiers.append(
Attr.modifiers_begin(),
Attr.modifiers_end());
407 Uniforms, Aligneds, Alignments, Linears, LinModifiers, Steps,
414 const OMPDeclareVariantAttr &
Attr,
Decl *New) {
416 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
417 New = FTD->getTemplatedDecl();
418 auto *FD = cast<FunctionDecl>(New);
419 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
421 auto &&SubstExpr = [FD, ThisContext, &S, &TemplateArgs](
Expr *E) {
422 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
423 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
426 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
427 Local.InstantiatedLocal(
428 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
432 FD->isCXXInstanceMember());
438 auto &&Subst = [&SubstExpr, &S](
Expr *E) {
448 if (
Expr *E =
Attr.getVariantFuncRef()) {
453 VariantFuncRef = Subst(E);
459 TI = *
Attr.getTraitInfos();
462 auto SubstScoreOrConditionExpr = [&S, Subst](
Expr *&E,
bool) {
477 Expr *E = VariantFuncRef.
get();
481 std::optional<std::pair<FunctionDecl *, Expr *>> DeclVarData =
489 E = DeclVarData->second;
490 FD = DeclVarData->first;
492 if (
auto *VariantDRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) {
493 if (
auto *VariantFD = dyn_cast<FunctionDecl>(VariantDRE->getDecl())) {
494 if (
auto *VariantFTD = VariantFD->getDescribedFunctionTemplate()) {
495 if (!VariantFTD->isThisDeclarationADefinition())
506 SubstFD->getType(), FD->getType(),
514 SubstFD->setInstantiationIsPending(!SubstFD->isDefined());
518 SubstFD->getLocation(),
528 for (
Expr *E :
Attr.adjustArgsNothing()) {
532 NothingExprs.push_back(ER.
get());
534 for (
Expr *E :
Attr.adjustArgsNeedDevicePtr()) {
538 NeedDevicePtrExprs.push_back(ER.
get());
542 AppendArgs.emplace_back(II.IsTarget, II.IsTargetSync);
546 FD, E, TI, NothingExprs, NeedDevicePtrExprs, AppendArgs,
SourceLocation(),
552 const AMDGPUFlatWorkGroupSizeAttr &
Attr,
Decl *New) {
558 if (Result.isInvalid())
560 Expr *MinExpr = Result.getAs<
Expr>();
563 if (Result.isInvalid())
565 Expr *MaxExpr = Result.getAs<
Expr>();
575 Expr *Cond =
nullptr;
583 Cond = SubstResult.
get();
593 const AMDGPUWavesPerEUAttr &
Attr,
Decl *New) {
599 if (Result.isInvalid())
601 Expr *MinExpr = Result.getAs<
Expr>();
603 Expr *MaxExpr =
nullptr;
604 if (
auto Max =
Attr.getMax()) {
606 if (Result.isInvalid())
608 MaxExpr = Result.getAs<
Expr>();
616 const AMDGPUMaxNumWorkGroupsAttr &
Attr,
Decl *New) {
639 const SYCLIntelForcePow2DepthAttr *
Attr,
Decl *New) {
643 if (!Result.isInvalid())
649 const SYCLIntelBankWidthAttr *
Attr,
Decl *New) {
653 if (!Result.isInvalid())
659 const SYCLIntelNumBanksAttr *
Attr,
Decl *New) {
663 if (!Result.isInvalid())
669 const SYCLIntelBankBitsAttr *
Attr,
Decl *New) {
673 for (
auto I :
Attr->args()) {
675 if (Result.isInvalid())
677 Args.push_back(Result.getAs<
Expr>());
685 const SYCLDeviceHasAttr *
Attr,
Decl *New) {
690 false, TemplateArgs, Args))
697 const SYCLUsesAspectsAttr *
Attr,
Decl *New) {
701 for (
auto I :
Attr->aspects()) {
703 if (Result.isInvalid())
705 Args.push_back(Result.getAs<
Expr>());
712 const SYCLIntelPipeIOAttr *
Attr,
Decl *New) {
717 if (!Result.isInvalid())
723 const SYCLIntelLoopFuseAttr *
Attr,
Decl *New) {
727 if (!Result.isInvalid())
733 const IntelReqdSubGroupSizeAttr *A,
Decl *New) {
737 if (!Result.isInvalid())
743 const SYCLIntelNumSimdWorkItemsAttr *A,
Decl *New) {
747 if (!Result.isInvalid())
753 const SYCLIntelSchedulerTargetFmaxMhzAttr *A,
Decl *New) {
757 if (!Result.isInvalid())
763 const SYCLIntelNoGlobalWorkOffsetAttr *A,
Decl *New) {
767 if (!Result.isInvalid())
773 const SYCLIntelMaxGlobalWorkDimAttr *A,
Decl *New) {
777 if (!Result.isInvalid())
783 const SYCLIntelMinWorkGroupsPerComputeUnitAttr *A,
Decl *New) {
787 if (!Result.isInvalid())
789 Result.getAs<
Expr>());
794 const SYCLIntelMaxWorkGroupsPerMultiprocessorAttr *A,
Decl *New) {
798 if (!Result.isInvalid())
800 Result.getAs<
Expr>());
805 const SYCLIntelMaxConcurrencyAttr *A,
Decl *New) {
809 if (!Result.isInvalid())
815 const SYCLIntelPrivateCopiesAttr *A,
Decl *New) {
819 if (!Result.isInvalid())
825 const SYCLIntelMaxReplicatesAttr *A,
Decl *New) {
829 if (!Result.isInvalid())
835 const SYCLIntelInitiationIntervalAttr *A,
Decl *New) {
839 if (!Result.isInvalid())
845 const SYCLIntelESimdVectorizeAttr *A,
Decl *New) {
849 if (!Result.isInvalid())
855 const SYCLAddIRAttributesFunctionAttr *A,
Decl *New) {
860 false, TemplateArgs, Args))
867 const SYCLAddIRAttributesKernelParameterAttr *A,
Decl *New) {
872 false, TemplateArgs, Args))
879 const SYCLAddIRAttributesGlobalVariableAttr *A,
Decl *New) {
884 false, TemplateArgs, Args))
891 const SYCLAddIRAnnotationsMemberAttr *A,
Decl *New) {
896 false, TemplateArgs, Args))
903 const SYCLWorkGroupSizeHintAttr *A,
Decl *New) {
922 const SYCLIntelMaxWorkGroupSizeAttr *A,
Decl *New) {
941 const SYCLReqdWorkGroupSizeAttr *A,
Decl *New) {
963 const SYCLKernelAttr &
Attr,
Decl *New) {
973 if (
const auto *PNA = dyn_cast<PreferredNameAttr>(A)) {
975 const auto *RD = cast<CXXRecordDecl>(D);
979 for (
const auto *ExistingPNA : D->
specific_attrs<PreferredNameAttr>())
981 PNA->getTypedefType()))
986 if (
const auto *BA = dyn_cast<BuiltinAttr>(A)) {
988 switch (BA->getID()) {
989 case Builtin::BIforward:
999 case Builtin::BImove:
1000 case Builtin::BImove_if_noexcept:
1016 const HLSLParamModifierAttr *
Attr,
Decl *New) {
1026 if (
NamedDecl *ND = dyn_cast<NamedDecl>(New)) {
1030 for (
const auto *TmplAttr : Tmpl->
attrs()) {
1037 *
this, dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext()),
1041 TmplAttr,
Context, *
this, TemplateArgs);
1051 case clang::attr::CFConsumed:
1053 case clang::attr::OSConsumed:
1055 case clang::attr::NSConsumed:
1058 llvm_unreachable(
"Wrong argument supplied");
1066 for (
const auto *TmplAttr : Tmpl->
attrs()) {
1071 const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
1072 if (Aligned && Aligned->isAlignmentDependent()) {
1077 if (
const auto *AssumeAligned = dyn_cast<AssumeAlignedAttr>(TmplAttr)) {
1082 if (
const auto *AlignValue = dyn_cast<AlignValueAttr>(TmplAttr)) {
1087 if (
const auto *AllocAlign = dyn_cast<AllocAlignAttr>(TmplAttr)) {
1092 if (
const auto *Annotate = dyn_cast<AnnotateAttr>(TmplAttr)) {
1097 if (
const auto *EnableIf = dyn_cast<EnableIfAttr>(TmplAttr)) {
1099 cast<FunctionDecl>(New));
1103 if (
const auto *DiagnoseIf = dyn_cast<DiagnoseIfAttr>(TmplAttr)) {
1105 cast<FunctionDecl>(New));
1109 if (
const auto *CUDALaunchBounds =
1110 dyn_cast<CUDALaunchBoundsAttr>(TmplAttr)) {
1112 *CUDALaunchBounds, New);
1116 if (
const auto *Mode = dyn_cast<ModeAttr>(TmplAttr)) {
1121 if (
const auto *OMPAttr = dyn_cast<OMPDeclareSimdDeclAttr>(TmplAttr)) {
1126 if (
const auto *OMPAttr = dyn_cast<OMPDeclareVariantAttr>(TmplAttr)) {
1131 if (
const auto *AMDGPUFlatWorkGroupSize =
1132 dyn_cast<AMDGPUFlatWorkGroupSizeAttr>(TmplAttr)) {
1134 *
this, TemplateArgs, *AMDGPUFlatWorkGroupSize, New);
1137 if (
const auto *AMDGPUFlatWorkGroupSize =
1138 dyn_cast<AMDGPUWavesPerEUAttr>(TmplAttr)) {
1140 *AMDGPUFlatWorkGroupSize, New);
1143 if (
const auto *SYCLIntelBankWidth =
1144 dyn_cast<SYCLIntelBankWidthAttr>(TmplAttr)) {
1149 if (
const auto *SYCLIntelNumBanks =
1150 dyn_cast<SYCLIntelNumBanksAttr>(TmplAttr)) {
1154 if (
const auto *SYCLIntelPrivateCopies =
1155 dyn_cast<SYCLIntelPrivateCopiesAttr>(TmplAttr)) {
1157 SYCLIntelPrivateCopies, New);
1159 if (
const auto *SYCLIntelMaxReplicates =
1160 dyn_cast<SYCLIntelMaxReplicatesAttr>(TmplAttr)) {
1162 SYCLIntelMaxReplicates, New);
1164 if (
const auto *SYCLIntelBankBits =
1165 dyn_cast<SYCLIntelBankBitsAttr>(TmplAttr)) {
1169 if (
const auto *SYCLIntelForcePow2Depth =
1170 dyn_cast<SYCLIntelForcePow2DepthAttr>(TmplAttr)) {
1172 SYCLIntelForcePow2Depth, New);
1174 if (
const auto *SYCLIntelPipeIO = dyn_cast<SYCLIntelPipeIOAttr>(TmplAttr)) {
1178 if (
const auto *IntelReqdSubGroupSize =
1179 dyn_cast<IntelReqdSubGroupSizeAttr>(TmplAttr)) {
1181 IntelReqdSubGroupSize, New);
1184 if (
const auto *SYCLIntelNumSimdWorkItems =
1185 dyn_cast<SYCLIntelNumSimdWorkItemsAttr>(TmplAttr)) {
1187 SYCLIntelNumSimdWorkItems, New);
1190 if (
const auto *SYCLIntelSchedulerTargetFmaxMhz =
1191 dyn_cast<SYCLIntelSchedulerTargetFmaxMhzAttr>(TmplAttr)) {
1193 *
this, TemplateArgs, SYCLIntelSchedulerTargetFmaxMhz, New);
1196 if (
const auto *SYCLIntelMaxGlobalWorkDim =
1197 dyn_cast<SYCLIntelMaxGlobalWorkDimAttr>(TmplAttr)) {
1199 SYCLIntelMaxGlobalWorkDim, New);
1202 if (
const auto *SYCLIntelMinWorkGroupsPerComputeUnit =
1203 dyn_cast<SYCLIntelMinWorkGroupsPerComputeUnitAttr>(TmplAttr)) {
1205 *
this, TemplateArgs, SYCLIntelMinWorkGroupsPerComputeUnit, New);
1208 if (
const auto *SYCLIntelMaxWorkGroupsPerMultiprocessor =
1209 dyn_cast<SYCLIntelMaxWorkGroupsPerMultiprocessorAttr>(TmplAttr)) {
1211 *
this, TemplateArgs, SYCLIntelMaxWorkGroupsPerMultiprocessor, New);
1214 if (
const auto *SYCLIntelLoopFuse =
1215 dyn_cast<SYCLIntelLoopFuseAttr>(TmplAttr)) {
1220 if (
const auto *SYCLIntelNoGlobalWorkOffset =
1221 dyn_cast<SYCLIntelNoGlobalWorkOffsetAttr>(TmplAttr)) {
1223 *
this, TemplateArgs, SYCLIntelNoGlobalWorkOffset, New);
1226 if (
const auto *SYCLReqdWorkGroupSize =
1227 dyn_cast<SYCLReqdWorkGroupSizeAttr>(TmplAttr)) {
1229 SYCLReqdWorkGroupSize, New);
1232 if (
const auto *SYCLIntelMaxWorkGroupSize =
1233 dyn_cast<SYCLIntelMaxWorkGroupSizeAttr>(TmplAttr)) {
1235 SYCLIntelMaxWorkGroupSize, New);
1238 if (
const auto *SYCLIntelMaxConcurrency =
1239 dyn_cast<SYCLIntelMaxConcurrencyAttr>(TmplAttr)) {
1241 SYCLIntelMaxConcurrency, New);
1243 if (
const auto *SYCLIntelInitiationInterval =
1244 dyn_cast<SYCLIntelInitiationIntervalAttr>(TmplAttr)) {
1246 *
this, TemplateArgs, SYCLIntelInitiationInterval, New);
1249 if (
const auto *SYCLIntelESimdVectorize =
1250 dyn_cast<SYCLIntelESimdVectorizeAttr>(TmplAttr)) {
1252 SYCLIntelESimdVectorize, New);
1255 if (
const auto *SYCLAddIRAttributesFunction =
1256 dyn_cast<SYCLAddIRAttributesFunctionAttr>(TmplAttr)) {
1258 *
this, TemplateArgs, SYCLAddIRAttributesFunction, New);
1261 if (
const auto *SYCLAddIRAttributesKernelParameter =
1262 dyn_cast<SYCLAddIRAttributesKernelParameterAttr>(TmplAttr)) {
1264 *
this, TemplateArgs, SYCLAddIRAttributesKernelParameter, New);
1267 if (
const auto *SYCLAddIRAttributesGlobalVariable =
1268 dyn_cast<SYCLAddIRAttributesGlobalVariableAttr>(TmplAttr)) {
1270 *
this, TemplateArgs, SYCLAddIRAttributesGlobalVariable, New);
1273 if (
const auto *SYCLAddIRAnnotationsMember =
1274 dyn_cast<SYCLAddIRAnnotationsMemberAttr>(TmplAttr)) {
1276 *
this, TemplateArgs, SYCLAddIRAnnotationsMember, New);
1279 if (
const auto *A = dyn_cast<SYCLWorkGroupSizeHintAttr>(TmplAttr)) {
1283 if (
const auto *A = dyn_cast<SYCLDeviceHasAttr>(TmplAttr)) {
1287 if (
const auto *A = dyn_cast<SYCLUsesAspectsAttr>(TmplAttr)) {
1292 if (
const auto *AMDGPUMaxNumWorkGroups =
1293 dyn_cast<AMDGPUMaxNumWorkGroupsAttr>(TmplAttr)) {
1295 *
this, TemplateArgs, *AMDGPUMaxNumWorkGroups, New);
1298 if (
const auto *ParamAttr = dyn_cast<HLSLParamModifierAttr>(TmplAttr)) {
1304 if (TmplAttr->getKind() == attr::DLLExport ||
1305 TmplAttr->getKind() == attr::DLLImport) {
1306 if (New->
hasAttr<DLLExportAttr>() || New->
hasAttr<DLLImportAttr>()) {
1311 if (
const auto *ABIAttr = dyn_cast<ParameterABIAttr>(TmplAttr)) {
1316 if (isa<NSConsumedAttr>(TmplAttr) || isa<OSConsumedAttr>(TmplAttr) ||
1317 isa<CFConsumedAttr>(TmplAttr)) {
1323 if (
auto *A = dyn_cast<PointerAttr>(TmplAttr)) {
1324 if (!New->
hasAttr<PointerAttr>())
1329 if (
auto *A = dyn_cast<OwnerAttr>(TmplAttr)) {
1330 if (!New->
hasAttr<OwnerAttr>())
1335 if (
auto *A = dyn_cast<SYCLKernelAttr>(TmplAttr)) {
1340 assert(!TmplAttr->isPackExpansion());
1341 if (TmplAttr->isLateParsed() && LateAttrs) {
1350 auto *ND = cast<NamedDecl>(New);
1351 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext());
1353 ND->isCXXInstanceMember());
1356 *
this, TemplateArgs);
1370 for (
const auto *
Attr : Pattern->
attrs()) {
1371 if (
auto *A = dyn_cast<StrictFPAttr>(
Attr)) {
1372 if (!Inst->
hasAttr<StrictFPAttr>())
1389 DLLExportAttr *
Attr = Ctor->
getAttr<DLLExportAttr>();
1392 for (
unsigned I = 0; I != NumParams; ++I) {
1403 template<
typename DeclT>
1410 if (Result && isa<CXXRecordDecl>(D->getDeclContext()) &&
1419 llvm_unreachable(
"Translation units cannot be instantiated");
1423 llvm_unreachable(
"HLSL buffer declarations cannot be instantiated");
1428 llvm_unreachable(
"pragma comment cannot be instantiated");
1431 Decl *TemplateDeclInstantiator::VisitPragmaDetectMismatchDecl(
1433 llvm_unreachable(
"pragma comment cannot be instantiated");
1438 llvm_unreachable(
"extern \"C\" context cannot be instantiated");
1442 llvm_unreachable(
"GUID declaration cannot be instantiated");
1445 Decl *TemplateDeclInstantiator::VisitUnnamedGlobalConstantDecl(
1447 llvm_unreachable(
"UnnamedGlobalConstantDecl cannot be instantiated");
1450 Decl *TemplateDeclInstantiator::VisitTemplateParamObjectDecl(
1452 llvm_unreachable(
"template parameter objects cannot be instantiated");
1456 TemplateDeclInstantiator::VisitLabelDecl(
LabelDecl *D) {
1464 TemplateDeclInstantiator::VisitNamespaceDecl(
NamespaceDecl *D) {
1465 llvm_unreachable(
"Namespaces cannot be instantiated");
1484 bool Invalid =
false;
1488 DI = SemaRef.
SubstType(DI, TemplateArgs,
1529 TagDecl *oldTag = oldTagType->getDecl();
1595 if (InstTemplate.isInvalid())
1599 if (getPreviousDeclForInstantiation<TypedefNameDecl>(Pattern)) {
1601 if (!Found.
empty()) {
1602 PrevAliasTemplate = dyn_cast<TypeAliasTemplateDecl>(Found.
front());
1615 if (PrevAliasTemplate)
1620 if (!PrevAliasTemplate)
1640 NewBindings.push_back(cast<BindingDecl>(VisitBindingDecl(OldBD)));
1643 auto *NewDD = cast_or_null<DecompositionDecl>(
1646 if (!NewDD || NewDD->isInvalidDecl())
1647 for (
auto *NewBD : NewBindings)
1648 NewBD->setInvalidDecl();
1658 bool InstantiatingVarTemplate,
1669 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
1702 StartingScope, InstantiatingVarTemplate);
1705 if (
auto *F = dyn_cast<FunctionDecl>(DC))
1706 RT = F->getReturnType();
1707 else if (isa<BlockDecl>(DC))
1711 llvm_unreachable(
"Unknown context type");
1736 if (!InstantiatingVarTemplate) {
1742 diag::err_sycl_device_global_incorrect_scope);
1746 diag::err_sycl_device_global_not_publicly_accessible)
1752 if (isa<FunctionDecl>(DC)) {
1754 diag::err_sycl_device_global_incorrect_scope);
1761 if (
const auto *SYCLDevice = Var->
getAttr<SYCLDeviceAttr>()) {
1764 SemaRef.
Diag(SYCLDevice->getLoc(),
1765 diag::err_sycl_attribute_not_device_global)
1785 Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
1790 DI = SemaRef.
SubstType(DI, TemplateArgs,
1802 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
1813 else if (BitWidth) {
1819 = SemaRef.
SubstExpr(BitWidth, TemplateArgs);
1824 BitWidth = InstantiatedBitWidth.
getAs<
Expr>();
1829 cast<RecordDecl>(Owner),
1842 SemaRef.
InstantiateAttrs(TemplateArgs, D, Field, LateAttrs, StartingScope);
1844 if (
Field->hasAttrs())
1848 Field->setInvalidDecl();
1850 if (!
Field->getDeclName()) {
1855 if (
Parent->isAnonymousStructOrUnion() &&
1856 Parent->getRedeclContext()->isFunctionOrMethod())
1866 Field->getType())) {
1868 diag::err_sycl_device_global_incorrect_scope);
1869 Field->setInvalidDecl();
1883 SemaRef.
Diag(D->
getLocation(), diag::err_property_is_variably_modified)
1887 DI = SemaRef.
SubstType(DI, TemplateArgs,
1899 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
1928 for (
auto *PI : D->
chain()) {
1934 NamedChain[i++] = Next;
1937 QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
1940 {NamedChain, D->getChainingSize()});
1947 Owner->
addDecl(IndirectField);
1948 return IndirectField;
1963 InstTy = SemaRef.
SubstType(Ty, TemplateArgs,
1978 assert(ND &&
"friend decl must be a decl or a type!");
1985 if (!NewND)
return nullptr;
2004 = SemaRef.
SubstExpr(AssertExpr, TemplateArgs);
2010 if (InstantiatedMessageExpr.
isInvalid())
2018 Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
2024 if (!Prev)
return nullptr;
2025 PrevDecl = cast<EnumDecl>(Prev);
2043 Enum->setIntegerTypeSourceInfo(NewTI);
2046 &&
"Dependent type without type source info");
2069 if (Def && Def != D) {
2076 SemaRef.
SubstType(TI->getType(), TemplateArgs,
2079 DefnUnderlying,
true, Enum);
2100 Enum->startDefinition();
2111 if (
Expr *UninstValue = EC->getInitExpr()) {
2121 if (
Value.isInvalid()) {
2134 Enum->setInvalidDecl();
2140 EnumConst->
setAccess(Enum->getAccess());
2141 Enum->addDecl(EnumConst);
2142 Enumerators.push_back(EnumConst);
2143 LastEnumConst = EnumConst;
2146 !Enum->isScoped()) {
2154 SemaRef.
ActOnEnumBody(Enum->getLocation(), Enum->getBraceRange(), Enum,
2159 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
2164 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
2196 if (!Found.
empty()) {
2197 PrevClassTemplate = dyn_cast<ClassTemplateDecl>(Found.
front());
2198 if (PrevClassTemplate)
2211 SS.
Adopt(QualifierLoc);
2213 if (!DC)
return nullptr;
2227 if (R.isSingleResult()) {
2229 if (PrevClassTemplate)
2233 if (!PrevClassTemplate && QualifierLoc) {
2262 if (PrevClassTemplate) {
2293 if (!PrevClassTemplate)
2316 if (!PrevClassTemplate) {
2322 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
2323 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
2324 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[I]));
2331 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
2343 = dyn_cast<ClassTemplateDecl>(Found.
front());
2344 if (!InstClassTemplate)
2356 "Only static data member templates are allowed.");
2372 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
2378 if (!VarInst)
return nullptr;
2389 if (!PrevVarTemplate)
2399 if (!PrevVarTemplate) {
2405 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
2406 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
2407 OutOfLineVarPartialSpecs.push_back(
2408 std::make_pair(Inst, PartialSpecs[I]));
2414 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
2417 "Only static data member templates are allowed.");
2423 assert(!Found.
empty() &&
"Instantiation found nothing?");
2426 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
2466 assert(InstTemplate &&
2467 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
2485 return InstTemplate;
2494 if (!Prev)
return nullptr;
2495 PrevDecl = cast<CXXRecordDecl>(Prev);
2509 IsInjectedClassName);
2511 if (IsInjectedClassName)
2527 if (!IsInjectedClassName)
2533 Record->setObjectOfFriendDecl();
2537 Record->setAnonymousStructOrUnion(
true);
2575 LocalInstantiations.perform();
2580 if (IsInjectedClassName)
2581 assert(
Record->isInjectedClassName() &&
"Broken injected-class-name");
2599 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
2605 NewFunc->getParamTypes(), NewEPI);
2619 if (FunctionTemplate && !TemplateParams) {
2622 void *InsertPos =
nullptr;
2632 if (FunctionTemplate)
2637 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
2639 !(isa<Decl>(Owner) &&
2640 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
2644 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
2646 TemplateArgs, DGuide->getExplicitSpecifier());
2647 if (InstantiatedExplicitSpecifier.
isInvalid())
2657 if (TemplateParams && TemplateParams->
size()) {
2659 dyn_cast<TemplateTypeParmDecl>(TemplateParams->
asArray().back());
2660 if (LastParam && LastParam->isImplicit() &&
2661 LastParam->hasTypeConstraint()) {
2691 }
else if (isFriend && QualifierLoc) {
2693 SS.
Adopt(QualifierLoc);
2695 if (!DC)
return nullptr;
2708 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
2711 InstantiatedExplicitSpecifier, NameInfo,
T, TInfo,
2713 DGuide->getDeductionCandidateKind());
2720 TrailingRequiresClause);
2721 Function->setFriendConstraintRefersToEnclosingTemplate(
2730 Function->setQualifierInfo(QualifierLoc);
2744 Function->setLexicalDeclContext(LexicalDC);
2747 for (
unsigned P = 0;
P < Params.size(); ++
P)
2752 if (TrailingRequiresClause)
2753 Function->setTrailingRequiresClause(TrailingRequiresClause);
2755 if (TemplateParams) {
2774 Function->setDescribedFunctionTemplate(FunctionTemplate);
2782 }
else if (FunctionTemplate &&
2787 Function->setFunctionTemplateSpecialization(FunctionTemplate,
2797 }
else if (!isFriend) {
2801 Function->setInstantiatedFromDecl(D);
2808 FT->setObjectOfFriendDecl();
2814 bool IsExplicitSpecialization =
false;
2825 assert(isFriend &&
"dependent specialization info on "
2826 "non-member non-friend function?");
2830 if (
const auto *ArgsWritten = DFTSI->TemplateArgumentsAsWritten) {
2831 ExplicitArgs.
setLAngleLoc(ArgsWritten->getLAngleLoc());
2832 ExplicitArgs.
setRAngleLoc(ArgsWritten->getRAngleLoc());
2849 DFTSI->TemplateArgumentsAsWritten ? &ExplicitArgs :
nullptr,
2853 IsExplicitSpecialization =
true;
2861 ArgsWritten->getRAngleLoc());
2871 IsExplicitSpecialization =
true;
2872 }
else if (TemplateParams || !FunctionTemplate) {
2888 if (isFriend && !QualifierLoc) {
2908 if (
Function->isLocalExternDecl()) {
2910 if (!PVD->hasDefaultArg())
2916 Expr *UninstExpr = PVD->getUninstantiatedDefaultArg();
2919 { UninstExpr }, UninstExpr->
getType());
2921 PVD->setDefaultArg(ErrorResult.
get());
2927 IsExplicitSpecialization,
2928 Function->isThisDeclarationADefinition());
2934 if (isFriend && TemplateParams && FunctionTemplate->
getPreviousDecl()) {
2938 Function->isThisDeclarationADefinition()
2949 Function->getMemberSpecializationInfo()) {
2950 if (MSInfo->getPointOfInstantiation().isInvalid()) {
2952 MSInfo->setPointOfInstantiation(
Loc);
2967 (TemplateParams ? cast<NamedDecl>(FunctionTemplate) :
Function);
2986 if (FunctionTemplate && !TemplateParams) {
2992 void *InsertPos =
nullptr;
3002 if (FunctionTemplate)
3007 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
3008 !(isa<Decl>(Owner) &&
3009 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
3017 unsigned NumTempParamLists = 0;
3019 TempParamLists.resize(NumTempParamLists);
3020 for (
unsigned I = 0; I != NumTempParamLists; ++I) {
3025 TempParamLists[I] = InstParams;
3031 const bool CouldInstantiate =
3032 InstantiatedExplicitSpecifier.getExpr() ==
nullptr ||
3033 !InstantiatedExplicitSpecifier.getExpr()->isValueDependent();
3037 if (CouldInstantiate ||
3041 TemplateArgs, InstantiatedExplicitSpecifier);
3043 if (InstantiatedExplicitSpecifier.isInvalid())
3055 if (cast<CXXRecordDecl>(D->
getParent())->isLambda() &&
3057 isa<CXXConstructorDecl, CXXDestructorDecl>(D)) {
3069 if (TemplateParams && TemplateParams->
size()) {
3071 dyn_cast<TemplateTypeParmDecl>(TemplateParams->
asArray().back());
3072 if (LastParam && LastParam->isImplicit() &&
3073 LastParam->hasTypeConstraint()) {
3098 SS.
Adopt(QualifierLoc);
3108 if (!DC)
return nullptr;
3127 InstantiatedExplicitSpecifier, Constructor->UsesFPIntrin(),
3128 Constructor->isInlineSpecified(),
false,
3130 TrailingRequiresClause);
3135 Destructor->UsesFPIntrin(), Destructor->isInlineSpecified(),
false,
3136 Destructor->getConstexprKind(), TrailingRequiresClause);
3145 Conversion->UsesFPIntrin(), Conversion->isInlineSpecified(),
3146 InstantiatedExplicitSpecifier, Conversion->getConstexprKind(),
3147 Conversion->getEndLoc(), TrailingRequiresClause);
3153 D->
getEndLoc(), TrailingRequiresClause);
3162 if (TemplateParams) {
3179 TemplateParams, Method);
3186 }
else if (FunctionTemplate) {
3202 if (NumTempParamLists)
3213 for (
unsigned P = 0;
P < Params.size(); ++
P)
3214 Params[
P]->setOwningFunction(Method);
3223 bool IsExplicitSpecialization =
false;
3231 if (
const auto *ArgsWritten = DFTSI->TemplateArgumentsAsWritten) {
3232 ExplicitArgs.
setLAngleLoc(ArgsWritten->getLAngleLoc());
3233 ExplicitArgs.
setRAngleLoc(ArgsWritten->getRAngleLoc());
3249 Method, DFTSI->TemplateArgumentsAsWritten ? &ExplicitArgs :
nullptr,
3253 IsExplicitSpecialization =
true;
3259 ArgsWritten->getRAngleLoc());
3270 IsExplicitSpecialization =
true;
3271 }
else if (!FunctionTemplate || TemplateParams || isFriend) {
3298 for (
unsigned P = 0;
P < Params.size(); ++
P) {
3299 if (!Params[
P]->hasDefaultArg())
3305 Expr *UninstExpr = Params[
P]->getUninstantiatedDefaultArg();
3308 { UninstExpr }, UninstExpr->
getType());
3310 Params[
P]->setDefaultArg(ErrorResult.
get());
3316 IsExplicitSpecialization,
3329 if (FunctionTemplate)
3346 if (IsExplicitSpecialization && !isFriend)
3356 if (
auto *Constructor = dyn_cast<CXXConstructorDecl>(Method)) {
3357 if (Constructor->isDefaultConstructor() ||
3358 Constructor->isCopyOrMoveConstructor())
3366 if (FunctionTemplate) {
3374 }
else if (isFriend) {
3380 Record->makeDeclVisibleInContext(Method);
3391 if (Method->
hasAttr<UsedAttr>()) {
3392 if (
const auto *A = dyn_cast<CXXRecordDecl>(Owner)) {
3395 A->getMemberSpecializationInfo())
3396 Loc = MSInfo->getPointOfInstantiation();
3397 else if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(A))
3398 Loc = Spec->getPointOfInstantiation();
3424 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
3428 std::optional<unsigned> NumExpanded;
3432 assert(TC->getTemplateArgsAsWritten() &&
3433 "type parameter can only be an expansion when explicit arguments "
3439 for (
auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())
3445 bool RetainExpansion =
false;
3447 cast<CXXFoldExpr>(TC->getImmediatelyDeclaredConstraint())
3450 TC->hasExplicitTemplateArgs() ?
3451 TC->getTemplateArgsAsWritten()->getRAngleLoc() :
3452 TC->getConceptNameInfo().getEndLoc()),
3453 Unexpanded, TemplateArgs, Expand, RetainExpansion, NumExpanded))
3472 EvaluateConstraints))
3490 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
3496 bool IsExpandedParameterPack =
false;
3518 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
3519 ExpandedParameterPackTypes.push_back(NewT);
3522 IsExpandedParameterPack =
true;
3537 bool RetainExpansion =
false;
3538 std::optional<unsigned> OrigNumExpansions =
3540 std::optional<unsigned> NumExpansions = OrigNumExpansions;
3542 Pattern.getSourceRange(),
3545 Expand, RetainExpansion,
3550 for (
unsigned I = 0; I != *NumExpansions; ++I) {
3563 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
3564 ExpandedParameterPackTypes.push_back(NewT);
3570 IsExpandedParameterPack =
true;
3607 if (IsExpandedParameterPack)
3612 ExpandedParameterPackTypesAsWritten);
3620 if (AutoLoc.isConstrained()) {
3622 if (IsExpandedParameterPack)
3625 else if (
auto *Constraint = dyn_cast_if_present<CXXFoldExpr>(
3627 EllipsisLoc = Constraint->getEllipsisLoc();
3660 for (
const auto &
P : *Params) {
3661 if (
P->isTemplateParameterPack())
3673 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
3680 bool IsExpandedParameterPack =
false;
3694 ExpandedParams.push_back(Expansion);
3697 IsExpandedParameterPack =
true;
3698 InstParams = TempParams;
3710 bool RetainExpansion =
false;
3711 std::optional<unsigned> NumExpansions;
3716 Expand, RetainExpansion,
3721 for (
unsigned I = 0; I != *NumExpansions; ++I) {
3727 ExpandedParams.push_back(Expansion);
3733 IsExpandedParameterPack =
true;
3734 InstParams = TempParams;
3756 if (IsExpandedParameterPack)
3761 InstParams, ExpandedParams);
3819 for (
auto *Shadow : D->
shadows()) {
3823 NamedDecl *OldTarget = Shadow->getTargetDecl();
3824 if (
auto *CUSD = dyn_cast<ConstructorUsingShadowDecl>(Shadow))
3825 if (
auto *BaseShadow = CUSD->getNominatedBaseClassShadowDecl())
3826 OldTarget = BaseShadow;
3830 dyn_cast<UnresolvedUsingIfExistsDecl>(Shadow->getTargetDecl())) {
3832 SemaRef.
Context, Owner, EmptyD->getLocation(), EmptyD->getDeclName());
3835 Shadow->getLocation(), OldTarget, TemplateArgs));
3847 Shadow->getLocation(), OldPrev, TemplateArgs));
3850 nullptr, Inst, InstTarget, PrevDecl);
3853 if (isFunctionScope)
3860 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
3881 if (
auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.
CurContext))
3887 bool CheckRedeclaration = Owner->
isRecord();
3898 SS.
Adopt(QualifierLoc);
3899 if (CheckRedeclaration) {
3900 Prev.setHideTags(
false);
3965 Decl *TemplateDeclInstantiator::VisitConstructorUsingShadowDecl(
3971 template <
typename T>
3972 Decl *TemplateDeclInstantiator::instantiateUnresolvedUsingDecl(
3973 T *D,
bool InstantiatingPackElement) {
3975 if (D->isPackExpansion() && !InstantiatingPackElement) {
3983 bool RetainExpansion =
false;
3984 std::optional<unsigned> NumExpansions;
3986 D->getEllipsisLoc(), D->getSourceRange(), Unexpanded, TemplateArgs,
3987 Expand, RetainExpansion, NumExpansions))
3992 assert(!RetainExpansion &&
3993 "should never need to retain an expansion for UsingPackDecl");
3999 return instantiateUnresolvedUsingDecl(D,
true);
4009 if (D->getDeclContext()->isFunctionOrMethod() && *NumExpansions > 1) {
4010 SemaRef.
Diag(D->getEllipsisLoc(),
4011 diag::err_using_decl_redeclaration_expansion);
4017 for (
unsigned I = 0; I != *NumExpansions; ++I) {
4019 Decl *Slice = instantiateUnresolvedUsingDecl(D,
true);
4026 Expansions.push_back(cast<NamedDecl>(Slice));
4045 SS.
Adopt(QualifierLoc);
4052 bool InstantiatingSlice = D->getEllipsisLoc().isValid() &&
4057 bool IsUsingIfExists = D->template hasAttr<UsingIfExistsAttr>();
4059 nullptr, D->getAccess(), D->getUsingLoc(),
4060 TD, TypenameLoc, SS, NameInfo, EllipsisLoc,
4062 true, IsUsingIfExists);
4071 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingTypenameDecl(
4073 return instantiateUnresolvedUsingDecl(D);
4076 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingValueDecl(
4078 return instantiateUnresolvedUsingDecl(D);
4081 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingIfExistsDecl(
4083 llvm_unreachable(
"referring to unresolved decl out of UsingShadowDecl");
4091 Expansions.push_back(NewUD);
4102 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
4107 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
4108 Vars.push_back(Var);
4124 assert(isa<DeclRefExpr>(Var) &&
"allocate arg is not a DeclRefExpr");
4125 Vars.push_back(Var);
4131 if (
auto *AC = dyn_cast<OMPAllocatorClause>(C)) {
4136 NewE.
get(), AC->getBeginLoc(), AC->getLParenLoc(), AC->getEndLoc());
4137 }
else if (
auto *AC = dyn_cast<OMPAlignClause>(C)) {
4142 NewE.
get(), AC->getBeginLoc(), AC->getLParenLoc(), AC->getEndLoc());
4147 Clauses.push_back(IC);
4152 if (Res.
get().isNull())
4154 return Res.
get().getSingleDecl();
4159 "Requires directive cannot be instantiated within a dependent context");
4162 Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
4165 const bool RequiresInstantiation =
4170 if (RequiresInstantiation) {
4176 SubstReductionType = D->
getType();
4178 if (SubstReductionType.
isNull())
4182 bool IsCorrect =
true;
4184 std::pair<QualType, SourceLocation> ReductionTypes[] = {
4185 std::make_pair(SubstReductionType, D->
getLocation())};
4187 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
4188 PrevDeclInScope = cast<OMPDeclareReductionDecl>(
4195 auto *NewDRD = cast<OMPDeclareReductionDecl>(DRD.get().getSingleDecl());
4197 Expr *SubstCombiner =
nullptr;
4198 Expr *SubstInitializer =
nullptr;
4205 cast<DeclRefExpr>(NewDRD->getCombinerIn())->getDecl());
4208 cast<DeclRefExpr>(NewDRD->getCombinerOut())->getDecl());
4209 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
4212 SubstCombiner = SemaRef.
SubstExpr(Combiner, TemplateArgs).
get();
4223 cast<DeclRefExpr>(NewDRD->getInitOrig())->getDecl());
4226 cast<DeclRefExpr>(NewDRD->getInitPriv())->getDecl());
4228 SubstInitializer = SemaRef.
SubstExpr(Init, TemplateArgs).
get();
4231 cast<VarDecl>(cast<DeclRefExpr>(D->
getInitPriv())->getDecl());
4232 IsCorrect = IsCorrect && OldPrivParm->hasInit();
4238 NewDRD, SubstInitializer, OmpPrivParm);
4240 IsCorrect = IsCorrect && SubstCombiner &&
4243 SubstInitializer) ||
4245 !SubstInitializer));
4256 const bool RequiresInstantiation =
4262 if (RequiresInstantiation) {
4270 if (SubstMapperTy.
isNull())
4274 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
4275 PrevDeclInScope = cast<OMPDeclareMapperDecl>(
4279 bool IsCorrect =
true;
4291 cast<DeclRefExpr>(MapperVarRef.
get())->getDecl());
4292 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
4297 auto *OldC = cast<OMPMapClause>(C);
4299 for (
Expr *OE : OldC->varlists()) {
4305 NewVars.push_back(
NE);
4313 SS.
Adopt(NewQualifierLoc);
4319 OldC->getIteratorModifier(), OldC->getMapTypeModifiers(),
4320 OldC->getMapTypeModifiersLoc(), SS, NewNameInfo, OldC->getMapType(),
4321 OldC->isImplicitMapType(), OldC->getMapLoc(), OldC->getColonLoc(),
4323 Clauses.push_back(NewC);
4330 VN, D->
getAccess(), MapperVarRef.
get(), Clauses, PrevDeclInScope);
4331 Decl *NewDMD = DG.
get().getSingleDecl();
4336 Decl *TemplateDeclInstantiator::VisitOMPCapturedExprDecl(
4338 llvm_unreachable(
"Should not be met in templates");
4358 llvm_unreachable(
"There are only CXXRecordDecls in C++");
4362 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
4369 "can only instantiate an explicit specialization "
4370 "for a member class template");
4377 if (!InstClassTemplate)
4385 InstTemplateArgs.
setLAngleLoc(TemplateArgsInfo->getLAngleLoc());
4386 InstTemplateArgs.
setRAngleLoc(TemplateArgsInfo->getRAngleLoc());
4389 TemplateArgs, InstTemplateArgs))
4397 InstTemplateArgs,
false,
4398 SugaredConverted, CanonicalConverted,
4404 void *InsertPos =
nullptr;
4436 diag::note_previous_definition);
4444 D->
getLocation(), InstClassTemplate, CanonicalConverted, PrevDecl);
4482 assert(VarTemplate &&
4483 "A template specialization without specialized template?");
4488 if (!InstVarTemplate)
4494 VarTemplateArgsInfo.
setLAngleLoc(TemplateArgsInfo->getLAngleLoc());
4495 VarTemplateArgsInfo.
setRAngleLoc(TemplateArgsInfo->getRAngleLoc());
4498 TemplateArgs, VarTemplateArgsInfo))
4505 VarTemplateArgsInfo,
false,
4506 SugaredConverted, CanonicalConverted,
4511 void *InsertPos =
nullptr;
4525 InstVarTemplate, D, VarTemplateArgsInfo, CanonicalConverted, PrevDecl);
4542 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
4553 void *InsertPos =
nullptr;
4566 StartingScope,
false, PrevDecl);
4572 llvm_unreachable(
"@defs is not supported in Objective-C++");
4579 "cannot instantiate %0 yet");
4587 llvm_unreachable(
"Concept definitions cannot reside inside a template");
4590 Decl *TemplateDeclInstantiator::VisitImplicitConceptSpecializationDecl(
4592 llvm_unreachable(
"Concept specializations cannot reside inside a template");
4602 llvm_unreachable(
"Unexpected decl");
4613 SubstD = Instantiator.Visit(D);
4628 SemaRef.
Context.
BoolTy, FPT->getParamTypes(), FPT->getExtProtoInfo());
4639 assert(OldLoc &&
"type of function is not a function type?");
4641 for (
unsigned I = 0, N = OldLoc.getNumParams(); I != N; ++I)
4642 NewLoc.
setParam(I, OldLoc.getParam(I));
4664 if (
auto *MD = dyn_cast<CXXMethodDecl>(
Spaceship)) {
4669 assert(
Spaceship->getFriendObjectKind() &&
4670 "defaulted spaceship is neither a member nor a friend");
4680 cast<NamedDecl>(R),
Spaceship->getBeginLoc());
4684 return cast_or_null<FunctionDecl>(R);
4696 bool Invalid =
false;
4698 unsigned N = L->
size();
4702 for (
auto &
P : *L) {
4704 Params.push_back(D);
4724 bool EvaluateConstraints) {
4771 ClassTemplate, PartialSpec->
getLocation(), InstTemplateArgs,
4772 false, SugaredConverted, CanonicalConverted))
4778 CanonicalConverted))
4783 void *InsertPos =
nullptr;
4798 ClassTemplate, CanonicalConverted, CanonType,
4826 diag::err_partial_spec_redeclared)
4828 SemaRef.
Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
4840 return InstPartialSpec;
4884 VarTemplate, PartialSpec->
getLocation(), InstTemplateArgs,
4885 false, SugaredConverted, CanonicalConverted))
4891 CanonicalConverted))
4896 void *InsertPos =
nullptr;
4910 diag::err_variable_instantiates_to_function)
4947 diag::err_var_partial_spec_redeclared)
4950 diag::note_var_prev_partial_spec_here);
4961 LateAttrs, Owner, StartingScope);
4963 return InstPartialSpec;
4970 assert(OldTInfo &&
"substituting function without type source info");
4971 assert(Params.empty() &&
"parameter vector is non-empty at start");
4976 ThisContext = cast<CXXRecordDecl>(Owner);
4977 ThisTypeQuals = Method->getFunctionObjectParameterType().getQualifiers();
4982 ThisContext, ThisTypeQuals, EvaluateConstraints);
4988 if (NewTInfo != OldTInfo) {
4992 unsigned NewIdx = 0;
4993 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
4994 OldIdx != NumOldParams; ++OldIdx) {
4995 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
5001 std::optional<unsigned> NumArgumentsInExpansion;
5003 NumArgumentsInExpansion =
5006 if (!NumArgumentsInExpansion) {
5010 Params.push_back(NewParam);
5011 Scope->InstantiatedLocal(OldParam, NewParam);
5014 Scope->MakeInstantiatedLocalArgPack(OldParam);
5015 for (
unsigned I = 0; I != *NumArgumentsInExpansion; ++I) {
5017 Params.push_back(NewParam);
5018 Scope->InstantiatedLocalPackArg(OldParam, NewParam);
5027 cast<FunctionProtoType>(OldProtoLoc.getType());
5028 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
5038 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
5041 Params.push_back(Parm);
5058 TemplateArgs, ParamTypes, &Params,
5068 void Sema::addInstantiatedLocalVarsToScope(
FunctionDecl *Function,
5073 for (
auto *
decl : PatternDecl->
decls()) {
5074 if (!isa<VarDecl>(
decl) || isa<ParmVarDecl>(
decl))
5080 auto it = llvm::find_if(
Function->decls(), [&](
Decl *inst) {
5081 VarDecl *InstVD = dyn_cast<VarDecl>(inst);
5082 return InstVD && InstVD->isLocalVarDecl() &&
5083 InstVD->getIdentifier() == II;
5089 Scope.InstantiatedLocal(VD, *it);
5090 LSI->
addCapture(cast<VarDecl>(*it),
false,
false,
5099 bool Sema::addInstantiatedParametersToScope(
5103 unsigned FParamIdx = 0;
5104 for (
unsigned I = 0, N = PatternDecl->
getNumParams(); I != N; ++I) {
5108 assert(FParamIdx < Function->getNumParams());
5126 Scope.InstantiatedLocal(PatternParam, FunctionParam);
5132 Scope.MakeInstantiatedLocalArgPack(PatternParam);
5133 std::optional<unsigned> NumArgumentsInExpansion =
5135 if (NumArgumentsInExpansion) {
5138 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
5151 Scope.InstantiatedLocalPackArg(PatternParam, FunctionParam);
5183 false, std::nullopt,
5190 L->DefaultArgumentInstantiated(Param);
5212 Diag(PointOfInstantiation, diag::err_exception_spec_cycle) <<
Decl;
5224 false, std::nullopt,
5232 if (addInstantiatedParametersToScope(
Decl, Template,
Scope, TemplateArgs)) {
5266 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
5267 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
5268 if (isa<FunctionTemplateDecl>(ActiveInst.Entity)) {
5270 {ActiveInst.Entity->getCanonicalDecl(), ActiveInst.Kind});
5272 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
5273 ActiveInst.Entity = New;
5279 assert(Proto &&
"Function template without prototype?");
5303 assert(NewProto &&
"Template instantiation without function prototype?");
5321 LateAttrs, StartingScope);
5337 if (isa<CXXDestructorDecl>(New) && SemaRef.
getLangOpts().CPlusPlus11)
5353 Lookups.reserve(DFI->getUnqualifiedLookups().size());
5354 bool AnyChanged =
false;
5357 DA.getDecl(), TemplateArgs);
5360 AnyChanged |= (D != DA.getDecl());
5418 bool DefinitionRequired,
5426 Function->getTemplateSpecializationKindForInstantiation();
5433 !DefinitionRequired)
5438 if (
Function->isDefined(ExistingDefn,
5452 assert(PatternDecl &&
"instantiating a non-template");
5455 Stmt *Pattern =
nullptr;
5457 Pattern = PatternDef->
getBody(PatternDef);
5458 PatternDecl = PatternDef;
5460 PatternDef =
nullptr;
5466 Function->getInstantiatedFromMemberFunction(),
5467 PatternDecl, PatternDef, TSK,
5468 DefinitionRequired)) {
5469 if (DefinitionRequired)
5472 (
Function->isConstexpr() && !Recursive)) {
5476 Function->setInstantiationIsPending(
true);
5478 std::make_pair(
Function, PointOfInstantiation));
5482 Diag(PointOfInstantiation, diag::warn_func_template_missing)
5486 Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
5497 Function->setInstantiationIsPending(
true);
5499 std::make_pair(
Function, PointOfInstantiation));
5503 llvm::TimeTraceScope TimeScope(
"InstantiateFunction", [&]() {
5505 llvm::raw_string_ostream OS(Name);
5530 "missing LateParsedTemplate");
5532 Pattern = PatternDecl->
getBody(PatternDecl);
5539 "unexpected kind of function template definition");
5554 for (
auto *D =
Function->getMostRecentDecl(); ;
5556 D->setImplicitlyInline();
5566 "instantiating function definition");
5570 Function->setVisibleDespiteOwningModule();
5585 ThisTypeQuals = Method->getMethodQualifiers();
5595 bool MergeWithParentScope =
false;
5597 MergeWithParentScope =
5598 Rec->isLocalClass() && !
Function->isFunctionTemplateSpecialization();
5601 auto RebuildTypeSourceInfoForDefaultSpecialMembers = [&]() {
5607 "Special member needs to be defaulted");
5615 auto *NewRec = dyn_cast<CXXRecordDecl>(
Function->getDeclContext());
5616 const auto *PatternRec =
5618 if (!NewRec || !PatternRec)
5620 if (!PatternRec->isLambda())
5623 struct SpecialMemberTypeInfoRebuilder
5643 getDerived().TransformDecl(TL.
getNameLoc(),
T->getDecl()));
5645 return Base::TransformRecordType(TLB, TL);
5647 QualType Result = getDerived().RebuildRecordType(NewDecl);
5648 if (Result.isNull())
5655 } IR{*
this, PatternRec, NewRec};
5658 assert(NewSI &&
"Type Transform failed?");
5660 Function->setTypeSourceInfo(NewSI);
5664 assert(NewParmSI &&
"Type transformation failed.");
5670 RebuildTypeSourceInfoForDefaultSpecialMembers();
5675 std::nullopt,
false, PatternDecl);
5693 if (addInstantiatedParametersToScope(
Function, PatternDecl,
Scope,
5710 Ctor->isDefaultConstructor()) {
5716 Body =
SubstStmt(Pattern, TemplateArgs);
5728 Listener->FunctionDefinitionInstantiated(
Function);
5738 LocalInstantiations.
perform();
5740 GlobalInstantiations.perform();
5766 bool IsMemberSpec =
false;
5768 if (
auto *PartialSpec =
5769 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar)) {
5770 assert(PartialSpecArgs);
5771 IsMemberSpec = PartialSpec->isMemberSpecialization();
5773 PartialSpec, PartialSpecArgs->
asArray(),
false);
5788 auto *VD = cast_or_null<VarTemplateSpecializationDecl>(
5790 VarTemplate, FromVar, TemplateArgsInfo, Converted));
5803 "don't have a definition to instantiate from");
5835 bool InstantiatingVarTemplate,
5839 bool InstantiatingVarTemplatePartialSpec =
5840 isa<VarTemplatePartialSpecializationDecl>(OldVar) &&
5841 isa<VarTemplatePartialSpecializationDecl>(NewVar);
5844 bool InstantiatingSpecFromTemplate =
5845 isa<VarTemplateSpecializationDecl>(NewVar) &&
5847 isa<VarTemplatePartialSpecializationDecl>(OldVar));
5870 if (OldVar->
isUsed(
false))
5892 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
5895 }
else if (PrevDeclForVarTemplateSpecialization) {
5896 Previous.addDecl(PrevDeclForVarTemplateSpecialization);
5900 if (!InstantiatingVarTemplate) {
5918 !InstantiatingSpecFromTemplate)
5925 dyn_cast<VarTemplateSpecializationDecl>(OldVar)) {
5927 !isa<VarTemplatePartialSpecializationDecl>(OldVTSD))
5928 cast<VarTemplateSpecializationDecl>(NewVar)->setSpecializationKind(
5937 if (InstantiatingVarTemplate || InstantiatingVarTemplatePartialSpec) {
5942 }
else if (InstantiatingSpecFromTemplate ||
5965 L->VariableDefinitionInstantiated(Var);
5989 if (!Init.isInvalid()) {
5990 Expr *InitExpr = Init.get();
5992 if (Var->
hasAttr<DLLImportAttr>() &&
5996 }
else if (InitExpr) {
6047 bool DefinitionRequired,
bool AtEndOfTU) {
6059 assert(PatternDecl &&
"no pattern for templated variable");
6064 dyn_cast<VarTemplateSpecializationDecl>(Var);
6075 (PatternDecl = PatternDecl->
getFirstDecl())->hasInit() &&
6083 "instantiating variable initializer");
6101 PreviousContext.
pop();
6105 LocalInstantiations.
perform();
6107 GlobalInstantiations.
perform();
6111 "not a static data member?");
6120 if (!Def && !DefinitionRequired) {
6123 std::make_pair(Var, PointOfInstantiation));
6128 Diag(PointOfInstantiation, diag::warn_var_template_missing)
6132 Diag(PointOfInstantiation, diag::note_inst_declaration_hint) << Var;
6143 PatternDecl, Def, TSK,
6144 DefinitionRequired))
6161 struct PassToConsumerRAII {
6169 ~PassToConsumerRAII() {
6179 } PassToConsumerRAII(*
this,
Consumer, Var);
6186 PointOfInstantiation);
6194 "instantiating variable definition");
6214 }
else if (!VarSpec) {
6243 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
6254 PreviousContext.
pop();
6257 PassToConsumerRAII.Var = Var;
6264 LocalInstantiations.
perform();
6266 GlobalInstantiations.
perform();
6278 for (
const auto *Init : Tmpl->
inits()) {
6281 if (!Init->isWritten())
6286 if (Init->isPackExpansion()) {
6288 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
6292 bool ShouldExpand =
false;
6293 bool RetainExpansion =
false;
6294 std::optional<unsigned> NumExpansions;
6298 TemplateArgs, ShouldExpand,
6305 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
6308 for (
unsigned I = 0; I != *NumExpansions; ++I) {
6322 Init->getSourceLocation(),
6331 BaseTInfo, TempInit.
get(),
6339 NewInits.push_back(NewInit.
get());
6354 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
6357 Init->getSourceLocation(),
6365 if (Init->isBaseInitializer())
6371 }
else if (Init->isMemberInitializer()) {
6373 Init->getMemberLocation(),
6383 Init->getSourceLocation());
6384 }
else if (Init->isIndirectMemberInitializer()) {
6387 Init->getMemberLocation(),
6388 Init->getIndirectMember(), TemplateArgs));
6390 if (!IndirectMember) {
6397 Init->getSourceLocation());
6404 NewInits.push_back(NewInit.
get());
6423 Instance = Instance->getCanonicalDecl();
6424 if (Pattern == Instance)
return true;
6425 Instance = Instance->getInstantiatedFromMemberTemplate();
6436 Instance = Instance->getCanonicalDecl();
6437 if (Pattern == Instance)
return true;
6438 Instance = Instance->getInstantiatedFromMemberTemplate();
6448 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
6450 Instance = cast<ClassTemplatePartialSpecializationDecl>(
6451 Instance->getCanonicalDecl());
6452 if (Pattern == Instance)
6454 Instance = Instance->getInstantiatedFromMember();
6465 Instance = Instance->getCanonicalDecl();
6466 if (Pattern == Instance)
return true;
6467 Instance = Instance->getInstantiatedFromMemberClass();
6478 Instance = Instance->getCanonicalDecl();
6479 if (Pattern == Instance)
return true;
6480 Instance = Instance->getInstantiatedFromMemberFunction();
6491 Instance = Instance->getCanonicalDecl();
6492 if (Pattern == Instance)
return true;
6493 Instance = Instance->getInstantiatedFromMemberEnum();
6511 template<
typename T>
6520 bool OtherIsPackExpansion;
6522 if (
auto *OtherUUD = dyn_cast<T>(
Other)) {
6523 OtherIsPackExpansion = OtherUUD->isPackExpansion();
6525 }
else if (
auto *OtherUPD = dyn_cast<UsingPackDecl>(
Other)) {
6526 OtherIsPackExpansion =
true;
6527 OtherFrom = OtherUPD->getInstantiatedFromUsingDecl();
6528 }
else if (
auto *OtherUD = dyn_cast<UsingDecl>(
Other)) {
6529 OtherIsPackExpansion =
false;
6534 return Pattern->isPackExpansion() == OtherIsPackExpansion &&
6540 assert(Instance->isStaticDataMember());
6545 Instance = Instance->getCanonicalDecl();
6546 if (Pattern == Instance)
return true;
6547 Instance = Instance->getInstantiatedFromStaticDataMember();
6556 if (
auto *UUD = dyn_cast<UnresolvedUsingTypenameDecl>(D))
6559 if (
auto *UUD = dyn_cast<UnresolvedUsingValueDecl>(D))
6565 if (
auto *
Record = dyn_cast<CXXRecordDecl>(
Other))
6571 if (
auto *Enum = dyn_cast<EnumDecl>(
Other))
6574 if (
auto *Var = dyn_cast<VarDecl>(
Other))
6578 if (
auto *Temp = dyn_cast<ClassTemplateDecl>(
Other))
6581 if (
auto *Temp = dyn_cast<FunctionTemplateDecl>(
Other))
6584 if (
auto *PartialSpec =
6585 dyn_cast<ClassTemplatePartialSpecializationDecl>(
Other))
6589 if (
auto *Field = dyn_cast<FieldDecl>(
Other)) {
6590 if (!Field->getDeclName()) {
6593 cast<FieldDecl>(D));
6597 if (
auto *Using = dyn_cast<UsingDecl>(
Other))
6600 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(
Other))
6607 template<
typename ForwardIterator>
6610 ForwardIterator first,
6611 ForwardIterator last) {
6612 for (; first != last; ++first)
6614 return cast<NamedDecl>(*first);
6625 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
6627 return cast_or_null<DeclContext>(
ID);
6642 return cast<Decl>(DC)->getTemplateDepth() >
Level;
6673 bool FindingInstantiatedContext) {
6695 if (isa<ParmVarDecl>(D) && !ParentDependsOnArgs &&
6696 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
6698 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
6699 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
6701 isa<OMPDeclareReductionDecl>(ParentDC) ||
6702 isa<OMPDeclareMapperDecl>(ParentDC))) ||
6703 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda() &&
6704 cast<CXXRecordDecl>(D)->getTemplateDepth() >
6710 if (
Decl *FD = Found->dyn_cast<
Decl *>())
6711 return cast<NamedDecl>(FD);
6714 assert(PackIdx != -1 &&
6715 "found declaration pack but not pack expanding");
6717 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
6724 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
6725 isa<TemplateTemplateParmDecl>(D))
6744 bool NeedInstantiate =
false;
6746 NeedInstantiate = RD->isLocalClass();
6747 else if (isa<TypedefNameDecl>(D) &&
6749 NeedInstantiate =
true;
6751 NeedInstantiate = isa<EnumDecl>(D);
6752 if (NeedInstantiate) {
6755 return cast<TypeDecl>(Inst);
6760 assert(isa<LabelDecl>(D));
6763 assert(Inst &&
"Failed to instantiate label??");
6766 return cast<LabelDecl>(Inst);
6770 if (!
Record->isDependentContext())
6779 dyn_cast<ClassTemplateSpecializationDecl>(
Record))
6791 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
6795 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
6815 auto *Guide = dyn_cast<CXXDeductionGuideDecl>(FD);
6816 if (Guide && Guide->isImplicit()) {
6824 Unpacked = Arg.pack_elements();
6849 if (FindingInstantiatedContext &&
6851 Loc, cast<ClassTemplateSpecializationDecl>(SubstRecord))) {
6852 Diag(
Loc, diag::err_specialization_not_primary_template)
6869 if (!ParentDependsOnArgs)
6883 bool IsBeingInstantiated =
false;
6884 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
6885 if (!Spec->isDependentContext()) {
6888 assert(Tag &&
"type of non-dependent record is not a RecordType");
6890 IsBeingInstantiated =
true;
6927 if (isa<UsingShadowDecl>(D)) {
6934 }
else if (IsBeingInstantiated) {
6940 Diag(
Loc, diag::err_member_not_yet_instantiated)
6948 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
6953 Diag(
Loc, diag::err_enumerator_does_not_exist)
6960 llvm_unreachable(
"Unable to find instantiation of declaration!");
6973 bool DefinitionRequired,
6976 DefinitionRequired,
true);
6987 std::unique_ptr<MangleContext> MangleCtx(
6989 std::deque<PendingImplicitInstantiation> delayedPCHInstantiations;
7004 bool DefinitionRequired =
Function->getTemplateSpecializationKind() ==
7009 [
this, Inst, DefinitionRequired, &MangleCtx](
FunctionDecl *CurFD) {
7011 DefinitionRequired, *MangleCtx);
7015 DefinitionRequired, *MangleCtx);
7017 if (!LocalOnly &&
LangOpts.PCHInstantiateTemplates &&
7019 delayedPCHInstantiations.push_back(Inst);
7024 VarDecl *Var = cast<VarDecl>(Inst.first);
7027 isa<VarTemplateSpecializationDecl>(Var)) &&
7028 "Not a static data member, nor a variable template"
7029 " specialization?");
7041 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
7056 "instantiating variable definition");
7063 DefinitionRequired,
true);
7066 if (!LocalOnly &&
LangOpts.PCHInstantiateTemplates)
7072 for (
auto *DD : Pattern->
ddiags()) {
7073 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...
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenMP constructs and clauses.
static void instantiateSYCLIntelMaxConcurrencyAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelMaxConcurrencyAttr *A, Decl *New)
static void instantiateSYCLIntelMaxWorkGroupSizeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelMaxWorkGroupSizeAttr *A, Decl *New)
static void instantiateDependentAMDGPUWavesPerEUAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AMDGPUWavesPerEUAttr &Attr, Decl *New)
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 instantiateSYCLDeviceHasAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLDeviceHasAttr *Attr, Decl *New)
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 void instantiateSYCLIntelPipeIOAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelPipeIOAttr *Attr, Decl *New)
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 instantiateSYCLIntelBankBitsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelBankBitsAttr *Attr, Decl *New)
static void instantiateSYCLIntelSchedulerTargetFmaxMhzAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelSchedulerTargetFmaxMhzAttr *A, Decl *New)
static Expr * instantiateDependentFunctionAttrCondition(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, Expr *OldCond, const Decl *Tmpl, FunctionDecl *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 instantiateSYCLAddIRAttributesGlobalVariableAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLAddIRAttributesGlobalVariableAttr *A, Decl *New)
static void instantiateSYCLIntelBankWidthAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelBankWidthAttr *Attr, Decl *New)
static void instantiateDependentModeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const ModeAttr &Attr, Decl *New)
static void instantiateSYCLIntelLoopFuseAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelLoopFuseAttr *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 instantiateSYCLIntelESimdVectorizeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelESimdVectorizeAttr *A, Decl *New)
static DeclT * getPreviousDeclForInstantiation(DeclT *D)
Get the previous declaration of a declaration for the purposes of template instantiation.
static void instantiateSYCLWorkGroupSizeHintAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLWorkGroupSizeHintAttr *A, Decl *New)
static void instantiateSYCLIntelPrivateCopiesAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelPrivateCopiesAttr *A, Decl *New)
static void instantiateSYCLIntelMaxGlobalWorkDimAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelMaxGlobalWorkDimAttr *A, Decl *New)
static void instantiateSYCLIntelNumBanksAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelNumBanksAttr *Attr, Decl *New)
static bool isInstantiationOf(ClassTemplateDecl *Pattern, ClassTemplateDecl *Instance)
static void instantiateDependentHLSLParamModifierAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const HLSLParamModifierAttr *Attr, Decl *New)
static void instantiateDependentAllocAlignAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AllocAlignAttr *Align, Decl *New)
static void instantiateSYCLIntelNoGlobalWorkOffsetAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelNoGlobalWorkOffsetAttr *A, Decl *New)
static void instantiateIntelReqdSubGroupSize(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const IntelReqdSubGroupSizeAttr *A, Decl *New)
static void instantiateSYCLAddIRAnnotationsMemberAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLAddIRAnnotationsMemberAttr *A, Decl *New)
static void processFunctionInstantiation(Sema &S, SourceLocation PointOfInstantiation, FunctionDecl *FD, bool DefinitionRequired, MangleContext &MC)
static void instantiateSYCLAddIRAttributesFunctionAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLAddIRAttributesFunctionAttr *A, Decl *New)
static bool isInstantiationOfStaticDataMember(VarDecl *Pattern, VarDecl *Instance)
static void instantiateSYCLIntelMaxWorkGroupsPerMultiprocessorAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelMaxWorkGroupsPerMultiprocessorAttr *A, Decl *New)
static void instantiateOMPDeclareSimdDeclAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareSimdDeclAttr &Attr, Decl *New)
Instantiation of 'declare simd' attribute and its arguments.
static void instantiateSYCLIntelNumSimdWorkItemsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelNumSimdWorkItemsAttr *A, Decl *New)
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 instantiateSYCLAddIRAttributesKernelParameterAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLAddIRAttributesKernelParameterAttr *A, Decl *New)
static void instantiateDependentEnableIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const EnableIfAttr *EIA, const Decl *Tmpl, FunctionDecl *New)
static void instantiateSYCLIntelForcePow2DepthAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelForcePow2DepthAttr *Attr, Decl *New)
static NamedDecl * findInstantiationOf(ASTContext &Ctx, NamedDecl *D, ForwardIterator first, ForwardIterator last)
static void instantiateSYCLIntelMinWorkGroupsPerComputeUnitAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelMinWorkGroupsPerComputeUnitAttr *A, Decl *New)
static void instantiateSYCLIntelInitiationIntervalAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelInitiationIntervalAttr *A, Decl *New)
static void instantiateSYCLIntelMaxReplicatesAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLIntelMaxReplicatesAttr *A, Decl *New)
static void instantiateDependentAnnotationAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AnnotateAttr *Attr, Decl *New)
static void instantiateSYCLReqdWorkGroupSizeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLReqdWorkGroupSizeAttr *A, Decl *New)
static Sema::RetainOwnershipKind attrToRetainOwnershipKind(const Attr *A)
static void instantiateSYCLUsesAspectsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const SYCLUsesAspectsAttr *Attr, 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.
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
virtual bool HandleTopLevelDecl(DeclGroupRef D)
HandleTopLevelDecl - Handle the specified top-level declaration.
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D)
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
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
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
QualType getRecordType(const RecordDecl *Decl) const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
unsigned getStaticLocalNumber(const VarDecl *VD) const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
void setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst, UsingEnumDecl *Pattern)
Remember that the using enum decl Inst is an instantiation of the using enum decl Pattern of a class ...
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
void setManglingNumber(const NamedDecl *ND, unsigned Number)
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
CanQualType UnsignedLongLongTy
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
const TargetInfo & getTargetInfo() const
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
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 * clone(ASTContext &C) const
attr::Kind getKind() 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)
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(), Expr *TrailingRequiresClause=nullptr)
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, Expr *TrailingRequiresClause=nullptr)
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)
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, Expr *TrailingRequiresClause=nullptr)
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
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, Expr *TrailingRequiresClause=nullptr)
bool isCopyAssignmentOperator() const
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitl...
Represents a C++ struct/union/class.
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.
TypeSourceInfo * getLambdaTypeInfo() const
bool isLambda() const
Determine whether this class describes a lambda function object.
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
LambdaCaptureDefault getLambdaCaptureDefault() const
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
CXXRecordDecl * getDefinition() const
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.
Common * getCommonPtr() const
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.
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
void setCommonPtr(Common *C)
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template.
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, QualType CanonInjectedType, 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.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
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.
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
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)
The results of name lookup within a DeclContext.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
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.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isTranslationUnit() const
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.
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...
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
DeclContext * getNonTransparentDeclContext()
Return the non transparent context.
bool isInvalidDecl() const
bool isLocalExternDecl() const
Determine whether this is a block-scope declaration with linkage.
void setAccess(AccessSpecifier AS)
SourceLocation getLocation() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
const char * getDeclKindName() const
@ IDNS_Ordinary
Ordinary names.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
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.
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setNonMemberOperator()
Specifies that this declaration is a C++ overloaded non-member.
void setLexicalDeclContext(DeclContext *DC)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
DeclContext * getDeclContext()
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible.
The name of a declaration.
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
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
unsigned getNumTemplateParameterLists() const
void setTypeSourceInfo(TypeSourceInfo *TI)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
TypeSourceInfo * getTypeSourceInfo() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)
Represents the type decltype(expr) (C++11).
Expr * getUnderlyingExpr() const
A decomposition declaration.
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl * > Bindings)
ArrayRef< BindingDecl * > bindings() const
Provides information about a dependent function-template specialization declaration.
Represents a qualified type name for which the type name is dependent.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
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.
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
EnumDecl * getDefinition() const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
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.
const Expr * getExpr() const
ExplicitSpecKind getKind() const
bool isInvalid() const
Determine if the explicit specifier is invalid.
static ExplicitSpecifier Invalid()
void setKind(ExplicitSpecKind Kind)
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.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
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,...
Declaration context for names declared as extern "C" in C++.
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,...
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, ArrayRef< TemplateParameterList * > FriendTypeTPLists=std::nullopt)
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
void setUnsupportedFriend(bool Unsupported)
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
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.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
ConstexprSpecKind getConstexprKind() const
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
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 ...
void setDefaultedOrDeletedInfo(DefaultedOrDeletedFunctionInfo *Info)
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...
void setInstantiationOfMemberFunction(FunctionDecl *FD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member function FD.
QualType getReturnType() const
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
StringLiteral * getDeletedMessage() const
Get the message that indicates why this function was deleted.
bool isDeletedAsWritten() const
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
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, Expr *TrailingRequiresClause=nullptr)
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
void setVirtualAsWritten(bool V)
State that this function is marked as virtual explicitly.
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
void setImplicitlyInline(bool I=true)
Flag that this function is implicitly inline.
bool isThisDeclarationInstantiatedFromAFriendDefinition() const
Determine whether this specific declaration of the function is a friend declaration that was instanti...
void setRangeEnd(SourceLocation E)
bool isDefaulted() const
Whether this function is defaulted.
void setIneligibleOrNotSelected(bool II)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
ArrayRef< ParmVarDecl * > parameters() const
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template, TemplateArgumentList *TemplateArgs, void *InsertPos, TemplateSpecializationKind TSK=TSK_ImplicitInstantiation, TemplateArgumentListInfo *TemplateArgsAsWritten=nullptr, SourceLocation PointOfInstantiation=SourceLocation())
Specify that this function declaration is actually a function template specialization.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
DeclarationNameInfo getNameInfo() const
FunctionDecl * getDefinition()
Get the definition for this declaration.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
DefaultedOrDeletedFunctionInfo * getDefalutedOrDeletedInfo() const
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
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.
const ParmVarDecl * getParamDecl(unsigned i) const
Represents a prototype with parameter type info, e.g.
ArrayRef< QualType > getParamTypes() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
QualType getParamType(unsigned i) const
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
ExtProtoInfo getExtProtoInfo() const
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
void setParam(unsigned i, ParmVarDecl *VD)
ParmVarDecl * getParam(unsigned i) const
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.
ArrayRef< NamedDecl * > chain() const
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, const IdentifierInfo *Id, QualType T, llvm::MutableArrayRef< NamedDecl * > CH)
unsigned getChainingSize() 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'.
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...
LocalInstantiationScope * cloneScopes(LocalInstantiationScope *Outermost)
Clone this scope, and all outer scopes, down to the given outermost scope.
void InstantiatedLocal(const Decl *D, Decl *Inst)
llvm::PointerUnion< Decl *, DeclArgumentPack * > * findInstantiationOf(const Decl *D)
Find the instantiation of the declaration D within the current instantiation scope.
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 * getSetterId() const
IdentifierInfo * getGetterId() const
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
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.
unsigned getNumLevels() const
Determine the number of levels in this template argument list.
void setKind(TemplateSubstitutionKind K)
unsigned getNumSubstitutedLevels() const
Determine the number of substituted levels in this template argument list.
void addOuterRetainedLevels(unsigned Num)
unsigned getNumRetainedOuterLevels() const
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool hasLinkage() const
Determine whether this declaration has linkage.
void setDeclName(DeclarationName N)
Set the name of this declaration.
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
Represents a C++ namespace alias.
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
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.
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.
bool hasQualifier() const
Evaluates true when this nested-name-specifier location is non-empty.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
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.
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.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded 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 is a basic class for representing single OpenMP clause.
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 * getInitOrig()
Get Orig variable of the initializer.
Expr * getCombinerOut()
Get Out variable of the combiner.
Expr * getCombinerIn()
Get In variable of the combiner.
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Expr * getInitPriv()
Get Priv variable of the initializer.
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name.
OMPDeclareReductionInitKind getInitializerKind() const
Get initializer kind.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
This represents '#pragma omp requires...' directive.
This represents '#pragma omp threadprivate ...' directive.
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
bool anyScoreOrCondition(llvm::function_ref< bool(Expr *&, bool)> Cond)
Represents a field declaration created by an @defs(...).
Wrapper for void* pointer.
static OpaquePtr make(QualType P)
SourceLocation getEllipsisLoc() const
TypeLoc getPatternLoc() const
Represents a pack expansion of types.
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Represents a parameter to a function.
bool hasUninstantiatedDefaultArg() const
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 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...
bool isConstQualified() const
Determine whether this type is const-qualified.
The collection of all-type qualifiers we support.
Represents a struct/union/class.
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Wrapper for source info for record types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
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.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first 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.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
void checkAllowedInitializer(VarDecl *VD)
bool inferObjCARCLifetime(ValueDecl *decl)
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType, SourceLocation StartLoc, DeclarationName VN)
Build the mapper variable of '#pragma omp declare mapper'.
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList, ArrayRef< OMPClause * > Clauses, DeclContext *Owner=nullptr)
Called on well-formed '#pragma omp allocate'.
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare mapper' construct.
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'map' clause.
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 ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation >> ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< Expr * > AdjustArgsNothing, ArrayRef< Expr * > AdjustArgsNeedDevicePtr, ArrayRef< OMPInteropInfo > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
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.
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, Expr *MapperVarRef, ArrayRef< OMPClause * > Clauses, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare mapper'.
static bool isTypeDecoratedWithDeclAttribute(QualType Ty)
void ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc, MangleContext &MC)
void addSyclVarDecl(VarDecl *VD)
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.
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, RetainOwnershipKind K, bool IsTemplateInstantiation)
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList *PartialSpecArgs, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
bool SubstTypeConstraint(TemplateTypeParmDecl *Inst, const TypeConstraint *TC, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraint)
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)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
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.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, std::optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
@ 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)
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, std::optional< unsigned > NumExpansions, bool ExpectParameterPack, bool EvaluateConstraints=true)
void AddSYCLIntelMaxConcurrencyAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddSYCLIntelMaxConcurrencyAttr - Adds a max_concurrency attribute to a particular declaration.
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation.
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
void AddSYCLIntelMaxReplicatesAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
bool TemplateParameterListsAreEqual(const TemplateCompareNewDeclInfo &NewInstFrom, TemplateParameterList *New, const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
void AddSYCLIntelMaxWorkGroupsPerMultiprocessorAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
void deduceOpenCLAddressSpace(ValueDecl *decl)
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...
void AddSYCLUsesAspectsAttr(Decl *D, const AttributeCommonInfo &CI, Expr **Exprs, unsigned Size)
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)
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, BaseUsingDecl *BUD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
void CheckThreadLocalForLargeAlignment(VarDecl *VD)
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
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...
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
void CleanupVarDeclMarking()
void AddSYCLWorkGroupSizeHintAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XDim, Expr *YDim, Expr *ZDim)
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 AddSYCLDeviceHasAttr(Decl *D, const AttributeCommonInfo &CI, Expr **Exprs, unsigned Size)
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.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation, bool IsUsingIfExists)
Builds a using declaration.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
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 AddSYCLIntelBankWidthAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI ABI)
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...
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
void AddSYCLReqdWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XDim, Expr *YDim, Expr *ZDim)
void CheckAlignasUnderalignment(Decl *D)
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
void AddSYCLAddIRAnnotationsMemberAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
void AddSYCLIntelPrivateCopiesAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
const LangOptions & LangOpts
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
const LangOptions & getLangOpts() const
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr, bool PartialOrderingTTP=false)
Check that the given template arguments can be provided to the given template, converting the argumen...
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
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...
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization, bool DeclIsDefn)
Perform semantic checking of a new function declaration.
FieldDecl * CheckFieldDecl(DeclarationName Name, QualType T, TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, InClassInitStyle InitStyle, SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D=nullptr)
Build a new FieldDecl and check its well-formedness.
void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst)
Update instantiation attributes after template was late parsed.
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
void AddSYCLIntelNumBanksAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
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.
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained).
const VarDecl * getCopyElisionCandidate(NamedReturnInfo &Info, QualType ReturnType)
Updates given NamedReturnInfo's move-eligible and copy-elidable statuses, considering the function re...
void AddSYCLIntelSchedulerTargetFmaxMhzAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)
Require that the EnumDecl is completed with its enumerators defined or instantiated.
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
std::optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
ExplicitSpecifier instantiateExplicitSpecifier(const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES)
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
void AddIntelReqdSubGroupSize(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool CheckUsingShadowDecl(BaseUsingDecl *BUD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
SourceManager & getSourceManager() const
void AddSYCLIntelNoGlobalWorkOffsetAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind ActOnExplicitInstantiationNewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
void AddSYCLAddIRAttributesKernelParameterAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
void AddSYCLIntelMaxGlobalWorkDimAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='.
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, const ParsedAttributesView &Attr)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
void AddSYCLIntelForcePow2DepthAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
void keepInLifetimeExtendingContext()
keepInLifetimeExtendingContext - Pull down InLifetimeExtendingContext flag from previous context.
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 AddSYCLIntelBankBitsAttr(Decl *D, const AttributeCommonInfo &CI, Expr **Exprs, unsigned Size)
void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
RedeclarationKind forRedeclarationInCurContext() const
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, NamedDecl *FoundDecl, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
bool SubstTemplateArgument(const TemplateArgumentLoc &Input, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentLoc &Output, SourceLocation Loc={}, const DeclarationName &Entity={})
void AddSYCLAddIRAttributesGlobalVariableAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
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)
ASTContext & getASTContext() const
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
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.
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
@ 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...
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...
void CheckStaticLocalForDllExport(VarDecl *VD)
Check if VD needs to be dllexport/dllimport due to being in a dllexport/import function.
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.
bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo, SourceLocation OpLoc, SourceRange R)
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc, StringLiteral *Message=nullptr)
NamespaceDecl * getStdNamespace() const
void AddSYCLIntelESimdVectorizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
@ TPC_FriendFunctionTemplate
@ TPC_FriendFunctionTemplateDefinition
void DiagnoseUnusedDecl(const NamedDecl *ND)
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
void ActOnUninitializedDecl(Decl *dcl)
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
void AddSYCLAddIRAttributesFunctionAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
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.
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC, SkipBodyInfo *SkipBody=nullptr)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
void AddSYCLIntelNumSimdWorkItemsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
void AddSYCLIntelMinWorkGroupsPerComputeUnitAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
void AddSYCLIntelLoopFuseAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
bool isIncompatibleTypedef(const TypeDecl *Old, TypedefNameDecl *New)
DiagnosticsEngine & getDiagnostics() const
void addSYCLIntelPipeIOAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ID)
addSYCLIntelPipeIOAttr - Adds a pipe I/O attribute to a particular declaration.
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
void AddSYCLIntelInitiationIntervalAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
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
void AddSYCLIntelMaxWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XDim, Expr *YDim, Expr *ZDim)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, Qualifiers ThisTypeQuals, bool EvaluateConstraints=true)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
Encodes a location in the source.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
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...
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?
TypedefNameDecl * getTypedefNameForAnonDecl() const
TagKind getTagKind() const
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
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.
SourceLocation getTemplateNameLoc() const
NestedNameSpecifierLoc getTemplateQualifierLoc() const
const TemplateArgument & getArgument() 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)
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)
Decl * VisitVarTemplateSpecializationDecl(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentListInfo &TemplateArgsInfo, ArrayRef< TemplateArgument > Converted, VarTemplateSpecializationDecl *PrevDecl=nullptr)
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 * 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.
Represents a C++ template name within the type system.
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)
ArrayRef< NamedDecl * > asArray()
SourceLocation getRAngleLoc() const
SourceLocation getLAngleLoc() const
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
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.
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.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
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...
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, bool Typename, TemplateParameterList *Params)
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.
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, std::optional< unsigned > NumExpanded=std::nullopt)
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 isExpandedParameterPack() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
bool isParameterPack() const
Returns whether this is a parameter pack.
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.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
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.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
void setTypeForDecl(const Type *TD)
const Type * getTypeForDecl() const
SourceLocation getBeginLoc() const LLVM_READONLY
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
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...
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.
SourceLocation getNameLoc() const
void setNameLoc(SourceLocation Loc)
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isRValueReferenceType() const
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
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 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.
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
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)
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)
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 hasGlobalStorage() const
Returns true for all variables that do not have local storage.
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.
const Expr * getInit() const
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
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 ...
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...
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack.
Declaration of a variable template.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
void AddPartialSpecialization(VarTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
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.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
void setCompleteDefinition()
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)
Provides information about an attempted template argument deduction, whose success or failure was des...
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool NE(InterpState &S, CodePtr OpPC)
bool Init(InterpState &S, CodePtr OpPC)
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.
void atTemplateEnd(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
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...
StorageClass
Storage classes.
@ Property
The type of a property.
@ 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.
const FunctionProtoType * T
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,...
@ 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
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 ('<').
llvm::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
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
This structure contains most locations needed for by an OMPVarListClause.
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 ...
A stack object to be created when performing template instantiation.
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...