26 #include "llvm/Support/TimeProfiler.h" 28 using namespace clang;
36 return cast<CXXRecordDecl>(DC)->isLocalClass();
41 template<
typename DeclT>
44 if (!OldDecl->getQualifierLoc())
47 assert((NewDecl->getFriendObjectKind() ||
48 !OldDecl->getLexicalDeclContext()->isDependentContext()) &&
49 "non-friend with qualified name defined in dependent context");
52 const_cast<DeclContext *>(NewDecl->getFriendObjectKind()
53 ? NewDecl->getLexicalDeclContext()
54 : OldDecl->getLexicalDeclContext()));
63 NewDecl->setQualifierInfo(NewQualifierLoc);
78 #include "clang/Sema/AttrTemplateInstantiate.inc" 82 const AlignedAttr *Aligned,
Decl *New,
bool IsPackExpansion) {
83 if (Aligned->isAlignmentExpr()) {
92 TemplateArgs, Aligned->getLocation(),
101 const AlignedAttr *Aligned,
Decl *New) {
102 if (!Aligned->isPackExpansion()) {
108 if (Aligned->isAlignmentExpr())
114 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
117 bool Expand =
true, RetainExpansion =
false;
122 Unexpanded, TemplateArgs, Expand,
123 RetainExpansion, NumExpansions))
130 for (
unsigned I = 0; I != *NumExpansions; ++I) {
139 const AssumeAlignedAttr *Aligned,
Decl *New) {
144 Expr *E, *OE =
nullptr;
150 if (Aligned->getOffset()) {
151 Result = S.
SubstExpr(Aligned->getOffset(), TemplateArgs);
162 const AlignValueAttr *Aligned,
Decl *New) {
173 const AllocAlignAttr *Align,
Decl *New) {
176 llvm::APInt(64, Align->getParamIndex().getSourceIndex()),
184 Expr *Cond =
nullptr;
198 Cond = Converted.
get();
204 S.
Diag(A->
getLocation(), diag::err_attr_cond_never_constant_expr) << A;
205 for (
const auto &
P : Diags)
206 S.
Diag(
P.first,
P.second);
216 S, TemplateArgs, EIA, EIA->getCond(), Tmpl, New);
220 Cond, EIA->getMessage()));
227 S, TemplateArgs, DIA, DIA->getCond(), Tmpl, New);
232 DIA->getDiagnosticType(), DIA->getArgDependent(), New));
239 const CUDALaunchBoundsAttr &
Attr,
Decl *New) {
249 Expr *MinBlocks =
nullptr;
250 if (Attr.getMinBlocks()) {
251 Result = S.
SubstExpr(Attr.getMinBlocks(), TemplateArgs);
271 const OMPDeclareSimdDeclAttr &
Attr,
Decl *New) {
273 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
274 New = FTD->getTemplatedDecl();
275 auto *FD = cast<FunctionDecl>(New);
276 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
281 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
282 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
285 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
287 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
291 FD->isCXXInstanceMember());
307 if (
auto *E = Attr.getSimdlen())
310 if (Attr.uniforms_size() > 0) {
311 for(
auto *E : Attr.uniforms()) {
315 Uniforms.push_back(Inst.
get());
319 auto AI = Attr.alignments_begin();
320 for (
auto *E : Attr.aligneds()) {
324 Aligneds.push_back(Inst.
get());
328 Alignments.push_back(Inst.
get());
332 auto SI = Attr.steps_begin();
333 for (
auto *E : Attr.linears()) {
337 Linears.push_back(Inst.
get());
341 Steps.push_back(Inst.
get());
344 LinModifiers.append(Attr.modifiers_begin(), Attr.modifiers_end());
347 Uniforms, Aligneds, Alignments, Linears, LinModifiers, Steps,
354 const OMPDeclareVariantAttr &
Attr,
Decl *New) {
356 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
357 New = FTD->getTemplatedDecl();
358 auto *FD = cast<FunctionDecl>(New);
359 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
361 auto &&SubstExpr = [FD, ThisContext, &S, &TemplateArgs](
Expr *E) {
362 if (
auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
363 if (
auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
366 if (FD->getNumParams() > PVD->getFunctionScopeIndex())
368 PVD, FD->getParamDecl(PVD->getFunctionScopeIndex()));
369 return S.SubstExpr(E, TemplateArgs);
372 FD->isCXXInstanceMember());
373 return S.SubstExpr(E, TemplateArgs);
378 auto &&Subst = [&SubstExpr, &S](
Expr *E) {
384 return S.ActOnFinishFullExpr(Res.
get(),
false);
388 if (
Expr *E = Attr.getVariantFuncRef()) {
393 VariantFuncRef = Subst(E);
398 S.checkOpenMPDeclareVariantFunction(
399 S.ConvertDeclToDeclGroup(New), VariantFuncRef.
get(), Attr.getRange());
403 for (
unsigned I = 0, E = Attr.scores_size(); I < E; ++I) {
405 if (
Expr *E = *std::next(Attr.scores_begin(), I))
409 *std::next(Attr.ctxSelectorSets_begin(), I));
411 *std::next(Attr.ctxSelectors_begin(), I));
413 case OMP_CTX_SET_implementation:
416 Data.emplace_back(CtxSet, Ctx, Score, Attr.implVendors());
420 llvm_unreachable(
"Unexpected context selector kind.");
423 case OMP_CTX_SET_device:
426 Data.emplace_back(CtxSet, Ctx, Score, Attr.deviceKinds());
430 llvm_unreachable(
"Unexpected context selector kind.");
434 llvm_unreachable(
"Unexpected context selector set kind.");
437 S.ActOnOpenMPDeclareVariantDirective(DeclVarData.getValue().first,
438 DeclVarData.getValue().second,
439 Attr.getRange(), Data);
444 const AMDGPUFlatWorkGroupSizeAttr &
Attr,
Decl *New) {
454 Result = S.
SubstExpr(Attr.getMax(), TemplateArgs);
455 if (Result.isInvalid())
457 Expr *MaxExpr = Result.getAs<
Expr>();
469 Expr *Cond =
nullptr;
477 Cond = SubstResult.
get();
487 const AMDGPUWavesPerEUAttr &
Attr,
Decl *New) {
497 Expr *MaxExpr =
nullptr;
498 if (
auto Max = Attr.getMax()) {
512 if (
NamedDecl *ND = dyn_cast<NamedDecl>(New)) {
513 for (
const auto *TmplAttr : Tmpl->
attrs()) {
517 *
this, dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext()),
521 TmplAttr, Context, *
this, TemplateArgs);
531 case clang::attr::CFConsumed:
533 case clang::attr::OSConsumed:
535 case clang::attr::NSConsumed:
538 llvm_unreachable(
"Wrong argument supplied");
546 for (
const auto *TmplAttr : Tmpl->
attrs()) {
548 const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
549 if (Aligned && Aligned->isAlignmentDependent()) {
554 if (
const auto *AssumeAligned = dyn_cast<AssumeAlignedAttr>(TmplAttr)) {
559 if (
const auto *AlignValue = dyn_cast<AlignValueAttr>(TmplAttr)) {
564 if (
const auto *AllocAlign = dyn_cast<AllocAlignAttr>(TmplAttr)) {
570 if (
const auto *EnableIf = dyn_cast<EnableIfAttr>(TmplAttr)) {
572 cast<FunctionDecl>(New));
576 if (
const auto *DiagnoseIf = dyn_cast<DiagnoseIfAttr>(TmplAttr)) {
578 cast<FunctionDecl>(New));
582 if (
const auto *CUDALaunchBounds =
583 dyn_cast<CUDALaunchBoundsAttr>(TmplAttr)) {
585 *CUDALaunchBounds, New);
589 if (
const auto *Mode = dyn_cast<ModeAttr>(TmplAttr)) {
594 if (
const auto *OMPAttr = dyn_cast<OMPDeclareSimdDeclAttr>(TmplAttr)) {
599 if (
const auto *OMPAttr = dyn_cast<OMPDeclareVariantAttr>(TmplAttr)) {
604 if (
const auto *AMDGPUFlatWorkGroupSize =
605 dyn_cast<AMDGPUFlatWorkGroupSizeAttr>(TmplAttr)) {
607 *
this, TemplateArgs, *AMDGPUFlatWorkGroupSize, New);
610 if (
const auto *AMDGPUFlatWorkGroupSize =
611 dyn_cast<AMDGPUWavesPerEUAttr>(TmplAttr)) {
613 *AMDGPUFlatWorkGroupSize, New);
617 if (TmplAttr->getKind() == attr::DLLExport ||
618 TmplAttr->getKind() == attr::DLLImport) {
619 if (New->
hasAttr<DLLExportAttr>() || New->
hasAttr<DLLImportAttr>()) {
624 if (
const auto *ABIAttr = dyn_cast<ParameterABIAttr>(TmplAttr)) {
625 AddParameterABIAttr(New, *ABIAttr, ABIAttr->getABI());
629 if (isa<NSConsumedAttr>(TmplAttr) || isa<OSConsumedAttr>(TmplAttr) ||
630 isa<CFConsumedAttr>(TmplAttr)) {
636 if (
auto *A = dyn_cast<PointerAttr>(TmplAttr)) {
637 if (!New->
hasAttr<PointerAttr>())
638 New->
addAttr(A->clone(Context));
642 if (
auto *A = dyn_cast<OwnerAttr>(TmplAttr)) {
643 if (!New->
hasAttr<OwnerAttr>())
644 New->
addAttr(A->clone(Context));
648 assert(!TmplAttr->isPackExpansion());
649 if (TmplAttr->isLateParsed() && LateAttrs) {
653 if (CurrentInstantiationScope)
654 Saved = CurrentInstantiationScope->
cloneScopes(OuterMostScope);
658 auto *ND = cast<NamedDecl>(New);
659 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(ND->getDeclContext());
661 ND->isCXXInstanceMember());
664 *
this, TemplateArgs);
675 template<
typename DeclT>
677 DeclT *
Result = D->getPreviousDecl();
682 if (Result && isa<CXXRecordDecl>(D->getDeclContext()) &&
683 D->getLexicalDeclContext() != Result->getLexicalDeclContext())
691 llvm_unreachable(
"Translation units cannot be instantiated");
696 llvm_unreachable(
"pragma comment cannot be instantiated");
699 Decl *TemplateDeclInstantiator::VisitPragmaDetectMismatchDecl(
701 llvm_unreachable(
"pragma comment cannot be instantiated");
706 llvm_unreachable(
"extern \"C\" context cannot be instantiated");
710 TemplateDeclInstantiator::VisitLabelDecl(
LabelDecl *D) {
718 TemplateDeclInstantiator::VisitNamespaceDecl(
NamespaceDecl *D) {
719 llvm_unreachable(
"Namespaces cannot be instantiated");
738 bool Invalid =
false;
782 TagDecl *oldTag = oldTagType->getDecl();
801 Typedef->setPreviousDecl(InstPrevTypedef);
842 if (getPreviousDeclForInstantiation<TypedefNameDecl>(Pattern)) {
844 if (!Found.
empty()) {
857 AliasInst->setDescribedAliasTemplate(Inst);
858 if (PrevAliasTemplate)
863 if (!PrevAliasTemplate)
883 NewBindings.push_back(cast<BindingDecl>(VisitBindingDecl(OldBD)));
886 auto *NewDD = cast_or_null<DecompositionDecl>(
889 if (!NewDD || NewDD->isInvalidDecl())
890 for (
auto *NewBD : NewBindings)
891 NewBD->setInvalidDecl();
901 bool InstantiatingVarTemplate,
912 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
945 StartingScope, InstantiatingVarTemplate);
948 QualType ReturnType = cast<FunctionDecl>(DC)->getReturnType();
950 Var->setNRVOVariable(
true);
955 if (Var->isStaticLocal())
969 Decl *TemplateDeclInstantiator::VisitFieldDecl(
FieldDecl *D) {
970 bool Invalid =
false;
986 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
1003 = SemaRef.
SubstExpr(BitWidth, TemplateArgs);
1008 BitWidth = InstantiatedBitWidth.
getAs<
Expr>();
1013 cast<RecordDecl>(Owner),
1022 cast<Decl>(Owner)->setInvalidDecl();
1026 SemaRef.
InstantiateAttrs(TemplateArgs, D, Field, LateAttrs, StartingScope);
1028 if (Field->hasAttrs())
1032 Field->setInvalidDecl();
1034 if (!Field->getDeclName()) {
1039 if (
Parent->isAnonymousStructOrUnion() &&
1040 Parent->getRedeclContext()->isFunctionOrMethod())
1052 bool Invalid =
false;
1056 SemaRef.
Diag(D->
getLocation(), diag::err_property_is_variably_modified)
1060 DI = SemaRef.
SubstType(DI, TemplateArgs,
1072 SemaRef.
Diag(D->
getLocation(), diag::err_field_instantiates_to_function)
1101 for (
auto *PI : D->
chain()) {
1107 NamedChain[i++] = Next;
1110 QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
1120 Owner->
addDecl(IndirectField);
1121 return IndirectField;
1136 InstTy = SemaRef.
SubstType(Ty, TemplateArgs,
1154 assert(ND &&
"friend decl must be a decl or a type!");
1161 if (!NewND)
return nullptr;
1180 = SemaRef.
SubstExpr(AssertExpr, TemplateArgs);
1185 InstantiatedAssertExpr.
get(),
1191 Decl *TemplateDeclInstantiator::VisitEnumDecl(
EnumDecl *D) {
1197 if (!Prev)
return nullptr;
1198 PrevDecl = cast<EnumDecl>(Prev);
1216 Enum->setIntegerTypeSourceInfo(NewTI);
1219 &&
"Dependent type without type source info");
1242 if (Def && Def != D) {
1249 SemaRef.
SubstType(TI->getType(), TemplateArgs,
1252 DefnUnderlying,
true, Enum);
1284 if (
Expr *UninstValue = EC->getInitExpr()) {
1289 Value = SemaRef.
SubstExpr(UninstValue, TemplateArgs);
1315 Enumerators.push_back(EnumConst);
1316 LastEnumConst = EnumConst;
1332 llvm_unreachable(
"EnumConstantDecls can only occur within EnumDecls.");
1337 llvm_unreachable(
"BuiltinTemplateDecls cannot be instantiated.");
1369 if (!Found.
empty()) {
1371 if (PrevClassTemplate)
1384 SS.
Adopt(QualifierLoc);
1386 if (!DC)
return nullptr;
1400 if (R.isSingleResult()) {
1402 if (PrevClassTemplate)
1406 if (!PrevClassTemplate && QualifierLoc) {
1413 bool AdoptedPreviousTemplateParams =
false;
1414 if (PrevClassTemplate) {
1415 bool Complain =
true;
1427 cast<NamespaceDecl>(DC)->
getIdentifier()->isStr(
"__detail")) {
1431 cast<NamespaceDecl>(DCParent)->
getIdentifier()->isStr(
"tr1")) {
1432 if (cast<Decl>(DCParent)->isInStdNamespace())
1447 AdoptedPreviousTemplateParams =
true;
1448 InstParams = PrevParams;
1453 if (!AdoptedPreviousTemplateParams &&
1480 if (PrevClassTemplate)
1490 if (!PrevClassTemplate)
1513 if (!PrevClassTemplate) {
1519 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1520 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1521 OutOfLinePartialSpecs.push_back(std::make_pair(Inst, PartialSpecs[I]));
1528 TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
1541 if (!InstClassTemplate)
1553 "Only static data member templates are allowed.");
1569 PrevVarTemplate = dyn_cast<VarTemplateDecl>(Found.
front());
1575 if (!VarInst)
return nullptr;
1586 if (!PrevVarTemplate)
1596 if (!PrevVarTemplate) {
1602 for (
unsigned I = 0, N = PartialSpecs.size(); I != N; ++I)
1603 if (PartialSpecs[I]->getFirstDecl()->isOutOfLine())
1604 OutOfLineVarPartialSpecs.push_back(
1605 std::make_pair(Inst, PartialSpecs[I]));
1611 Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
1614 "Only static data member templates are allowed.");
1620 assert(!Found.
empty() &&
"Instantiation found nothing?");
1623 assert(InstVarTemplate &&
"Instantiation did not find a variable template?");
1626 InstVarTemplate->findPartialSpecInstantiatedFromMember(D))
1660 = Instantiated->getDescribedFunctionTemplate();
1662 assert(InstTemplate &&
1663 "VisitFunctionDecl/CXXMethodDecl didn't create a template!");
1681 return InstTemplate;
1687 PrevDecl = cast<CXXRecordDecl>(Owner);
1692 if (!Prev)
return nullptr;
1693 PrevDecl = cast<CXXRecordDecl>(Prev);
1719 Record->setObjectOfFriendDecl();
1723 Record->setAnonymousStructOrUnion(
true);
1755 if (!D->isCXXClassMember())
1761 LocalInstantiations.
perform();
1782 if (OrigFunc->
getExtInfo() == NewFunc->getExtInfo())
1788 NewFunc->getParamTypes(), NewEPI);
1802 if (FunctionTemplate && !TemplateParams) {
1805 void *InsertPos =
nullptr;
1815 if (FunctionTemplate)
1820 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
1822 !(isa<Decl>(Owner) &&
1823 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
1827 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
1829 SemaRef, TemplateArgs, DGuide->getExplicitSpecifier(), DGuide);
1830 if (InstantiatedExplicitSpecifier.
isInvalid())
1840 if (TemplateParams && TemplateParams->
size()) {
1843 if (LastParam && LastParam->isImplicit() &&
1844 LastParam->hasTypeConstraint()) {
1867 if (TrailingRequiresClause) {
1874 TrailingRequiresClause = SubstRC.
get();
1886 }
else if (isFriend && QualifierLoc) {
1888 SS.
Adopt(QualifierLoc);
1890 if (!DC)
return nullptr;
1903 if (
auto *DGuide = dyn_cast<CXXDeductionGuideDecl>(D)) {
1906 InstantiatedExplicitSpecifier, NameInfo, T, TInfo,
1908 if (DGuide->isCopyDeductionCandidate())
1916 TrailingRequiresClause);
1938 for (
unsigned P = 0;
P < Params.size(); ++
P)
1940 Params[
P]->setOwningFunction(Function);
1941 Function->setParams(Params);
1943 if (TrailingRequiresClause)
1946 if (TemplateParams) {
1964 TemplateParams, Function);
1973 }
else if (FunctionTemplate) {
1976 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1993 bool IsExplicitSpecialization =
false;
2004 assert(isFriend &&
"non-friend has dependent specialization info?");
2008 Info->getRAngleLoc());
2009 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
2010 ExplicitArgs, TemplateArgs))
2014 for (
unsigned I = 0, E = Info->getNumTemplates(); I != E; ++I) {
2016 Info->getTemplate(I),
2018 if (!Temp)
return nullptr;
2020 Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
2028 IsExplicitSpecialization =
true;
2036 Info->getRAngleLoc());
2037 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
2038 ExplicitArgs, TemplateArgs))
2046 IsExplicitSpecialization =
true;
2047 }
else if (TemplateParams || !FunctionTemplate) {
2062 IsExplicitSpecialization);
2064 NamedDecl *PrincipalDecl = (TemplateParams
2065 ? cast<NamedDecl>(FunctionTemplate)
2073 FT->setObjectOfFriendDecl();
2076 bool QueuedInstantiation =
false;
2087 for (
auto R : Function->
redecls()) {
2093 if (!QueuedInstantiation && R->isUsed(
false)) {
2096 if (MSInfo->getPointOfInstantiation().isInvalid()) {
2098 MSInfo->setPointOfInstantiation(Loc);
2100 std::make_pair(Function, Loc));
2101 QueuedInstantiation =
true;
2145 if (FunctionTemplate && !TemplateParams) {
2151 void *InsertPos =
nullptr;
2161 if (FunctionTemplate)
2166 bool MergeWithParentScope = (TemplateParams !=
nullptr) ||
2167 !(isa<Decl>(Owner) &&
2168 cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
2173 unsigned NumTempParamLists = 0;
2175 TempParamLists.resize(NumTempParamLists);
2176 for (
unsigned I = 0; I != NumTempParamLists; ++I) {
2181 TempParamLists[I] = InstParams;
2188 if (InstantiatedExplicitSpecifier.
isInvalid())
2197 if (TemplateParams && TemplateParams->
size()) {
2200 if (LastParam && LastParam->isImplicit() &&
2201 LastParam->hasTypeConstraint()) {
2224 if (TrailingRequiresClause) {
2227 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
2232 if (SubstRC.isInvalid())
2234 TrailingRequiresClause = SubstRC.get();
2243 SS.
Adopt(QualifierLoc);
2253 if (!DC)
return nullptr;
2269 SemaRef.
Context, Record, StartLoc, NameInfo, T, TInfo,
2270 InstantiatedExplicitSpecifier, Constructor->isInlineSpecified(),
false,
2272 TrailingRequiresClause);
2276 SemaRef.
Context, Record, StartLoc, NameInfo, T, TInfo,
2277 Destructor->isInlineSpecified(),
false, Destructor->getConstexprKind(),
2278 TrailingRequiresClause);
2282 SemaRef.
Context, Record, StartLoc, NameInfo, T, TInfo,
2283 Conversion->isInlineSpecified(), InstantiatedExplicitSpecifier,
2284 Conversion->getConstexprKind(), Conversion->getEndLoc(),
2285 TrailingRequiresClause);
2291 TrailingRequiresClause);
2298 Method->setQualifierInfo(QualifierLoc);
2300 if (TemplateParams) {
2316 Method->getDeclName(),
2317 TemplateParams, Method);
2323 Method->setDescribedFunctionTemplate(FunctionTemplate);
2324 }
else if (FunctionTemplate) {
2327 Method->setFunctionTemplateSpecialization(FunctionTemplate,
2331 }
else if (!isFriend) {
2340 if (NumTempParamLists)
2341 Method->setTemplateParameterListsInfo(
2343 llvm::makeArrayRef(TempParamLists.data(), NumTempParamLists));
2345 Method->setLexicalDeclContext(Owner);
2346 Method->setObjectOfFriendDecl();
2351 for (
unsigned P = 0;
P < Params.size(); ++
P)
2352 Params[
P]->setOwningFunction(Method);
2353 Method->setParams(Params);
2356 Method->setInvalidDecl();
2361 bool IsExplicitSpecialization =
false;
2367 assert(isFriend &&
"non-friend has dependent specialization info?");
2371 Info->getRAngleLoc());
2372 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
2373 ExplicitArgs, TemplateArgs))
2377 for (
unsigned I = 0, E = Info->getNumTemplates(); I != E; ++I) {
2379 Info->getTemplate(I),
2381 if (!Temp)
return nullptr;
2383 Previous.
addDecl(cast<FunctionTemplateDecl>(Temp));
2389 Method->setInvalidDecl();
2391 IsExplicitSpecialization =
true;
2393 ClassScopeSpecializationArgs.getValueOr(
2398 Info->getRAngleLoc());
2399 if (SemaRef.
Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
2400 ExplicitArgs, TemplateArgs))
2406 Method->setInvalidDecl();
2408 IsExplicitSpecialization =
true;
2409 }
else if (ClassScopeSpecializationArgs) {
2414 Method->setInvalidDecl();
2416 IsExplicitSpecialization =
true;
2417 }
else if (!FunctionTemplate || TemplateParams || isFriend) {
2429 IsExplicitSpecialization);
2437 if (isFriend && Method->getPreviousDecl())
2438 Method->setAccess(Method->getPreviousDecl()->getAccess());
2441 if (FunctionTemplate)
2442 FunctionTemplate->
setAccess(Method->getAccess());
2457 if (IsExplicitSpecialization && !isFriend)
2461 if (FunctionTemplate) {
2465 }
else if (Method->isInvalidDecl() && !Previous.
empty()) {
2469 }
else if (isFriend) {
2486 if (Method->hasAttr<UsedAttr>()) {
2487 if (
const auto *A = dyn_cast<CXXRecordDecl>(Owner)) {
2490 A->getMemberSpecializationInfo())
2491 Loc = MSInfo->getPointOfInstantiation();
2492 else if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(A))
2493 Loc = Spec->getPointOfInstantiation();
2518 Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
2527 assert(TC->getTemplateArgsAsWritten() &&
2528 "type parameter can only be an expansion when explicit arguments " 2534 for (
auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())
2540 bool RetainExpansion =
false;
2542 cast<CXXFoldExpr>(TC->getImmediatelyDeclaredConstraint())
2545 TC->hasExplicitTemplateArgs() ?
2546 TC->getTemplateArgsAsWritten()->getRAngleLoc() :
2547 TC->getConceptNameInfo().getEndLoc()),
2548 Unexpanded, TemplateArgs, Expand, RetainExpansion, NumExpanded))
2570 = TC->getTemplateArgsAsWritten();
2578 InstArgs, TemplateArgs))
2582 TC->getNestedNameSpecifierLoc(), TC->getConceptNameInfo(),
2583 TC->getNamedConcept(), &InstArgs, Inst,
2585 ? cast<CXXFoldExpr>(TC->getImmediatelyDeclaredConstraint())
2595 if (InstantiatedDefaultArg)
2606 Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
2612 bool IsExpandedParameterPack =
false;
2615 bool Invalid =
false;
2634 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2635 ExpandedParameterPackTypes.push_back(NewT);
2638 IsExpandedParameterPack =
true;
2653 bool RetainExpansion =
false;
2658 Pattern.getSourceRange(),
2661 Expand, RetainExpansion,
2666 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2679 ExpandedParameterPackTypesAsWritten.push_back(NewDI);
2680 ExpandedParameterPackTypes.push_back(NewT);
2686 IsExpandedParameterPack =
true;
2723 if (IsExpandedParameterPack)
2728 ExpandedParameterPackTypesAsWritten);
2736 if (AutoLoc.isConstrained())
2739 IsExpandedParameterPack
2748 Param->setInvalidDecl();
2755 Param->setDefaultArgument(Value.
get());
2768 for (
const auto &
P : *Params) {
2769 if (
P->isTemplateParameterPack())
2781 TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
2788 bool IsExpandedParameterPack =
false;
2802 ExpandedParams.push_back(Expansion);
2805 IsExpandedParameterPack =
true;
2806 InstParams = TempParams;
2818 bool RetainExpansion =
false;
2824 Expand, RetainExpansion,
2829 for (
unsigned I = 0; I != *NumExpansions; ++I) {
2835 ExpandedParams.push_back(Expansion);
2841 IsExpandedParameterPack =
true;
2842 InstParams = TempParams;
2864 if (IsExpandedParameterPack)
2883 Param->setDefaultArgument(
2919 Decl *TemplateDeclInstantiator::VisitUsingDecl(
UsingDecl *D) {
2940 if (
auto *RD = dyn_cast<CXXRecordDecl>(SemaRef.
CurContext))
2947 bool CheckRedeclaration = Owner->
isRecord();
2959 SS.
Adopt(QualifierLoc);
2960 if (CheckRedeclaration) {
2991 for (
auto *Shadow : D->
shadows()) {
2994 NamedDecl *OldTarget = Shadow->getTargetDecl();
2995 if (
auto *CUSD = dyn_cast<ConstructorUsingShadowDecl>(Shadow))
2996 if (
auto *BaseShadow = CUSD->getNominatedBaseClassShadowDecl())
2997 OldTarget = BaseShadow;
3001 Shadow->getLocation(), OldTarget, TemplateArgs));
3006 if (CheckRedeclaration) {
3012 Shadow->getLocation(), OldPrev, TemplateArgs));
3020 if (isFunctionScope)
3032 Decl *TemplateDeclInstantiator::VisitConstructorUsingShadowDecl(
3038 template <
typename T>
3039 Decl *TemplateDeclInstantiator::instantiateUnresolvedUsingDecl(
3040 T *D,
bool InstantiatingPackElement) {
3042 if (D->isPackExpansion() && !InstantiatingPackElement) {
3050 bool RetainExpansion =
false;
3053 D->getEllipsisLoc(), D->
getSourceRange(), Unexpanded, TemplateArgs,
3054 Expand, RetainExpansion, NumExpansions))
3059 assert(!RetainExpansion &&
3060 "should never need to retain an expansion for UsingPackDecl");
3066 return instantiateUnresolvedUsingDecl(D,
true);
3077 SemaRef.
Diag(D->getEllipsisLoc(),
3078 diag::err_using_decl_redeclaration_expansion);
3084 for (
unsigned I = 0; I != *NumExpansions; ++I) {
3086 Decl *Slice = instantiateUnresolvedUsingDecl(D,
true);
3093 Expansions.push_back(cast<NamedDecl>(Slice));
3112 SS.
Adopt(QualifierLoc);
3119 bool InstantiatingSlice = D->getEllipsisLoc().isValid() &&
3125 nullptr, D->
getAccess(), D->getUsingLoc(),
3126 TD, TypenameLoc, SS, NameInfo, EllipsisLoc,
3135 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingTypenameDecl(
3137 return instantiateUnresolvedUsingDecl(D);
3140 Decl *TemplateDeclInstantiator::VisitUnresolvedUsingValueDecl(
3142 return instantiateUnresolvedUsingDecl(D);
3150 Expansions.push_back(NewUD);
3161 Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
3164 return cast_or_null<CXXMethodDecl>(
3168 Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
3173 assert(isa<DeclRefExpr>(Var) &&
"threadprivate arg is not a DeclRefExpr");
3174 Vars.push_back(Var);
3186 Decl *TemplateDeclInstantiator::VisitOMPAllocateDecl(
OMPAllocateDecl *D) {
3190 assert(isa<DeclRefExpr>(Var) &&
"allocate arg is not a DeclRefExpr");
3191 Vars.push_back(Var);
3196 auto *AC = cast<OMPAllocatorClause>(
C);
3198 if (!NewE.isUsable())
3201 NewE.get(), AC->getBeginLoc(), AC->getLParenLoc(), AC->getEndLoc());
3202 Clauses.push_back(IC);
3207 if (Res.
get().isNull())
3209 return Res.
get().getSingleDecl();
3212 Decl *TemplateDeclInstantiator::VisitOMPRequiresDecl(
OMPRequiresDecl *D) {
3214 "Requires directive cannot be instantiated within a dependent context");
3217 Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
3220 const bool RequiresInstantiation =
3225 if (RequiresInstantiation) {
3231 SubstReductionType = D->
getType();
3233 if (SubstReductionType.
isNull())
3237 bool IsCorrect =
true;
3239 std::pair<QualType, SourceLocation> ReductionTypes[] = {
3240 std::make_pair(SubstReductionType, D->
getLocation())};
3242 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
3243 PrevDeclInScope = cast<OMPDeclareReductionDecl>(
3250 auto *NewDRD = cast<OMPDeclareReductionDecl>(DRD.get().getSingleDecl());
3252 Expr *SubstCombiner =
nullptr;
3253 Expr *SubstInitializer =
nullptr;
3260 cast<DeclRefExpr>(NewDRD->getCombinerIn())->getDecl());
3263 cast<DeclRefExpr>(NewDRD->getCombinerOut())->getDecl());
3264 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
3267 SubstCombiner = SemaRef.
SubstExpr(Combiner, TemplateArgs).
get();
3276 cast<DeclRefExpr>(NewDRD->getInitOrig())->getDecl());
3279 cast<DeclRefExpr>(NewDRD->getInitPriv())->getDecl());
3281 SubstInitializer = SemaRef.
SubstExpr(Init, TemplateArgs).
get();
3284 cast<VarDecl>(cast<DeclRefExpr>(D->
getInitPriv())->getDecl());
3285 IsCorrect = IsCorrect && OldPrivParm->hasInit();
3293 IsCorrect = IsCorrect && SubstCombiner &&
3296 SubstInitializer) ||
3298 !SubstInitializer));
3309 const bool RequiresInstantiation =
3315 if (RequiresInstantiation) {
3323 if (SubstMapperTy.
isNull())
3327 if (PrevDeclInScope && !PrevDeclInScope->isInvalidDecl()) {
3328 PrevDeclInScope = cast<OMPDeclareMapperDecl>(
3337 bool IsCorrect =
true;
3338 if (!RequiresInstantiation) {
3343 Clauses.push_back(
C);
3351 NewDMD,
nullptr, SubstMapperTy, D->
getLocation(), VN);
3355 auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(Owner);
3360 auto *OldC = cast<OMPMapClause>(
C);
3362 for (
Expr *OE : OldC->varlists()) {
3368 NewVars.push_back(NE);
3376 SS.
Adopt(NewQualifierLoc);
3378 OldC->getMapperIdInfo(), TemplateArgs);
3382 OldC->getMapTypeModifiers(), OldC->getMapTypeModifiersLoc(), SS,
3383 NewNameInfo, OldC->getMapType(), OldC->isImplicitMapType(),
3384 OldC->getMapLoc(), OldC->getColonLoc(), NewVars, Locs);
3385 Clauses.push_back(NewC);
3396 Decl *TemplateDeclInstantiator::VisitOMPCapturedExprDecl(
3398 llvm_unreachable(
"Should not be met in templates");
3417 Decl *TemplateDeclInstantiator::VisitRecordDecl(
RecordDecl *D) {
3418 llvm_unreachable(
"There are only CXXRecordDecls in C++");
3422 TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
3429 "can only instantiate an explicit specialization " 3430 "for a member class template");
3437 if (!InstClassTemplate)
3443 castAs<TemplateSpecializationTypeLoc>();
3447 for (
unsigned I = 0; I != Loc.
getNumArgs(); ++I)
3449 if (SemaRef.
Subst(ArgLocs.data(), ArgLocs.size(),
3450 InstTemplateArgs, TemplateArgs))
3466 void *InsertPos =
nullptr;
3468 InstClassTemplate->findSpecialization(Converted, InsertPos);
3498 diag::note_previous_definition);
3506 D->
getLocation(), InstClassTemplate, Converted, PrevDecl);
3511 InstClassTemplate->AddSpecialization(InstD, InsertPos);
3561 assert(VarTemplate &&
3562 "A template specialization without specialized template?");
3567 if (!InstVarTemplate)
3576 TemplateArgsInfo.
size(), VarTemplateArgsInfo, TemplateArgs))
3582 VarTemplateArgsInfo,
false, Converted,
3587 void *InsertPos =
nullptr;
3601 InstVarTemplate, D, InsertPos, VarTemplateArgsInfo, Converted, PrevDecl);
3618 SemaRef.
Diag(D->
getLocation(), diag::err_variable_instantiates_to_function)
3636 StartingScope,
false, PrevDecl);
3642 llvm_unreachable(
"@defs is not supported in Objective-C++");
3649 "cannot instantiate %0 yet");
3656 Decl *TemplateDeclInstantiator::VisitConceptDecl(
ConceptDecl *D) {
3657 llvm_unreachable(
"Concept definitions cannot reside inside a template");
3667 llvm_unreachable(
"Unexpected decl");
3678 SubstD = Instantiator.
Visit(D);
3693 SemaRef.
Context.
BoolTy, FPT->getParamTypes(), FPT->getExtProtoInfo());
3704 assert(OldLoc &&
"type of function is not a function type?");
3706 for (
unsigned I = 0, N = OldLoc.getNumParams(); I != N; ++I)
3707 NewLoc.
setParam(I, OldLoc.getParam(I));
3727 if (
auto *MD = dyn_cast<CXXMethodDecl>(Spaceship)) {
3733 "defaulted spaceship is neither a member nor a friend");
3747 return cast_or_null<FunctionDecl>(R);
3759 bool Invalid =
false;
3761 unsigned N = L->
size();
3765 for (
auto &
P : *L) {
3767 Params.push_back(D);
3777 Expr *InstRequiresClause =
nullptr;
3778 if (
Expr *E = L->getRequiresClause()) {
3785 InstRequiresClause = Res.
get();
3790 L->getLAngleLoc(), Params,
3791 L->getRAngleLoc(), InstRequiresClause);
3837 InstTemplateArgs, TemplateArgs))
3858 void *InsertPos =
nullptr;
3899 SemaRef.
Diag(PartialSpec->
getLocation(), diag::err_partial_spec_redeclared)
3901 SemaRef.
Diag(PrevDecl->
getLocation(), diag::note_prev_partial_spec_here)
3912 ClassTemplate, Converted, InstTemplateArgs, CanonType,
nullptr);
3925 ClassTemplate->AddPartialSpecialization(InstPartialSpec,
3927 return InstPartialSpec;
3965 InstTemplateArgs, TemplateArgs))
3972 InstTemplateArgs,
false, Converted))
3983 void *InsertPos =
nullptr;
4020 diag::err_var_partial_spec_redeclared)
4023 diag::note_var_prev_partial_spec_here);
4036 diag::err_variable_instantiates_to_function)
4060 VarTemplate->AddPartialSpecialization(InstPartialSpec,
nullptr);
4063 LateAttrs, Owner, StartingScope);
4065 return InstPartialSpec;
4072 assert(OldTInfo &&
"substituting function without type source info");
4073 assert(Params.empty() &&
"parameter vector is non-empty at start");
4078 ThisContext = cast<CXXRecordDecl>(Owner);
4079 ThisTypeQuals = Method->getMethodQualifiers();
4086 ThisContext, ThisTypeQuals);
4092 if (NewTInfo != OldTInfo) {
4096 unsigned NewIdx = 0;
4097 for (
unsigned OldIdx = 0, NumOldParams = OldProtoLoc.getNumParams();
4098 OldIdx != NumOldParams; ++OldIdx) {
4099 ParmVarDecl *OldParam = OldProtoLoc.getParam(OldIdx);
4104 NumArgumentsInExpansion =
4107 if (!NumArgumentsInExpansion) {
4111 Params.push_back(NewParam);
4116 for (
unsigned I = 0; I != *NumArgumentsInExpansion; ++I) {
4118 Params.push_back(NewParam);
4128 cast<FunctionProtoType>(OldProtoLoc.getType());
4129 for (
unsigned i = 0, i_end = OldProtoLoc.getNumParams(); i != i_end;
4139 cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
4142 Params.push_back(Parm);
4159 TemplateArgs, ParamTypes, &Params,
4174 unsigned FParamIdx = 0;
4175 for (
unsigned I = 0, N = PatternDecl->
getNumParams(); I != N; ++I) {
4179 assert(FParamIdx < Function->getNumParams());
4206 if (NumArgumentsInExpansion) {
4209 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg) {
4242 UpdateExceptionSpec(Decl,
EST_None);
4248 Diag(PointOfInstantiation, diag::err_exception_spec_cycle) << Decl;
4249 UpdateExceptionSpec(Decl,
EST_None);
4259 getTemplateInstantiationArgs(Decl,
nullptr,
true);
4264 UpdateExceptionSpec(Decl,
EST_None);
4282 if (TemplateAC.empty()) {
4299 if (Inst.isInvalid())
4310 if (
auto *Method = dyn_cast<CXXMethodDecl>(Decl)) {
4311 ThisQuals = Method->getMethodQualifiers();
4316 PointOfInstantiation, Satisfaction);
4342 if (ActiveInst.Kind == ActiveInstType::ExplicitTemplateArgumentSubstitution ||
4343 ActiveInst.Kind == ActiveInstType::DeducedTemplateArgumentSubstitution) {
4345 = dyn_cast<FunctionTemplateDecl>(ActiveInst.Entity)) {
4346 assert(FunTmpl->getTemplatedDecl() == Tmpl &&
4347 "Deduction from the wrong function template?");
4350 ActiveInst.Kind = ActiveInstType::TemplateInstantiation;
4351 ActiveInst.Entity = New;
4357 assert(Proto &&
"Function template without prototype?");
4381 assert(NewProto &&
"Template instantiation without function prototype?");
4399 LateAttrs, StartingScope);
4415 if (isa<CXXDestructorDecl>(New) && SemaRef.
getLangOpts().CPlusPlus11)
4431 Lookups.reserve(DFI->getUnqualifiedLookups().size());
4432 bool AnyChanged =
false;
4435 DA.getDecl(), TemplateArgs);
4438 AnyChanged |= (D != DA.getDecl());
4467 *
this, Loc, FTD, Args->
asArray(),
4468 CodeSynthesisContext::ExplicitTemplateArgumentSubstitution, Info);
4469 if (Inst.isInvalid())
4475 return cast_or_null<FunctionDecl>(SubstDecl(FD, FD->
getParent(), MArgs));
4489 DLLExportAttr *
Attr = Ctor->
getAttr<DLLExportAttr>();
4492 for (
unsigned I = 0; I != NumParams; ++I) {
4519 bool DefinitionRequired,
4522 isa<CXXDeductionGuideDecl>(Function))
4534 assert(PatternDecl &&
"instantiating a non-template");
4537 Stmt *Pattern =
nullptr;
4539 Pattern = PatternDef->
getBody(PatternDef);
4540 PatternDecl = PatternDef;
4542 PatternDef =
nullptr;
4547 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Function,
4549 PatternDecl, PatternDef, TSK,
4550 DefinitionRequired)) {
4551 if (DefinitionRequired)
4558 PendingInstantiations.push_back(
4559 std::make_pair(Function, PointOfInstantiation));
4561 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
4562 !getSourceManager().isInSystemHeader(PatternDecl->
getBeginLoc())) {
4563 Diag(PointOfInstantiation, diag::warn_func_template_missing)
4566 if (getLangOpts().CPlusPlus11)
4567 Diag(PointOfInstantiation, diag::note_inst_declaration_hint)
4577 !LateTemplateParser) {
4579 LateParsedInstantiations.push_back(
4580 std::make_pair(Function, PointOfInstantiation));
4584 llvm::TimeTraceScope TimeScope(
"InstantiateFunction", [&]() {
4586 llvm::raw_string_ostream OS(Name);
4604 LateTemplateParser) {
4607 ExternalSource->ReadLateParsedTemplates(LateParsedTemplateMap);
4609 auto LPTIter = LateParsedTemplateMap.find(PatternDecl);
4610 assert(LPTIter != LateParsedTemplateMap.end() &&
4611 "missing LateParsedTemplate");
4612 LateTemplateParser(OpaqueParser, *LPTIter->second);
4613 Pattern = PatternDecl->
getBody(PatternDecl);
4619 "unexpected kind of function template definition");
4636 D->setImplicitlyInline();
4646 "instantiating function definition");
4662 bool MergeWithParentScope =
false;
4664 MergeWithParentScope = Rec->isLocalClass();
4669 SetDeclDefaulted(Function, PatternDecl->
getLocation());
4672 getTemplateInstantiationArgs(Function,
nullptr,
false, PatternDecl);
4680 ActOnStartOfFunctionDef(
nullptr, Function);
4692 ActOnSkippedFunctionBody(Function);
4697 InstantiateMemInitializers(Ctor, cast<CXXConstructorDecl>(PatternDecl),
4703 Ctor->isDefaultConstructor()) {
4709 Body = SubstStmt(Pattern, TemplateArgs);
4716 ActOnFinishFunctionBody(Function, Body.
get(),
true);
4718 PerformDependentDiagnostics(PatternDecl, TemplateArgs);
4720 if (
auto *Listener = getASTMutationListener())
4721 Listener->FunctionDefinitionInstantiated(Function);
4727 Consumer.HandleTopLevelDecl(DG);
4731 LocalInstantiations.
perform();
4733 GlobalInstantiations.perform();
4763 bool IsMemberSpec =
false;
4765 dyn_cast<VarTemplatePartialSpecializationDecl>(FromVar))
4766 IsMemberSpec = PartialSpec->isMemberSpecialization();
4768 IsMemberSpec = FromTemplate->isMemberSpecialization();
4778 return cast_or_null<VarTemplateSpecializationDecl>(
4779 Instantiator.VisitVarTemplateSpecializationDecl(
4780 VarTemplate, FromVar, InsertPos, TemplateArgsInfo, Converted));
4789 "don't have a definition to instantiate from");
4799 VarSpec->
setType(DI->getType());
4805 InstantiateVariableInitializer(VarSpec, PatternDecl, TemplateArgs);
4818 bool InstantiatingVarTemplate,
4822 bool InstantiatingVarTemplatePartialSpec =
4823 isa<VarTemplatePartialSpecializationDecl>(OldVar) &&
4824 isa<VarTemplatePartialSpecializationDecl>(NewVar);
4827 bool InstantiatingSpecFromTemplate =
4828 isa<VarTemplateSpecializationDecl>(NewVar) &&
4830 isa<VarTemplatePartialSpecializationDecl>(OldVar));
4853 if (OldVar->
isUsed(
false))
4858 InstantiateAttrs(TemplateArgs, OldVar, NewVar, LateAttrs, StartingScope);
4865 : forRedeclarationInCurContext());
4872 if (
NamedDecl *NewPrev = FindInstantiatedDecl(
4875 }
else if (!isa<VarTemplateSpecializationDecl>(NewVar) &&
4878 }
else if (PrevDeclForVarTemplateSpecialization) {
4879 Previous.addDecl(PrevDeclForVarTemplateSpecialization);
4881 CheckVariableDeclaration(NewVar,
Previous);
4883 if (!InstantiatingVarTemplate) {
4891 CurrentInstantiationScope->InstantiatedLocal(OldVar, NewVar);
4901 !InstantiatingSpecFromTemplate)
4908 dyn_cast<VarTemplateSpecializationDecl>(OldVar)) {
4910 !isa<VarTemplatePartialSpecializationDecl>(OldVTSD))
4911 cast<VarTemplateSpecializationDecl>(NewVar)->setSpecializationKind(
4920 if (InstantiatingVarTemplate || InstantiatingVarTemplatePartialSpec) {
4924 InstantiateVariableInitializer(NewVar, OldVar, TemplateArgs);
4925 }
else if (InstantiatingSpecFromTemplate ||
4932 InstantiateVariableInitializer(NewVar, OldVar, TemplateArgs);
4940 DiagnoseUnusedDecl(NewVar);
4948 L->VariableDefinitionInstantiated(Var);
4967 Init = SubstInitializer(OldVar->
getInit(), TemplateArgs,
4974 if (Var->
hasAttr<DLLImportAttr>() &&
4978 }
else if (InitExpr) {
4980 AddInitializerToDecl(Var, InitExpr, DirectInit);
4982 ActOnUninitializedDecl(Var);
5005 ActOnUninitializedDecl(Var);
5008 if (getLangOpts().
CUDA)
5009 checkAllowedCUDAInitializer(Var);
5029 bool DefinitionRequired,
bool AtEndOfTU) {
5041 assert(PatternDecl &&
"no pattern for templated variable");
5043 getTemplateInstantiationArgs(Var);
5050 bool InstantiationDependent =
false;
5053 "Only instantiate variable template specializations that are " 5054 "not type-dependent");
5055 (void)InstantiationDependent;
5066 (PatternDecl = PatternDecl->
getFirstDecl())->hasInit() &&
5074 "instantiating variable initializer");
5091 InstantiateVariableInitializer(Var, PatternDecl, TemplateArgs);
5092 PreviousContext.pop();
5096 LocalInstantiations.
perform();
5098 GlobalInstantiations.
perform();
5102 "not a static data member?");
5111 if (!Def && !DefinitionRequired) {
5113 PendingInstantiations.push_back(
5114 std::make_pair(Var, PointOfInstantiation));
5117 if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
5118 !getSourceManager().isInSystemHeader(PatternDecl->
getBeginLoc())) {
5119 Diag(PointOfInstantiation, diag::warn_var_template_missing)
5122 if (getLangOpts().CPlusPlus11)
5123 Diag(PointOfInstantiation, diag::note_inst_declaration_hint) << Var;
5132 if (DiagnoseUninstantiableTemplate(PointOfInstantiation, Var,
5134 PatternDecl, Def, TSK,
5135 DefinitionRequired))
5152 struct PassToConsumerRAII {
5157 : Consumer(Consumer), Var(Var) { }
5159 ~PassToConsumerRAII() {
5162 } PassToConsumerRAII(Consumer, Var);
5169 PointOfInstantiation);
5177 "instantiating variable definition");
5193 if (Def->isStaticDataMember() && !Def->isOutOfLine()) {
5196 InstantiateVariableInitializer(Var, Def, TemplateArgs);
5197 }
else if (!VarSpec) {
5198 Var = cast_or_null<VarDecl>(SubstDecl(Def, Var->
getDeclContext(),
5207 Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
5216 cast<VarTemplateSpecializationDecl>(Var)->setInstantiationOf(
5220 LookupResult R(*
this, Var->getDeclName(), Var->getLocation(),
5221 LookupOrdinaryName, forRedeclarationInCurContext());
5223 MergeVarDecl(Var, R);
5226 InstantiateVariableInitializer(Var, Def, TemplateArgs);
5231 Var = CompleteVarTemplateSpecializationDecl(VarSpec, Def, TemplateArgs);
5233 PreviousContext.pop();
5236 PassToConsumerRAII.Var = Var;
5243 LocalInstantiations.
perform();
5245 GlobalInstantiations.
perform();
5257 for (
const auto *Init : Tmpl->
inits()) {
5260 if (!Init->isWritten())
5265 if (Init->isPackExpansion()) {
5267 TypeLoc BaseTL = Init->getTypeSourceInfo()->getTypeLoc();
5271 bool ShouldExpand =
false;
5272 bool RetainExpansion =
false;
5274 if (CheckParameterPacksForExpansion(Init->getEllipsisLoc(),
5277 TemplateArgs, ShouldExpand,
5284 assert(ShouldExpand &&
"Partial instantiation of base initializer?");
5287 for (
unsigned I = 0; I != *NumExpansions; ++I) {
5291 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
5301 Init->getSourceLocation(),
5310 BaseTInfo, TempInit.
get(),
5318 NewInits.push_back(NewInit.
get());
5325 ExprResult TempInit = SubstInitializer(Init->getInit(), TemplateArgs,
5333 if (Init->isDelegatingInitializer() || Init->isBaseInitializer()) {
5336 Init->getSourceLocation(),
5344 if (Init->isBaseInitializer())
5345 NewInit = BuildBaseInitializer(TInfo->
getType(), TInfo, TempInit.
get(),
5348 NewInit = BuildDelegatingInitializer(TInfo, TempInit.
get(),
5349 cast<CXXRecordDecl>(CurContext->getParent()));
5350 }
else if (Init->isMemberInitializer()) {
5351 FieldDecl *Member = cast_or_null<FieldDecl>(FindInstantiatedDecl(
5352 Init->getMemberLocation(),
5361 NewInit = BuildMemberInitializer(Member, TempInit.
get(),
5362 Init->getSourceLocation());
5363 }
else if (Init->isIndirectMemberInitializer()) {
5365 cast_or_null<IndirectFieldDecl>(FindInstantiatedDecl(
5366 Init->getMemberLocation(),
5367 Init->getIndirectMember(), TemplateArgs));
5369 if (!IndirectMember) {
5375 NewInit = BuildMemberInitializer(IndirectMember, TempInit.
get(),
5376 Init->getSourceLocation());
5383 NewInits.push_back(NewInit.
get());
5388 ActOnMemInitializers(New,
5403 if (Pattern == Instance)
return true;
5416 if (Pattern == Instance)
return true;
5427 = cast<ClassTemplatePartialSpecializationDecl>(Pattern->
getCanonicalDecl());
5429 Instance = cast<ClassTemplatePartialSpecializationDecl>(
5431 if (Pattern == Instance)
5445 if (Pattern == Instance)
return true;
5458 if (Pattern == Instance)
return true;
5471 if (Pattern == Instance)
return true;
5490 template<
typename T>
5499 bool OtherIsPackExpansion;
5501 if (
auto *OtherUUD = dyn_cast<T>(Other)) {
5502 OtherIsPackExpansion = OtherUUD->isPackExpansion();
5504 }
else if (
auto *OtherUPD = dyn_cast<UsingPackDecl>(Other)) {
5505 OtherIsPackExpansion =
true;
5506 OtherFrom = OtherUPD->getInstantiatedFromUsingDecl();
5507 }
else if (
auto *OtherUD = dyn_cast<UsingDecl>(Other)) {
5508 OtherIsPackExpansion =
false;
5513 return Pattern->isPackExpansion() == OtherIsPackExpansion &&
5525 if (Pattern == Instance)
return true;
5535 if (
auto *UUD = dyn_cast<UnresolvedUsingTypenameDecl>(D))
5538 if (
auto *UUD = dyn_cast<UnresolvedUsingValueDecl>(D))
5544 if (
auto *Record = dyn_cast<CXXRecordDecl>(Other))
5547 if (
auto *Function = dyn_cast<FunctionDecl>(Other))
5550 if (
auto *Enum = dyn_cast<EnumDecl>(Other))
5553 if (
auto *Var = dyn_cast<VarDecl>(Other))
5554 if (Var->isStaticDataMember())
5557 if (
auto *Temp = dyn_cast<ClassTemplateDecl>(Other))
5560 if (
auto *Temp = dyn_cast<FunctionTemplateDecl>(Other))
5563 if (
auto *PartialSpec =
5564 dyn_cast<ClassTemplatePartialSpecializationDecl>(Other))
5568 if (
auto *Field = dyn_cast<FieldDecl>(Other)) {
5569 if (!Field->getDeclName()) {
5572 cast<FieldDecl>(D));
5576 if (
auto *Using = dyn_cast<UsingDecl>(Other))
5579 if (
auto *Shadow = dyn_cast<UsingShadowDecl>(Other))
5583 D->
getDeclName() == cast<NamedDecl>(Other)->getDeclName();
5586 template<
typename ForwardIterator>
5589 ForwardIterator first,
5590 ForwardIterator last) {
5591 for (; first != last; ++first)
5593 return cast<NamedDecl>(*first);
5604 if (
NamedDecl *D = dyn_cast<NamedDecl>(DC)) {
5605 Decl*
ID = FindInstantiatedDecl(Loc, D, TemplateArgs,
true);
5606 return cast_or_null<DeclContext>(
ID);
5638 bool FindingInstantiatedContext) {
5657 !cast<ParmVarDecl>(D)->getType()->isInstantiationDependentType())
5659 if (isa<ParmVarDecl>(D) || isa<NonTypeTemplateParmDecl>(D) ||
5660 isa<TemplateTypeParmDecl>(D) || isa<TemplateTemplateParmDecl>(D) ||
5662 isa<OMPDeclareReductionDecl>(ParentDC) ||
5663 isa<OMPDeclareMapperDecl>(ParentDC)) &&
5665 (isa<CXXRecordDecl>(D) && cast<CXXRecordDecl>(D)->isLambda())) {
5668 if (CurrentInstantiationScope) {
5669 if (
auto Found = CurrentInstantiationScope->findInstantiationOf(D)) {
5670 if (Decl *FD = Found->dyn_cast<Decl *>())
5671 return cast<NamedDecl>(FD);
5673 int PackIdx = ArgumentPackSubstitutionIndex;
5674 assert(PackIdx != -1 &&
5675 "found declaration pack but not pack expanding");
5677 return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
5684 if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
5685 isa<TemplateTemplateParmDecl>(D))
5704 bool NeedInstantiate =
false;
5706 NeedInstantiate = RD->isLocalClass();
5708 NeedInstantiate = isa<EnumDecl>(D);
5709 if (NeedInstantiate) {
5710 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
5711 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
5712 return cast<TypeDecl>(Inst);
5717 assert(isa<LabelDecl>(D));
5719 Decl *Inst = SubstDecl(D, CurContext, TemplateArgs);
5720 assert(Inst &&
"Failed to instantiate label??");
5722 CurrentInstantiationScope->InstantiatedLocal(D, Inst);
5723 return cast<LabelDecl>(Inst);
5727 if (!Record->isDependentContext())
5736 = dyn_cast<ClassTemplatePartialSpecializationDecl>(Record))
5748 if (
CXXRecordDecl *InstRecord = dyn_cast<CXXRecordDecl>(DC)) {
5752 = dyn_cast<ClassTemplateSpecializationDecl>(InstRecord)){
5765 if (FD->getFriendObjectKind() && FD->getDeclContext()->isFileContext()){
5766 DC = FD->getLexicalDeclContext();
5772 if (Guide && Guide->isImplicit()) {
5780 Unpacked = Arg.pack_elements();
5783 getTrivialTemplateArgumentLoc(UnpackedArg,
QualType(), Loc));
5789 assert(SubstRecord &&
"class template id not a class type?");
5795 if (FindingInstantiatedContext &&
5796 usesPartialOrExplicitSpecialization(
5797 Loc, cast<ClassTemplateSpecializationDecl>(SubstRecord))) {
5798 Diag(Loc, diag::err_specialization_not_primary_template)
5799 << T << (SubstRecord->getTemplateSpecializationKind() ==
5818 ParentDC = FindInstantiatedContext(Loc, ParentDC, TemplateArgs);
5829 bool IsBeingInstantiated =
false;
5830 if (
CXXRecordDecl *Spec = dyn_cast<CXXRecordDecl>(ParentDC)) {
5831 if (!Spec->isDependentContext()) {
5834 assert(Tag &&
"type of non-dependent record is not a RecordType");
5836 IsBeingInstantiated =
true;
5838 RequireCompleteType(Loc, T, diag::err_incomplete_type))
5851 SubstDeclarationNameInfo(NameInfo, TemplateArgs);
5852 Name = NewNameInfo.getName();
5857 if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(D)) {
5863 Result = getVarTemplateSpecialization(
5864 Templ, &VTSD->getTemplateArgsInfo(), NewNameInfo,
SourceLocation());
5882 if (isa<UsingShadowDecl>(D)) {
5884 }
else if (Diags.hasErrorOccurred()) {
5888 }
else if (IsBeingInstantiated) {
5894 Diag(Loc, diag::err_member_not_yet_instantiated)
5902 EnumDecl *Enum = cast<EnumDecl>(ED->getLexicalDeclContext());
5903 EnumDecl *Spec = cast<EnumDecl>(FindInstantiatedDecl(Loc, Enum,
5905 assert(Spec->getTemplateSpecializationKind() ==
5907 Diag(Loc, diag::err_enumerator_does_not_exist)
5910 Diag(Spec->getLocation(), diag::note_enum_specialized_here)
5914 llvm_unreachable(
"Unable to find instantiation of declaration!");
5927 while (!PendingLocalImplicitInstantiations.empty() ||
5928 (!LocalOnly && !PendingInstantiations.empty())) {
5931 if (PendingLocalImplicitInstantiations.empty()) {
5932 Inst = PendingInstantiations.front();
5933 PendingInstantiations.pop_front();
5935 Inst = PendingLocalImplicitInstantiations.front();
5936 PendingLocalImplicitInstantiations.pop_front();
5940 if (
FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
5941 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
5943 if (Function->isMultiVersion()) {
5944 getASTContext().forEachMultiversionedFunctionVersion(
5945 Function, [
this, Inst, DefinitionRequired](
FunctionDecl *CurFD) {
5946 InstantiateFunctionDefinition( Inst.second, CurFD,
true,
5947 DefinitionRequired,
true);
5952 InstantiateFunctionDefinition( Inst.second, Function,
true,
5953 DefinitionRequired,
true);
5954 if (Function->isDefined())
5955 Function->setInstantiationIsPending(
false);
5961 VarDecl *Var = cast<VarDecl>(Inst.first);
5964 isa<VarTemplateSpecializationDecl>(Var)) &&
5965 "Not a static data member, nor a variable template" 5966 " specialization?");
5978 llvm_unreachable(
"Cannot instantitiate an undeclared specialization.");
5993 "instantiating variable definition");
5999 InstantiateVariableDefinition( Inst.second, Var,
true,
6000 DefinitionRequired,
true);
6006 for (
auto DD : Pattern->
ddiags()) {
6007 switch (DD->getKind()) {
6009 HandleDependentAccessCheck(*DD, TemplateArgs);
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
clauselist_range clauselists()
The lookup results will be used for redeclaration of a name with external linkage; non-visible lookup...
Defines the clang::ASTContext interface.
FunctionDecl * getDefinition()
Get the definition for this declaration.
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 ...
static void collectUnexpandedParameterPacks(Sema &S, TemplateParameterList *Params, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
bool mightBeUsableInConstantExpressions(ASTContext &C) const
Determine whether this variable's value might be usable in a constant expression, according to the re...
void setImplicit(bool I=true)
Represents a function declaration or definition.
static bool CheckConstraintSatisfaction(Sema &S, const NamedDecl *Template, ArrayRef< const Expr *> ConstraintExprs, ArrayRef< TemplateArgument > TemplateArgs, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
NamespaceDecl * getStdNamespace() const
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name...
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
no exception specification
OMPDeclareMapperDecl * ActOnOpenMPDeclareMapperDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare mapper'.
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D)
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
A (possibly-)qualified type.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
const char * getDeclKindName() const
void InstantiatedLocal(const Decl *D, Decl *Inst)
void setDefaultArgument(TypeSourceInfo *DefArg)
Set the default argument for this template parameter.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
Decl * VisitVarDecl(VarDecl *D, bool InstantiatingVarTemplate, ArrayRef< BindingDecl *> *Bindings=nullptr)
bool isOverloadedOperator() const
Whether this function declaration represents an C++ overloaded operator, e.g., "operator+".
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
A stack-allocated class that identifies which local variable declaration instantiations are present i...
const TypeClass * getTypePtr() const
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained)...
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
SourceRange getBraceRange() const
bool willHaveBody() const
True if this function will eventually have a body, once it's fully parsed.
static void instantiateDependentAllocAlignAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AllocAlignAttr *Align, Decl *New)
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
NestedNameSpecifierLoc getTemplateQualifierLoc() const
void addOuterTemplateArguments(const TemplateArgumentList *TemplateArgs)
Add a new outermost level to the multi-level template argument list.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Expr * getUnderlyingExpr() const
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, llvm::MutableArrayRef< NamedDecl *> CH)
Stmt - This represents one statement.
Expr * getBitWidth() const
We are matching the template parameter lists of two templates that might be redeclarations.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
This represents '#pragma omp allocate ...' directive.
const ASTTemplateArgumentListInfo * getTemplateSpecializationArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
Provides information about an attempted template argument deduction, whose success or failure was des...
static bool isDeclWithinFunction(const Decl *D)
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
An instance of this object exists for each enum constant that is defined.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
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...
Represents a qualified type name for which the type name is dependent.
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList &TemplateArgList, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, void *InsertPos, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
bool isSingleTagDecl() const
Asks if the result is a single tag decl.
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation)
Builds a using declaration.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, Optional< unsigned > NumExpanded=None)
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
const Type * getTypeForDecl() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
SourceLocation getBeginLoc() const LLVM_READONLY
static Expr * instantiateDependentFunctionAttrCondition(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, Expr *OldCond, const Decl *Tmpl, FunctionDecl *New)
IdentifierInfo * getGetterId() const
ArrayRef< NamedDecl * > asArray()
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
ThreadStorageClassSpecifier getTSCSpec() const
void adjustForRewrite(RewriteKind RK, FunctionDecl *Orig, QualType &T, TypeSourceInfo *&TInfo, DeclarationNameInfo &NameInfo)
llvm::PointerUnion< Decl *, DeclArgumentPack * > * findInstantiationOf(const Decl *D)
Find the instantiation of the declaration D within the current instantiation scope.
Defines the C++ template declaration subclasses.
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Decl * VisitVarTemplateSpecializationDecl(VarTemplateDecl *VarTemplate, VarDecl *FromVar, void *InsertPos, const TemplateArgumentListInfo &TemplateArgsInfo, ArrayRef< TemplateArgument > Converted, VarTemplateSpecializationDecl *PrevDecl=nullptr)
Decl * InstantiateTypedefNameDecl(TypedefNameDecl *D, bool IsTypeAlias)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
ExplicitSpecKind getKind() const
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
Declaration of a variable template.
void ActOnOpenMPDeclareMapperDirectiveVarDecl(OMPDeclareMapperDecl *DMD, Scope *S, QualType MapperType, SourceLocation StartLoc, DeclarationName VN)
Build the mapper variable of '#pragma omp declare mapper'.
Represent a C++ namespace.
SourceLocation getEndLoc() const LLVM_READONLY
const TargetInfo & getTargetInfo() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
A container of type source information.
Store information needed for an explicit specifier.
Wrapper for void* pointer.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
clauselist_iterator clauselist_begin()
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=CSK_unspecified, Expr *TrailingRequiresClause=nullptr)
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
static RequiresExprBodyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc)
bool isDefined(const FunctionDecl *&Definition) const
Returns true if the function has a definition that does not need to be instantiated.
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
Appends a human-readable name for this declaration into the given stream.
void setInitStyle(InitializationStyle Style)
VarTemplatePartialSpecializationDecl * InstantiateVarTemplatePartialSpecialization(VarTemplateDecl *VarTemplate, VarTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a variable template partial specialization.
Represents a C++ constructor within a class.
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void setTrailingRequiresClause(Expr *TrailingRequiresClause)
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
Instantiate or parse a C++ default argument expression as necessary.
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, C99 6.9p3)
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
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.
static void instantiateDependentEnableIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const EnableIfAttr *EIA, const Decl *Tmpl, FunctionDecl *New)
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl *> Expansions)
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
void setRAngleLoc(SourceLocation Loc)
unsigned getDepth() const
Get the nesting depth of the template parameter.
enumerator_range enumerators() const
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='...
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
RAII object that enters a new expression evaluation context.
Represents a variable declaration or definition.
QualType getReturnType() const
bool SubstQualifier(const DeclaratorDecl *OldDecl, DeclaratorDecl *NewDecl)
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
static void instantiateDependentAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignedAttr *Aligned, Decl *New, bool IsPackExpansion)
const T * getAs() const
Member-template getAs<specific type>'.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
Extra information about a function prototype.
Declaration context for names declared as extern "C" in C++.
static MSPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, IdentifierInfo *Getter, IdentifierInfo *Setter)
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
SourceLocation getLAngleLoc() const
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static void instantiateDependentCUDALaunchBoundsAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const CUDALaunchBoundsAttr &Attr, Decl *New)
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
static void instantiateDependentAssumeAlignedAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AssumeAlignedAttr *Aligned, Decl *New)
Look up an ordinary name that is going to be redeclared as a name with linkage.
Represents a parameter to a function.
static AccessSpecDecl * Create(ASTContext &C, AccessSpecifier AS, DeclContext *DC, SourceLocation ASLoc, SourceLocation ColonLoc)
Defines the clang::Expr interface and subclasses for C++ expressions.
Provides information about a dependent function-template specialization declaration.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
The collection of all-type qualifiers we support.
const FunctionDecl * isLocalClass() const
If the class is a local class [class.local], returns the enclosing function declaration.
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'.
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr *> Uniforms, ArrayRef< Expr *> Aligneds, ArrayRef< Expr *> Alignments, ArrayRef< Expr *> Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr *> Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isLexicallyWithinFunctionOrMethod() const
Returns true if this declaration lexically is inside a function.
Base wrapper for a particular "section" of type source info.
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
Represents a struct/union/class.
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 CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
static void instantiateOMPDeclareVariantAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareVariantAttr &Attr, Decl *New)
Instantiation of 'declare variant' attribute and its arguments.
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
Description of a constructor that was inherited from a base class.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
unsigned getDepth() const
Retrieve the depth of the template parameter.
StringLiteral * getMessage()
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirectiveEnd(OMPDeclareMapperDecl *D, Scope *S, ArrayRef< OMPClause *> ClauseList)
Called at the end of '#pragma omp declare mapper'.
void setManglingNumber(const NamedDecl *ND, unsigned Number)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
ArrayRef< QualType > getParamTypes() const
The results of name lookup within a DeclContext.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
ConstexprSpecKind getConstexprKind() const
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
void setObjCForDecl(bool FRD)
bool isExpandedParameterPack() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
NameKind getNameKind() const
Determine what kind of name this is.
static DecompositionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation LSquareLoc, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< BindingDecl *> Bindings)
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Represents a member of a struct/union/class.
The current expression is potentially evaluated at run time, which means that code may be generated t...
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
unsigned getStaticLocalNumber(const VarDecl *VD) const
OpenMPContextSelectorKind
OpenMP context selectors.
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
void startDefinition()
Starts the definition of this tag declaration.
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
bool isReferenceType() const
InitKind getInitializerKind() const
Get initializer kind.
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
bool isInIdentifierNamespace(unsigned NS) const
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
ParmVarDecl * getParam(unsigned i) const
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare mapper' construct.
void Exit()
Exit this local instantiation scope early.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
Represents an access specifier followed by colon ':'.
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
SourceLocation getBeginLoc() const LLVM_READONLY
Declaration of a function specialization at template class scope.
SourceLocation getTemplateLoc() const
static void instantiateDependentAMDGPUWavesPerEUAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AMDGPUWavesPerEUAttr &Attr, Decl *New)
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
ArrayRef< ParmVarDecl * > parameters() const
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
SourceLocation getLAngleLoc() const
Expr * getMapperVarRef()
Get the variable declared in the mapper.
Represents a C++ using-declaration.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
ArrayRef< BindingDecl * > bindings() const
static void instantiateDependentDiagnoseIfAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const DiagnoseIfAttr *DIA, const Decl *Tmpl, FunctionDecl *New)
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation)
Represents the results of name lookup.
OpenMPContextSelectorSetKind
OpenMP context selector sets.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
TagKind getTagKind() const
bool isReferenced() const
Whether any declaration of this entity was referenced.
A convenient class for passing around template argument information.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
void setDefaultedFunctionInfo(DefaultedFunctionInfo *Info)
Look up all declarations in a scope with the given name, including resolved using declarations...
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
bool SubstDefaultedFunction(FunctionDecl *New, FunctionDecl *Tmpl)
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
ArrayRef< NamedDecl * > chain() const
bool InitFunctionInstantiation(FunctionDecl *New, FunctionDecl *Tmpl)
Initializes the common fields of an instantiation function declaration (New) from the corresponding f...
SourceLocation getBeginLoc() const LLVM_READONLY
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
const TemplateArgumentLoc * getArgumentArray() const
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void setSpecializationKind(TemplateSpecializationKind TSK)
Scope - A scope is a transient data structure that is used while parsing the program.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
Represents a C++ nested-name-specifier or a global scope specifier.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
const LangOptions & getLangOpts() const
static NamespaceAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Namespace)
TemplateArgumentLoc getArgLoc(unsigned i) 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'.
void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
SourceLocation getTypeSpecStartLoc() const
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
void CheckStaticLocalForDllExport(VarDecl *VD)
Check if VD needs to be dllexport/dllimport due to being in a dllexport/import function.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
unsigned getNumArgs() const
A binding in a decomposition declaration.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
RAII object used to change the argument pack substitution index within a Sema object.
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
A helper class for building up ExtParameterInfos.
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
SourceLocation getRParenLoc() const
DefaultedFunctionInfo * getDefaultedFunctionInfo() const
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
DiagnosticsEngine & getDiagnostics() const
static CXXConstructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, ExplicitSpecifier ES, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited=InheritedConstructor(), Expr *TrailingRequiresClause=nullptr)
void MakeInstantiatedLocalArgPack(const Decl *D)
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, Qualifiers ThisTypeQuals)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
Sema - This implements semantic analysis and AST building for C.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
Represents a prototype with parameter type info, e.g.
void setImplicitlyInline(bool I=true)
Flag that this function is implicitly inline.
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
bool inferObjCARCLifetime(ValueDecl *decl)
Represents a ValueDecl that came out of a declarator.
DeclarationNameTable DeclarationNames
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind NewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
static QualType adjustFunctionTypeForInstantiation(ASTContext &Context, FunctionDecl *D, TypeSourceInfo *TInfo)
Adjust the given function type for an instantiation of the given declaration, to cope with modificati...
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
unsigned getNumSubstitutedLevels() const
Determine the number of substituted levels in this template argument list.
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
bool isInlineSpecified() const
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
TypeSourceInfo * getTypeSourceInfo() const
This represents '#pragma omp requires...' directive.
const ArgList & getInnermost() const
Retrieve the innermost template argument list.
void runWithSufficientStackSpace(llvm::function_ref< void()> Diag, llvm::function_ref< void()> Fn)
Run a given function on a stack with "sufficient" space.
void CheckAlignasUnderalignment(Decl *D)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
This represents one expression.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
void setCompleteDefinition()
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
unsigned getChainingSize() const
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
Represents the body of a requires-expression.
bool isDefaulted() const
Whether this function is defaulted per C++0x.
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
void deduceOpenCLAddressSpace(ValueDecl *decl)
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Declaration of a template type parameter.
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr *> VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
ClassTemplatePartialSpecializationDecl * InstantiateClassTemplatePartialSpecialization(ClassTemplateDecl *ClassTemplate, ClassTemplatePartialSpecializationDecl *PartialSpec)
Instantiate the declaration of a class template partial specialization.
DeclarationNameInfo getNameInfo() const
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
void setHideTags(bool Hide)
Sets whether tag declarations should be hidden by non-tag declarations during resolution.
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name...
const T * castAs() const
Member-template castAs<specific type>.
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
static DeclT * getPreviousDeclForInstantiation(DeclT *D)
Get the previous declaration of a declaration for the purposes of template instantiation.
Represents a C++ destructor within a class.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr)
Check that the given template arguments can be be provided to the given template, converting the argu...
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
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. ...
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
bool isLocalExternDecl()
Determine whether this is a block-scope declaration with linkage.
bool isFileContext() const
TemplateParameterList * getTemplateParameterList(unsigned index) const
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, Optional< unsigned > NumExpansions, bool ExpectParameterPack)
DeclContext * getDeclContext()
CXXRecordDecl * getDefinition() const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
SourceLocation getEllipsisLoc() const
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
const Expr * getExpr() const
EnumDecl * getDefinition() const
static void InstantiateDefaultCtorDefaultArgs(Sema &S, CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
static DefaultedFunctionInfo * Create(ASTContext &Context, ArrayRef< DeclAccessPair > Lookups)
Defines the clang::TypeLoc interface and its subclasses.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
void DiscardCleanupsInEvaluationContext()
VarDecl * getTemplateInstantiationPattern() const
Retrieve the variable declaration from which this variable could be instantiated, if it is an instant...
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
void setConstexpr(bool IC)
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.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
bool isFunctionOrMethod() const
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
StorageClass
Storage classes.
IdentifierInfo * getSetterId() const
Declaration of an alias template.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Data structure that captures multiple levels of template argument lists for use in template instantia...
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
QualType getRecordType(const RecordDecl *Decl) const
SourceLocation getEnd() const
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
clauselist_range clauselists()
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
void setLocation(SourceLocation L)
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Expr * getInitPriv()
Get Priv variable of the initializer.
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
Represents a C++ deduction guide declaration.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
Represents a C++ conversion function within a class.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
static StringRef getIdentifier(const Token &Tok)
static void instantiateOMPDeclareSimdDeclAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareSimdDeclAttr &Attr, Decl *New)
Instantiation of 'declare simd' attribute and its arguments.
static void instantiateDependentModeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const ModeAttr &Attr, Decl *New)
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
TypeSourceInfo * SubstFunctionType(FunctionDecl *D, SmallVectorImpl< ParmVarDecl *> &Params)
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation. ...
bool isDirectInit() const
Whether the initializer is a direct-initializer (list or call).
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
Attr * instantiateTemplateAttribute(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
RecordDecl * getDecl() const
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
TypeLoc getPatternLoc() const
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...
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
ExceptionSpecificationType Type
The kind of exception specification this is.
TypeLoc IgnoreParens() const
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
A stack object to be created when performing template instantiation.
ExtProtoInfo getExtProtoInfo() const
Attr * instantiateTemplateAttributeForDecl(const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, TemplateArgumentListInfo &Result, const MultiLevelTemplateArgumentList &TemplateArgs)
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration. ...
ASTContext & getASTContext() const
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, ArrayRef< TemplateParameterList *> FriendTypeTPLists=None)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
bool isParameterPack() const
Returns whether this is a parameter pack.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Encodes a location in the source.
QualType getReturnType() const
bool isPure() const
Whether this virtual function is pure, i.e.
void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
This represents '#pragma omp declare reduction ...' directive.
decl_iterator decls_begin() const
Pseudo declaration for capturing expressions.
static bool isInstantiationOfUnresolvedUsingDecl(T *Pattern, Decl *Other, ASTContext &Ctx)
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Attr * clone(ASTContext &C) const
static ExplicitSpecifier instantiateExplicitSpecifier(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES, FunctionDecl *New)
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef< Expr *> VarList, ArrayRef< OMPClause *> Clauses, DeclContext *Owner=nullptr)
Called on well-formed '#pragma omp allocate'.
unsigned getManglingNumber(const NamedDecl *ND) const
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
DeclarationName getName() const
getName - Returns the embedded declaration name.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
Represents the declaration of a struct/union/class/enum.
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
TemplateParameterList * SubstTemplateParams(TemplateParameterList *List)
Instantiates a nested template parameter list in the current instantiation context.
void setReferenced(bool R=true)
Represents the declaration of a label.
Represents a dependent using declaration which was not marked with typename.
void setIsCopyDeductionCandidate(bool isCDC=true)
Represents a static or instance method of a struct/union/class.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
static bool isInstantiationOf(ClassTemplateDecl *Pattern, ClassTemplateDecl *Instance)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
Decl * VisitDecl(Decl *D)
SourceLocation getIdentLocation() const
Returns the location of this using declaration's identifier.
const ParmVarDecl * getParamDecl(unsigned i) const
static void instantiateDependentAlignValueAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignValueAttr *Aligned, Decl *New)
SourceLocation getLocation() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
This is a basic class for representing single OpenMP clause.
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
void setDeclName(DeclarationName N)
Set the name of this declaration.
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
const TemplateArgumentListInfo & getTemplateArgsInfo() const
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
ClassTemplateDecl * getMostRecentDecl()
void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern)
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
void setMapperVarRef(Expr *MapperVarRefE)
Set the variable declared in the mapper.
static ExplicitSpecifier Invalid()
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
static ExplicitSpecifier getFromDecl(FunctionDecl *Function)
SourceLocation getRAngleLoc() const
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
SourceLocation getRAngleLoc() const
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
DeclarationNameInfo getNameInfo() const
Represents a C++11 static_assert declaration.
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
void InstantiatedLocalPackArg(const Decl *D, VarDecl *Inst)
void setLAngleLoc(SourceLocation Loc)
SourceLocation getAccessSpecifierLoc() const
The location of the access specifier.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
void addArgument(const TemplateArgumentLoc &Loc)
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isTemplateTypeParmType() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
Expr * getInitOrig()
Get Orig variable of the initializer.
void setVirtualAsWritten(bool V)
State that this function is marked as virtual explicitly.
Represents a pack expansion of types.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
A POD class for pairing a NamedDecl* with an access specifier.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments.
ddiag_range ddiags() 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...
Base class for declarations which introduce a typedef-name.
Represents a template argument.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
static bool isInvalid(LocType Loc, bool *Invalid)
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
bool isNull() const
Determine whether this template name is NULL.
static bool addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function, const FunctionDecl *PatternDecl, LocalInstantiationScope &Scope, const MultiLevelTemplateArgumentList &TemplateArgs)
Introduce the instantiated function parameters into the local instantiation scope, and set the parameter names to those used in the template.
Dataflow Directional Tag Classes.
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
ExtInfo getExtInfo() const
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
const TemplateArgument & getArgument() const
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
LocalInstantiationScope * cloneScopes(LocalInstantiationScope *Outermost)
Clone this scope, and all outer scopes, down to the given outermost scope.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
The base class of all kinds of template declarations (e.g., class, function, etc.).
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a class template node.
bool NE(InterpState &S, CodePtr OpPC)
Qualifiers getMethodQualifiers() const
Represents a field injected from an anonymous union/struct into the parent scope. ...
QualType getUnderlyingType() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
CanQualType UnsignedLongLongTy
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
const Expr * getInit() const
AccessSpecifier getAccess() const
static NamedDecl * findInstantiationOf(ASTContext &Ctx, NamedDecl *D, ForwardIterator first, ForwardIterator last)
A decomposition declaration.
This template specialization was instantiated from a template due to an explicit instantiation declar...
unsigned getIndex() const
Retrieve the index of the template parameter.
Represents a dependent using declaration which was marked with typename.
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
static UsingDirectiveDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, SourceLocation NamespaceLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation IdentLoc, NamedDecl *Nominated, DeclContext *CommonAncestor)
The name of a declaration.
void setInstantiationIsPending(bool IC)
State that the instantiation of this function is pending.
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.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined...
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
unsigned getNumTemplateParameterLists() const
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
void setInlineSpecified()
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void setPreviousDeclInSameBlockScope(bool Same)
bool isTemplateInstantiation() const
Determines if the given function was instantiated from a function template.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration...
void setInitCapture(bool IC)
void setLocalExternDecl()
Changes the namespace of this declaration to reflect that it's a function-local extern declaration...
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
void setImplicitlyInline()
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Location wrapper for a TemplateArgument.
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
Decl * Visit(PTR(Decl) D)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
TemplateSpecializationKind getTemplateSpecializationKindForInstantiation() const
Get the template specialization kind of this variable for the purposes of template instantiation...
This template specialization was declared or defined by an explicit specialization (C++ [temp...
bool CheckConstraintExpression(Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
bool isConstantInitializer(ASTContext &Ctx, bool ForRef, const Expr **Culprit=nullptr) const
isConstantInitializer - Returns true if this expression can be emitted to IR as a constant...
void setNonMemberOperator()
Specifies that this declaration is a C++ overloaded non-member.
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl *> Elements, Scope *S, const ParsedAttributesView &Attr)
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C...
bool isFunctionType() const
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
static bool SubstQualifier(Sema &SemaRef, const DeclT *OldDecl, DeclT *NewDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
TypeSourceInfo * getTypeSourceInfo() const
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this 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...
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
void setCXXForRangeDecl(bool FRD)
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
static CXXDestructorDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause=nullptr)
void addDecl(Decl *D)
Add the declaration D into this context.
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
The template argument is actually a parameter pack.
TemplateSpecializationKind getTemplateSpecializationKindForInstantiation() const
Determine the kind of template specialization this function represents for the purpose of template in...
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool hasTypename() const
Return true if the using declaration has 'typename'.
void setInnerLocStart(SourceLocation L)
static BindingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
RedeclarationKind forRedeclarationInCurContext()
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
A template argument list.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
shadow_range shadows() const
QualType getParamType(unsigned i) const
Call-style initialization (C++98)
Represents a field declaration created by an @defs(...).
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
TypedefNameDecl * getTypedefNameForAnonDecl() const
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization)
Perform semantic checking of a new function declaration.
bool isMutable() const
Determines whether this field is mutable (C++ only).
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Represents a C++ struct/union/class.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
void setTSCSpec(ThreadStorageClassSpecifier TSC)
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr *> &AC) const
Get the total constraint-expression associated with this template, including constraint-expressions d...
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
void setDescribedVarTemplate(VarTemplateDecl *Template)
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
void addHiddenDecl(Decl *D)
Add the declaration D to this context without modifying any lookup tables.
void setParam(unsigned i, ParmVarDecl *VD)
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Provides information a specialization of a member of a class template, which may be a member function...
bool CheckInstantiatedFunctionTemplateConstraints(SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef< TemplateArgument > TemplateArgs, ConstraintSatisfaction &Satisfaction)
void atTemplateEnd(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
void setUnsupportedFriend(bool Unsupported)
static UsingDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation UsingL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
Declaration of a class template.
CXXMethodDecl * getSpecialization() const
SourceManager & getSourceManager() const
This represents '#pragma omp declare mapper ...' directive.
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
static bool isInstantiationOfStaticDataMember(VarDecl *Pattern, VarDecl *Instance)
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
SourceLocation getLAngleLoc() const
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
Expr * getCombinerIn()
Get In variable of the combiner.
static Sema::RetainOwnershipKind attrToRetainOwnershipKind(const Attr *A)
static OpaquePtr make(QualType P)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
The top declaration context.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
bool isDeleted() const
Whether this function has been deleted.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
SourceLocation getTemplateNameLoc() const
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, CopyElisionSemanticsKind CESK)
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
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.
This structure contains most locations needed for by an OMPVarListClause.
bool isStaticDataMember() const
Determines whether this is a static data member.
An instance of this class represents the declaration of a property member.
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
static bool isPotentialConstantExprUnevaluated(Expr *E, const FunctionDecl *FD, SmallVectorImpl< PartialDiagnosticAt > &Diags)
isPotentialConstantExprUnevaluted - Return true if this expression might be usable in a constant expr...
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
bool empty() const
Return true if no decls were found.
A trivial tuple used to represent a source range.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
void setLexicalDeclContext(DeclContext *DC)
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
This represents a decl that may have a name.
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void setAccess(AccessSpecifier AS)
bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec)
tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
Represents a C++ namespace alias.
bool isInline() const
Whether this variable is (C++1z) inline.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Declaration of a friend template.
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
SourceLocation getRAngleLoc() const
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
attr::Kind getKind() const
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...
Expr * getCombinerOut()
Get Out variable of the combiner.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
void setType(QualType newType)
static void instantiateDependentAMDGPUFlatWorkGroupSizeAttr(Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AMDGPUFlatWorkGroupSizeAttr &Attr, Decl *New)
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
bool isInvalid() const
Determine if the explicit specifier is invalid.
bool InitMethodInstantiation(CXXMethodDecl *New, CXXMethodDecl *Tmpl)
Initializes common fields of an instantiated method declaration (New) from the corresponding fields o...
This represents '#pragma omp threadprivate ...' directive.
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
ExceptionSpecInfo ExceptionSpec
Declaration of a template function.
bool hasLinkage() const
Determine whether this declaration has linkage.
Attr - This represents one attribute.
bool isDeletedAsWritten() const
SourceLocation getLocation() const
Decl * VisitCXXMethodDecl(CXXMethodDecl *D, TemplateParameterList *TemplateParams, Optional< const ASTTemplateArgumentListInfo *> ClassScopeSpecializationArgs=llvm::None, RewriteKind RK=RewriteKind::None)
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
QualType getType() const
Return the type wrapped by this type source info.
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.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
decl_iterator decls_end() const
SourceLocation getPointOfInstantiation() const
Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...
OMPClause * ActOnOpenMPMapClause(ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr *> VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr *> UnresolvedMappers=llvm::None)
Called on well-formed 'map' clause.
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)