39#include "llvm/ADT/SmallBitVector.h"
40#include "llvm/ADT/StringExtras.h"
51 return SourceRange(Ps[0]->getTemplateLoc(), Ps[N-1]->getRAngleLoc());
59 for (
Scope *TempParamScope = S->getTemplateParamParent(); TempParamScope;
60 TempParamScope = TempParamScope->getParent()->getTemplateParamParent()) {
65 auto ParamsAtDepth = [&](
unsigned D) { Depth = std::max(Depth,
D + 1); };
70 if (
auto *LSI = dyn_cast<LambdaScopeInfo>(FSI)) {
71 if (!LSI->TemplateParams.empty()) {
72 ParamsAtDepth(LSI->AutoTemplateParameterDepth);
75 if (LSI->GLTemplateParameterList) {
76 ParamsAtDepth(LSI->GLTemplateParameterList->getDepth());
86 if (!Info.TemplateParams.empty()) {
87 ParamsAtDepth(Info.AutoTemplateParameterDepth);
102 bool AllowFunctionTemplates,
103 bool AllowDependent) {
104 D =
D->getUnderlyingDecl();
106 if (isa<TemplateDecl>(
D)) {
107 if (!AllowFunctionTemplates && isa<FunctionTemplateDecl>(
D))
113 if (
const auto *
Record = dyn_cast<CXXRecordDecl>(
D)) {
125 if (
Record->isInjectedClassName()) {
127 if (
Record->getDescribedClassTemplate())
128 return Record->getDescribedClassTemplate();
130 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(
Record))
131 return Spec->getSpecializedTemplate();
140 if (AllowDependent && isa<UnresolvedUsingValueDecl>(
D))
147 bool AllowFunctionTemplates,
148 bool AllowDependent) {
159 bool AllowFunctionTemplates,
161 bool AllowNonTemplateFunctions) {
165 if (AllowNonTemplateFunctions &&
166 isa<FunctionDecl>((*I)->getUnderlyingDecl()))
175 bool hasTemplateKeyword,
178 bool EnteringContext,
180 bool &MemberOfUnknownSpecialization,
181 bool Disambiguation) {
185 MemberOfUnknownSpecialization =
false;
187 switch (Name.getKind()) {
194 Name.OperatorFunctionId.Operator);
234 bool AnyFunctionTemplates =
false;
237 if (isa<FunctionTemplateDecl>(FoundTemplate))
238 AnyFunctionTemplates =
true;
241 FoundUsingShadow = dyn_cast<UsingShadowDecl>(FoundD);
249 if (!
D && !AnyFunctionTemplates) {
250 R.suppressDiagnostics();
267 unsigned ResultCount = R.
end() - R.
begin();
268 if (!
D && ResultCount > 1) {
279 assert(
D &&
"unambiguous result is not a template name");
282 if (isa<UnresolvedUsingValueDecl>(
D)) {
284 MemberOfUnknownSpecialization =
true;
291 assert(!FoundUsingShadow || FoundUsingShadow->
getTargetDecl() == TD);
298 if (isa<FunctionTemplateDecl>(TD)) {
304 assert(isa<ClassTemplateDecl>(TD) || isa<TemplateTemplateParmDecl>(TD) ||
305 isa<TypeAliasTemplateDecl>(TD) || isa<VarTemplateDecl>(TD) ||
306 isa<BuiltinTemplateDecl>(TD) || isa<ConceptDecl>(TD));
329 if (R.
empty())
return false;
366 Diag(IILoc, diag::err_template_kw_missing)
376 QualType ObjectType,
bool EnteringContext,
379 bool AllowTypoCorrection) {
386 Found.setTemplateNameLookup(
true);
390 bool IsDependent =
false;
391 if (!ObjectType.
isNull()) {
394 assert(SS.
isEmpty() &&
"ObjectType and scope specifier cannot coexist");
400 "Caller should have completed object type");
432 bool ObjectTypeSearchedInScope =
false;
433 bool AllowFunctionTemplatesInLookup =
true;
449 IsDependent |=
Found.wasNotFoundInCurrentInstantiation();
465 if (!ObjectType.
isNull()) {
469 AllowFunctionTemplatesInLookup =
false;
470 ObjectTypeSearchedInScope =
true;
473 IsDependent |=
Found.wasNotFoundInCurrentInstantiation();
476 if (
Found.isAmbiguous())
493 if (AllFunctions || (
Found.empty() && !IsDependent)) {
497 *ATK = (
Found.empty() &&
Found.getLookupName().isIdentifier())
505 if (
Found.empty() && !IsDependent && AllowTypoCorrection) {
513 FilterCCC.WantExpressionKeywords =
false;
514 FilterCCC.WantRemainingKeywords =
false;
515 FilterCCC.WantCXXNamedCasts =
true;
519 if (
auto *ND = Corrected.getFoundDecl())
522 if (
Found.isAmbiguous()) {
524 }
else if (!
Found.empty()) {
525 Found.setLookupName(Corrected.getCorrection());
527 std::string CorrectedStr(Corrected.getAsString(
getLangOpts()));
528 bool DroppedSpecifier = Corrected.WillReplaceSpecifier() &&
529 Name.getAsString() == CorrectedStr;
531 << Name << LookupCtx << DroppedSpecifier
541 Found.empty() ? nullptr :
Found.getRepresentativeDecl();
545 Found.setNotFoundInCurrentInstantiation();
551 if (ExampleLookupResult && RequiredTemplate) {
552 Diag(
Found.getNameLoc(), diag::err_template_kw_refers_to_non_template)
557 diag::note_template_kw_refers_to_non_template)
558 <<
Found.getLookupName();
565 if (S && !ObjectType.
isNull() && !ObjectTypeSearchedInScope &&
582 if (FoundOuter.
empty()) {
592 }
else if (!
Found.isSuppressingAmbiguousDiagnostics()) {
596 if (!
Found.isSingleResult() ||
600 diag::ext_nested_name_member_ref_lookup_ambiguous)
601 <<
Found.getLookupName()
603 Diag(
Found.getRepresentativeDecl()->getLocation(),
604 diag::note_ambig_member_ref_object_type)
607 diag::note_ambig_member_ref_scope);
630 bool MissingTemplateKeyword =
false;
633 if (
auto *DRE = dyn_cast<DeclRefExpr>(
TemplateName.get())) {
634 NameInfo = DRE->getNameInfo();
635 SS.
Adopt(DRE->getQualifierLoc());
637 Found = DRE->getFoundDecl();
638 }
else if (
auto *ME = dyn_cast<MemberExpr>(
TemplateName.get())) {
639 NameInfo = ME->getMemberNameInfo();
640 SS.
Adopt(ME->getQualifierLoc());
642 LookupCtx = ME->getBase()->getType()->getAsCXXRecordDecl();
643 Found = ME->getMemberDecl();
644 }
else if (
auto *DSDRE =
645 dyn_cast<DependentScopeDeclRefExpr>(
TemplateName.get())) {
646 NameInfo = DSDRE->getNameInfo();
647 SS.
Adopt(DSDRE->getQualifierLoc());
648 MissingTemplateKeyword =
true;
649 }
else if (
auto *DSME =
650 dyn_cast<CXXDependentScopeMemberExpr>(
TemplateName.get())) {
651 NameInfo = DSME->getMemberNameInfo();
652 SS.
Adopt(DSME->getQualifierLoc());
653 MissingTemplateKeyword =
true;
655 llvm_unreachable(
"unexpected kind of potential template name");
660 if (MissingTemplateKeyword) {
669 TemplateCandidateFilter(
Sema &S) : S(S) {
670 WantTypeSpecifiers =
false;
671 WantExpressionKeywords =
false;
672 WantRemainingKeywords =
false;
673 WantCXXNamedCasts =
true;
675 bool ValidateCandidate(
const TypoCorrection &Candidate)
override {
681 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
682 return std::make_unique<TemplateCandidateFilter>(*
this);
687 TemplateCandidateFilter CCC(*
this);
690 auto *ND = Corrected.getFoundDecl();
693 if (ND || Corrected.isKeyword()) {
695 std::string CorrectedStr(Corrected.getAsString(
getLangOpts()));
696 bool DroppedSpecifier = Corrected.WillReplaceSpecifier() &&
697 Name.getAsString() == CorrectedStr;
699 PDiag(diag::err_non_template_in_member_template_id_suggest)
700 << Name << LookupCtx << DroppedSpecifier
704 PDiag(diag::err_non_template_in_template_id_suggest)
709 diag::note_non_template_in_template_id_found);
714 Diag(NameInfo.
getLoc(), diag::err_non_template_in_template_id)
717 Diag(
Found->getLocation(), diag::note_non_template_in_template_id_found);
724 bool isAddressOfOperand,
740 nullptr, NameInfo, TemplateArgs);
763 bool InstantiatedFromMember,
768 assert(isa<TagDecl>(Instantiation) || isa<FunctionDecl>(Instantiation) ||
769 isa<VarDecl>(Instantiation));
771 bool IsEntityBeingDefined =
false;
772 if (
const TagDecl *TD = dyn_cast_or_null<TagDecl>(PatternDef))
773 IsEntityBeingDefined = TD->isBeingDefined();
775 if (PatternDef && !IsEntityBeingDefined) {
790 if (!Complain || (PatternDef && PatternDef->
isInvalidDecl()))
794 if (
TagDecl *TD = dyn_cast<TagDecl>(Instantiation))
797 Diag(PointOfInstantiation,
798 diag::err_template_instantiate_within_definition)
804 }
else if (InstantiatedFromMember) {
805 if (isa<FunctionDecl>(Instantiation)) {
806 Diag(PointOfInstantiation,
807 diag::err_explicit_instantiation_undefined_member)
812 assert(isa<TagDecl>(Instantiation) &&
"Must be a TagDecl!");
813 Diag(PointOfInstantiation,
814 diag::err_implicit_instantiate_member_undefined)
819 if (isa<FunctionDecl>(Instantiation)) {
820 Diag(PointOfInstantiation,
821 diag::err_explicit_instantiation_undefined_func_template)
824 }
else if (isa<TagDecl>(Instantiation)) {
825 Diag(PointOfInstantiation, diag::err_template_instantiate_undefined)
830 assert(isa<VarDecl>(Instantiation) &&
"Must be a VarDecl!");
831 if (isa<VarTemplateSpecializationDecl>(Instantiation)) {
832 Diag(PointOfInstantiation,
833 diag::err_explicit_instantiation_undefined_var_template)
837 Diag(PointOfInstantiation,
838 diag::err_explicit_instantiation_undefined_member)
855 bool SupportedForCompatibility) {
868 ? diag::ext_template_param_shadow
869 : (SupportedForCompatibility ? diag::ext_compat_template_param_shadow
870 : diag::err_template_param_shadow);
871 const auto *ND = cast<NamedDecl>(PrevDecl);
872 Diag(
Loc, DiagId) << ND->getDeclName();
877 if (
TemplateDecl *Temp = dyn_cast_or_null<TemplateDecl>(
D)) {
878 D = Temp->getTemplatedDecl();
887 "Only template template arguments can be pack expansions here");
888 assert(
getAsTemplate().get().containsUnexpandedParameterPack() &&
889 "Template template argument pack expansion without packs");
891 Result.EllipsisLoc = EllipsisLoc;
926 llvm_unreachable(
"Unhandled parsed template argument");
931 for (
unsigned I = 0,
Last = TemplateArgsIn.size(); I !=
Last; ++I)
941 RedeclarationKind::ForVisibleRedeclaration);
951 assert(TInfo &&
"template argument with no location");
959 EllipsisLoc = PET.getEllipsisLoc();
960 TL = PET.getPatternLoc();
965 SS.
Adopt(ET.getQualifierLoc());
966 TL = ET.getNamedTypeLoc();
970 TemplateName Name = DTST.getTypePtr()->getTemplateName();
972 DTST.getTemplateNameLoc());
993 unsigned Depth,
unsigned Position,
996 bool HasTypeConstraint) {
997 assert(S->isTemplateParamScope() &&
998 "Template type parameter not in template parameter scope!");
1000 bool IsParameterPack = EllipsisLoc.
isValid();
1003 KeyLoc, ParamNameLoc, Depth, Position,
1004 ParamName,
Typename, IsParameterPack,
1010 CSI->LocalPacks.push_back(Param);
1023 if (DefaultArg && IsParameterPack) {
1024 Diag(EqualLoc, diag::err_template_param_pack_default_arg);
1025 DefaultArg =
nullptr;
1033 assert(DefaultTInfo &&
"expected source information for type");
1061 return TemplateArgs;
1074 diag::err_type_constraint_non_type_concept);
1083 if (!WereArgsSpecified &&
1086 diag::err_type_constraint_missing_arguments)
1105 bool AllowUnexpandedPack) {
1122 if (EllipsisLoc.
isInvalid() && !AllowUnexpandedPack) {
1131 ConceptName, CD, USD ? cast<NamedDecl>(USD) : CD,
1137template <
typename ArgumentLocAppender>
1152 Appender(ConstraintArgs);
1161 FoundDecl ? FoundDecl : NamedConcept, NamedConcept,
1164 return ImmediatelyDeclaredConstraint;
1180 ImmediatelyDeclaredConstraint.
get(), BO_LAnd,
1181 EllipsisLoc,
nullptr,
1198 *TemplateArgs) :
nullptr;
1200 QualType ParamAsArgument = ConstrainedType;
1203 *
this,
NS, NameInfo, NamedConcept, FoundDecl,
1206 ParamAsArgument, ConstrainedParameter->
getLocation(),
1209 for (const auto &ArgLoc : TemplateArgs->arguments())
1210 ConstraintArgs.addArgument(ArgLoc);
1213 if (ImmediatelyDeclaredConstraint.
isInvalid())
1223 ImmediatelyDeclaredConstraint.
get());
1234 diag::err_unsupported_placeholder_constraint)
1253 for (unsigned I = 0, C = TL.getNumArgs(); I != C; ++I)
1254 ConstraintArgs.addArgument(TL.getArgLoc(I));
1257 if (ImmediatelyDeclaredConstraint.
isInvalid() ||
1258 !ImmediatelyDeclaredConstraint.
isUsable())
1262 ImmediatelyDeclaredConstraint.
get());
1292 Diag(
Loc, diag::err_template_nontype_parm_rvalue_ref) <<
T;
1302 Diag(
Loc, diag::err_template_nontype_parm_bad_type) <<
T;
1310 Diag(
Loc, diag::err_template_nontype_parm_not_structural) <<
T;
1317 for (
const FieldDecl *FD : RD->fields()) {
1319 Diag(FD->getLocation(), diag::note_not_structural_non_public) <<
T << 0;
1322 if (FD->isMutable()) {
1323 Diag(FD->getLocation(), diag::note_not_structural_mutable_field) <<
T;
1326 if (FD->getType()->isRValueReferenceType()) {
1327 Diag(FD->getLocation(), diag::note_not_structural_rvalue_ref_field)
1334 for (
const auto &BaseSpec : RD->bases()) {
1335 if (BaseSpec.getAccessSpecifier() !=
AS_public) {
1336 Diag(BaseSpec.getBaseTypeLoc(), diag::note_not_structural_non_public)
1347 for (
const FieldDecl *FD : RD->fields()) {
1350 SubLoc = FD->getLocation();
1358 for (
const auto &BaseSpec : RD->bases()) {
1361 SubLoc = BaseSpec.getBaseTypeLoc();
1369 assert(Kind != -1 &&
"couldn't find reason why type is not structural");
1370 Diag(SubLoc, diag::note_not_structural_subobject)
1371 <<
T << Kind << SubType;
1384 Diag(
Loc, diag::err_variably_modified_nontype_template_param)
1408 return T.getUnqualifiedType();
1426 return T.getUnqualifiedType();
1437 Diag(
Loc, diag::err_template_nontype_parm_bad_structural_type) <<
T;
1441 Diag(
Loc, diag::warn_cxx17_compat_template_nontype_parm_type) <<
T;
1442 return T.getUnqualifiedType();
1453 auto CheckValidDeclSpecifiers = [
this, &
D] {
1467 Diag(
Loc, diag::err_invalid_decl_specifier_in_nontype_parm)
1504 CheckValidDeclSpecifiers();
1507 if (isa<AutoType>(
T))
1508 Diag(
D.getIdentifierLoc(),
1509 diag::warn_cxx14_compat_template_nontype_parm_auto_type)
1512 assert(S->isTemplateParamScope() &&
1513 "Non-type template parameter not in template parameter scope!");
1525 bool IsParameterPack =
D.hasEllipsis();
1528 D.getIdentifierLoc(), Depth, Position, ParamName,
T, IsParameterPack,
1533 if (TL.isConstrained())
1542 CSI->LocalPacks.push_back(Param);
1556 if (
Default && IsParameterPack) {
1557 Diag(EqualLoc, diag::err_template_param_pack_default_arg);
1580 assert(S->isTemplateParamScope() &&
1581 "Template template parameter not in template parameter scope!");
1584 bool IsParameterPack = EllipsisLoc.
isValid();
1587 NameLoc.
isInvalid() ? TmpLoc : NameLoc, Depth, Position, IsParameterPack,
1593 LSI->LocalPacks.push_back(Param);
1604 if (Params->
size() == 0) {
1613 if (IsParameterPack && !
Default.isInvalid()) {
1614 Diag(EqualLoc, diag::err_template_param_pack_default_arg);
1629 Diag(DefaultArg.
getLocation(), diag::err_template_arg_not_valid_template)
1647class ConstraintRefersToContainingTemplateChecker
1648 :
public TreeTransform<ConstraintRefersToContainingTemplateChecker> {
1649 bool Result =
false;
1651 unsigned TemplateDepth = 0;
1655 void CheckIfContainingRecord(
const CXXRecordDecl *CheckingRD) {
1661 DC && !DC->isFileContext(); DC = DC->getParent())
1662 if (
const auto *RD = dyn_cast<CXXRecordDecl>(DC))
1663 if (CheckingRD == RD->getMostRecentDecl())
1668 if (
D->getDepth() < TemplateDepth)
1673 TransformType(
D->getType());
1679 ConstraintRefersToContainingTemplateChecker(
Sema &SemaRef,
1681 unsigned TemplateDepth)
1682 : inherited(SemaRef),
Friend(
Friend), TemplateDepth(TemplateDepth) {}
1683 bool getResult()
const {
return Result; }
1689 using inherited::TransformTemplateTypeParmType;
1694 return inherited::TransformTemplateTypeParmType(
1706 if (
auto *TD = dyn_cast<TypedefNameDecl>(
D))
1707 TransformType(TD->getUnderlyingType());
1708 else if (
auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(
D))
1709 CheckNonTypeTemplateParmDecl(NTTPD);
1710 else if (
auto *VD = dyn_cast<ValueDecl>(
D))
1711 TransformType(VD->getType());
1712 else if (
auto *TD = dyn_cast<TemplateDecl>(
D))
1713 TransformTemplateParameterList(TD->getTemplateParameters());
1714 else if (
auto *RD = dyn_cast<CXXRecordDecl>(
D))
1715 CheckIfContainingRecord(RD);
1716 else if (isa<NamedDecl>(
D)) {
1719 llvm_unreachable(
"Don't know how to handle this declaration type yet");
1727 const Expr *Constraint) {
1728 assert(
Friend->getFriendObjectKind() &&
"Only works on a friend");
1729 ConstraintRefersToContainingTemplateChecker Checker(*
this,
Friend,
1731 Checker.TransformExpr(
const_cast<Expr *
>(Constraint));
1732 return Checker.getResult();
1742 Expr *RequiresClause) {
1744 Diag(ExportLoc, diag::warn_template_export_unsupported);
1750 Context, TemplateLoc, LAngleLoc,
1751 llvm::ArrayRef(Params.data(), Params.size()), RAngleLoc, RequiresClause);
1786 return cast<TemplateDecl>(
D)->getTemplateParameters();
1796 assert(TemplateParams && TemplateParams->
size() > 0 &&
1797 "No template parameters");
1799 "Can only declare or define class templates");
1808 "can't build template of enumerated type");
1812 Diag(KWLoc, diag::err_template_unnamed_class);
1827 if (!SemanticContext) {
1832 ? diag::warn_template_qualified_friend_ignored
1833 : diag::err_template_qualified_declarator_no_match)
1892 if (S->isTemplateParamScope())
1897 PrevDecl = (*
Previous.begin())->getUnderlyingDecl();
1909 dyn_cast_or_null<ClassTemplateDecl>(PrevDecl);
1914 if (!PrevClassTemplate && isa_and_nonnull<CXXRecordDecl>(PrevDecl) &&
1915 cast<CXXRecordDecl>(PrevDecl)->isInjectedClassName()) {
1918 = cast<CXXRecordDecl>(PrevDecl)->getDescribedClassTemplate();
1919 if (!PrevClassTemplate && isa<ClassTemplateSpecializationDecl>(PrevDecl)) {
1921 = cast<ClassTemplateSpecializationDecl>(PrevDecl)
1922 ->getSpecializedTemplate();
1945 PrevDecl = PrevClassTemplate =
nullptr;
1946 SemanticContext = OutermostContext;
1960 PrevDecl = (*
Previous.begin())->getUnderlyingDecl();
1964 SemanticContext, S, SS.
isValid()))
1965 PrevDecl = PrevClassTemplate =
nullptr;
1967 if (
auto *Shadow = dyn_cast_or_null<UsingShadowDecl>(
1968 PrevDecl ?
Previous.getRepresentativeDecl() :
nullptr)) {
1970 !(PrevClassTemplate &&
1973 Diag(KWLoc, diag::err_using_decl_conflict_reverse);
1974 Diag(Shadow->getTargetDecl()->getLocation(),
1975 diag::note_using_decl_target);
1976 Diag(Shadow->getIntroducer()->getLocation(), diag::note_using_decl) << 0;
1978 PrevDecl = PrevClassTemplate =
nullptr;
1982 if (PrevClassTemplate) {
1991 TemplateParams, PrevClassTemplate,
2004 Diag(KWLoc, diag::err_use_with_wrong_tag)
2020 auto *Tmpl = cast<CXXRecordDecl>(Hidden)->getDescribedClassTemplate();
2021 assert(Tmpl &&
"original definition of a class template is not a "
2026 Diag(NameLoc, diag::err_redefinition) << Name;
2027 Diag(Def->getLocation(), diag::note_previous_definition);
2034 }
else if (PrevDecl) {
2040 Diag(NameLoc, diag::err_redefinition_different_kind) << Name;
2054 (SS.
isSet() && SemanticContext && SemanticContext->
isRecord() &&
2067 ? diag::err_friend_decl_does_not_match
2068 : diag::err_member_decl_does_not_match)
2069 << Name << SemanticContext <<
true << SS.
getRange();
2079 bool ShouldAddRedecl =
2084 PrevClassTemplate && ShouldAddRedecl ?
2088 if (NumOuterTemplateParamLists > 0)
2091 llvm::ArrayRef(OuterTemplateParamLists, NumOuterTemplateParamLists));
2105 if (ShouldAddRedecl)
2110 if (ModulePrivateLoc.
isValid())
2121 if (PrevClassTemplate &&
2140 if (PrevClassTemplate)
2176 if (PrevClassTemplate)
2217 diag::warn_cxx98_compat_template_parameter_default_in_function_template
2218 : diag::ext_template_parameter_default_in_function_template)
2227 S.
Diag(ParamLoc, diag::err_template_parameter_default_template_member)
2236 S.
Diag(ParamLoc, diag::err_template_parameter_default_friend_template)
2245 llvm_unreachable(
"Invalid TemplateParamListContext!");
2258 for (
unsigned I = 0, N = Params->
size(); I != N; ++I) {
2263 if (TC->hasExplicitTemplateArgs())
2264 for (
auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())
2272 if (!NTTP->isParameterPack() &&
2274 NTTP->getTypeSourceInfo(),
2282 = dyn_cast<TemplateTemplateParmDecl>(
P))
2302 bool SawDefaultArgument =
false;
2308 OldParam = OldParams->
begin();
2310 bool RemoveDefaultArguments =
false;
2312 NewParamEnd = NewParams->
end();
2313 NewParam != NewParamEnd; ++NewParam) {
2316 bool RedundantDefaultArg =
false;
2319 bool InconsistentDefaultArg =
false;
2321 std::string PrevModuleName;
2327 bool MissingDefaultArg =
false;
2330 bool SawParameterPack =
false;
2333 = dyn_cast<TemplateTypeParmDecl>(*NewParam)) {
2335 if (NewTypeParm->hasDefaultArgument() &&
2337 *
this, TPC, NewTypeParm->getLocation(),
2338 NewTypeParm->getDefaultArgument().getSourceRange()))
2339 NewTypeParm->removeDefaultArgument();
2343 = OldParams? cast<TemplateTypeParmDecl>(*OldParam) :
nullptr;
2344 if (NewTypeParm->isParameterPack()) {
2345 assert(!NewTypeParm->hasDefaultArgument() &&
2346 "Parameter packs can't have a default argument!");
2347 SawParameterPack =
true;
2349 NewTypeParm->hasDefaultArgument() &&
2352 NewDefaultLoc = NewTypeParm->getDefaultArgumentLoc();
2353 SawDefaultArgument =
true;
2356 RedundantDefaultArg =
true;
2357 else if (!
getASTContext().isSameDefaultTemplateArgument(OldTypeParm,
2359 InconsistentDefaultArg =
true;
2363 PreviousDefaultArgLoc = NewDefaultLoc;
2367 NewTypeParm->setInheritedDefaultArgument(
Context, OldTypeParm);
2369 }
else if (NewTypeParm->hasDefaultArgument()) {
2370 SawDefaultArgument =
true;
2371 PreviousDefaultArgLoc = NewTypeParm->getDefaultArgumentLoc();
2372 }
else if (SawDefaultArgument)
2373 MissingDefaultArg =
true;
2375 = dyn_cast<NonTypeTemplateParmDecl>(*NewParam)) {
2377 if (!NewNonTypeParm->isParameterPack() &&
2379 NewNonTypeParm->getTypeSourceInfo(),
2386 if (NewNonTypeParm->hasDefaultArgument() &&
2388 *
this, TPC, NewNonTypeParm->getLocation(),
2389 NewNonTypeParm->getDefaultArgument().getSourceRange())) {
2390 NewNonTypeParm->removeDefaultArgument();
2395 = OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) :
nullptr;
2396 if (NewNonTypeParm->isParameterPack()) {
2397 assert(!NewNonTypeParm->hasDefaultArgument() &&
2398 "Parameter packs can't have a default argument!");
2399 if (!NewNonTypeParm->isPackExpansion())
2400 SawParameterPack =
true;
2402 NewNonTypeParm->hasDefaultArgument() &&
2405 NewDefaultLoc = NewNonTypeParm->getDefaultArgumentLoc();
2406 SawDefaultArgument =
true;
2408 RedundantDefaultArg =
true;
2410 OldNonTypeParm, NewNonTypeParm)) {
2411 InconsistentDefaultArg =
true;
2415 PreviousDefaultArgLoc = NewDefaultLoc;
2419 NewNonTypeParm->setInheritedDefaultArgument(
Context, OldNonTypeParm);
2421 }
else if (NewNonTypeParm->hasDefaultArgument()) {
2422 SawDefaultArgument =
true;
2423 PreviousDefaultArgLoc = NewNonTypeParm->getDefaultArgumentLoc();
2424 }
else if (SawDefaultArgument)
2425 MissingDefaultArg =
true;
2428 = cast<TemplateTemplateParmDecl>(*NewParam);
2445 = OldParams? cast<TemplateTemplateParmDecl>(*OldParam) :
nullptr;
2448 "Parameter packs can't have a default argument!");
2450 SawParameterPack =
true;
2451 }
else if (OldTemplateParm &&
2457 SawDefaultArgument =
true;
2459 RedundantDefaultArg =
true;
2461 OldTemplateParm, NewTemplateParm)) {
2462 InconsistentDefaultArg =
true;
2466 PreviousDefaultArgLoc = NewDefaultLoc;
2471 PreviousDefaultArgLoc
2474 SawDefaultArgument =
true;
2475 PreviousDefaultArgLoc
2477 }
else if (SawDefaultArgument)
2478 MissingDefaultArg =
true;
2484 if (SawParameterPack && (NewParam + 1) != NewParamEnd &&
2487 Diag((*NewParam)->getLocation(),
2488 diag::err_template_param_pack_must_be_last_template_parameter);
2505 if (RedundantDefaultArg) {
2506 Diag(NewDefaultLoc, diag::err_template_param_default_arg_redefinition);
2507 Diag(OldDefaultLoc, diag::note_template_param_prev_default_arg);
2509 }
else if (InconsistentDefaultArg) {
2513 diag::err_template_param_default_arg_inconsistent_redefinition);
2515 diag::note_template_param_prev_default_arg_in_other_module)
2518 }
else if (MissingDefaultArg &&
2526 Diag((*NewParam)->getLocation(),
2527 diag::err_template_param_default_arg_missing);
2528 Diag(PreviousDefaultArgLoc, diag::note_template_param_prev_default_arg);
2530 RemoveDefaultArguments =
true;
2541 if (RemoveDefaultArguments) {
2543 NewParamEnd = NewParams->
end();
2544 NewParam != NewParamEnd; ++NewParam) {
2546 TTP->removeDefaultArgument();
2548 = dyn_cast<NonTypeTemplateParmDecl>(*NewParam))
2549 NTTP->removeDefaultArgument();
2551 cast<TemplateTemplateParmDecl>(*NewParam)->removeDefaultArgument();
2569 bool IgnoreNonTypeDependent;
2574 DependencyChecker(
unsigned Depth,
bool IgnoreNonTypeDependent)
2575 : Depth(Depth), IgnoreNonTypeDependent(IgnoreNonTypeDependent),
2579 : IgnoreNonTypeDependent(IgnoreNonTypeDependent), Match(
false) {
2582 Depth = PD->getDepth();
2584 dyn_cast<NonTypeTemplateParmDecl>(ND)) {
2585 Depth = PD->getDepth();
2587 Depth = cast<TemplateTemplateParmDecl>(ND)->getDepth();
2592 if (ParmDepth >= Depth) {
2600 bool TraverseStmt(
Stmt *S)
override {
2605 if (
auto *
E = dyn_cast_or_null<Expr>(S))
2611 bool TraverseTypeLoc(
TypeLoc TL)
override {
2612 if (IgnoreNonTypeDependent && !TL.
isNull() &&
2624 return IgnoreNonTypeDependent || !Matches(
T->getDepth());
2630 if (Matches(PD->getDepth()))
2637 dyn_cast<NonTypeTemplateParmDecl>(
E->getDecl()))
2640 return DynamicRecursiveASTVisitor::VisitDeclRefExpr(
E);
2644 return TraverseType(
T->getReplacementType());
2647 bool VisitSubstTemplateTypeParmPackType(
2649 return TraverseTemplateArgument(
T->getArgumentPack());
2653 return TraverseType(
T->getInjectedSpecializationType());
2662 if (!Params->
size())
2665 DependencyChecker Checker(Params,
false);
2666 Checker.TraverseType(
T);
2667 return Checker.Match;
2677 if (
const Type *CurType = NNS->getAsType()) {
2693 bool &IsMemberSpecialization,
bool &
Invalid,
bool SuppressDiagnostic) {
2694 IsMemberSpecialization =
false;
2715 while (!
T.isNull()) {
2716 NestedTypes.push_back(
T);
2722 = dyn_cast<ClassTemplateSpecializationDecl>(
Record)) {
2723 if (!isa<ClassTemplatePartialSpecializationDecl>(Spec) &&
2725 ExplicitSpecLoc = Spec->getLocation();
2728 }
else if (
Record->getTemplateSpecializationKind()
2730 ExplicitSpecLoc =
Record->getLocation();
2743 if (
TemplateDecl *Template = TST->getTemplateName().getAsTemplateDecl()) {
2744 if (
TypeDecl *
Parent = dyn_cast<TypeDecl>(Template->getDeclContext()))
2789 std::reverse(NestedTypes.begin(), NestedTypes.end());
2797 bool SawNonEmptyTemplateParameterList =
false;
2800 if (SawNonEmptyTemplateParameterList) {
2801 if (!SuppressDiagnostic)
2802 Diag(DeclLoc, diag::err_specialize_member_of_template)
2803 << !Recovery <<
Range;
2805 IsMemberSpecialization =
false;
2814 if (CheckExplicitSpecialization(
Range,
true))
2819 if (!ParamLists.empty())
2820 ExpectedTemplateLoc = ParamLists[0]->getTemplateLoc();
2822 ExpectedTemplateLoc = DeclStartLoc;
2824 if (!SuppressDiagnostic)
2825 Diag(DeclLoc, diag::err_template_spec_needs_header)
2832 for (
unsigned TypeIdx = 0, NumTypes = NestedTypes.size(); TypeIdx != NumTypes;
2834 T = NestedTypes[TypeIdx];
2837 bool NeedEmptyTemplateHeader =
false;
2840 bool NeedNonemptyTemplateHeader =
false;
2853 = dyn_cast<ClassTemplatePartialSpecializationDecl>(
Record)) {
2854 ExpectedTemplateParams = Partial->getTemplateParameters();
2855 NeedNonemptyTemplateHeader =
true;
2856 }
else if (
Record->isDependentType()) {
2857 if (
Record->getDescribedClassTemplate()) {
2858 ExpectedTemplateParams =
Record->getDescribedClassTemplate()
2859 ->getTemplateParameters();
2860 NeedNonemptyTemplateHeader =
true;
2863 = dyn_cast<ClassTemplateSpecializationDecl>(
Record)) {
2869 NeedEmptyTemplateHeader =
true;
2872 }
else if (
Record->getTemplateSpecializationKind()) {
2873 if (
Record->getTemplateSpecializationKind()
2875 TypeIdx == NumTypes - 1)
2876 IsMemberSpecialization =
true;
2882 if (
TemplateDecl *Template = TST->getTemplateName().getAsTemplateDecl()) {
2883 ExpectedTemplateParams = Template->getTemplateParameters();
2884 NeedNonemptyTemplateHeader =
true;
2889 NeedNonemptyTemplateHeader =
false;
2899 if (
ParamIdx < ParamLists.size()) {
2900 if (ParamLists[
ParamIdx]->size() == 0) {
2901 if (CheckExplicitSpecialization(ParamLists[
ParamIdx]->getSourceRange(),
2905 SawNonEmptyTemplateParameterList =
true;
2908 if (NeedEmptyTemplateHeader) {
2911 if (TypeIdx == NumTypes - 1)
2912 IsMemberSpecialization =
true;
2914 if (
ParamIdx < ParamLists.size()) {
2915 if (ParamLists[
ParamIdx]->size() > 0) {
2917 if (!SuppressDiagnostic)
2919 diag::err_template_param_list_matches_nontemplate)
2922 ParamLists[
ParamIdx]->getRAngleLoc())
2934 if (DiagnoseMissingExplicitSpecialization(
2941 if (NeedNonemptyTemplateHeader) {
2947 if (
ParamIdx < ParamLists.size() &&
2949 ExpectedTemplateParams =
nullptr;
2954 if (
ParamIdx < ParamLists.size()) {
2956 if (ExpectedTemplateParams &&
2958 ExpectedTemplateParams,
2971 if (!SuppressDiagnostic)
2972 Diag(DeclLoc, diag::err_template_spec_needs_template_parameters)
2983 if (
ParamIdx >= ParamLists.size()) {
2984 if (TemplateId && !IsFriend) {
3000 if (
ParamIdx < ParamLists.size() - 1) {
3001 bool HasAnyExplicitSpecHeader =
false;
3002 bool AllExplicitSpecHeaders =
true;
3003 for (
unsigned I =
ParamIdx,
E = ParamLists.size() - 1; I !=
E; ++I) {
3004 if (ParamLists[I]->size() == 0)
3005 HasAnyExplicitSpecHeader =
true;
3007 AllExplicitSpecHeaders =
false;
3010 if (!SuppressDiagnostic)
3012 AllExplicitSpecHeaders ? diag::ext_template_spec_extra_headers
3013 : diag::err_template_spec_extra_headers)
3015 ParamLists[ParamLists.size() - 2]->getRAngleLoc());
3020 if (ExplicitSpecLoc.
isValid() && HasAnyExplicitSpecHeader &&
3021 !SuppressDiagnostic)
3022 Diag(ExplicitSpecLoc,
3023 diag::note_explicit_template_spec_does_not_need_header)
3024 << NestedTypes.back();
3029 if (!AllExplicitSpecHeaders)
3040 if (ParamLists.back()->size() == 0 &&
3041 CheckExplicitSpecialization(ParamLists[
ParamIdx]->getSourceRange(),
3047 return ParamLists.back();
3051 if (
TemplateDecl *Template = Name.getAsTemplateDecl()) {
3052 Diag(Template->getLocation(), diag::note_template_declared_here)
3053 << (isa<FunctionTemplateDecl>(Template)
3055 : isa<ClassTemplateDecl>(Template)
3057 : isa<VarTemplateDecl>(Template)
3059 : isa<TypeAliasTemplateDecl>(Template) ? 3 : 4)
3060 << Template->getDeclName();
3068 Diag((*I)->getLocation(), diag::note_template_declared_here)
3069 << 0 << (*I)->getDeclName();
3102 return BaseTemplateInst;
3107 switch (Ts.size()) {
3117 return lookUpCommonType(Ts[0], Ts[0]);
3131 return lookUpCommonType(D1, D2);
3136 auto CheckConditionalOperands = [&](
bool ConstRefQual) ->
QualType {
3175 if (
auto Res = CheckConditionalOperands(
false); !Res.isNull())
3188 return CheckConditionalOperands(
true);
3199 for (
auto T : llvm::drop_begin(Ts)) {
3221 QualType OrigType = Converted[1].getAsType();
3225 SemaRef.
Diag(TemplateArgs[1].getLocation(),
3226 diag::err_integer_sequence_integral_element_type);
3241 OrigType, TemplateArgs[1].getLocation())));
3243 if (llvm::APSInt NumArgs = NumArgsArg.
getAsIntegral(); NumArgs >= 0) {
3245 for (llvm::APSInt I(NumArgs.getBitWidth(), NumArgs.isUnsigned());
3249 TA, OrigType, TemplateArgs[2].getLocation()));
3254 SemaRef.
Diag(TemplateArgs[2].getLocation(),
3255 diag::err_integer_sequence_negative_length);
3262 TemplateLoc, SyntheticTemplateArgs);
3269 assert(Converted.size() == 2 &&
3270 "__type_pack_element should be given an index and a parameter pack");
3278 assert(Index >= 0 &&
"the index used with __type_pack_element should be of "
3279 "type std::size_t, and hence be non-negative");
3281 if (Index >= Ts.pack_size()) {
3282 SemaRef.
Diag(TemplateArgs[0].getLocation(),
3283 diag::err_type_pack_element_out_of_bounds);
3288 int64_t N = Index.getExtValue();
3289 return Ts.getPackAsArray()[N].getAsType();
3293 assert(Converted.size() == 4);
3294 if (llvm::any_of(Converted, [](
auto &
C) {
return C.isDependent(); }))
3298 TemplateName BaseTemplate = Converted[0].getAsTemplate();
3299 TemplateName HasTypeMember = Converted[1].getAsTemplate();
3300 QualType HasNoTypeMember = Converted[2].getAsType();
3307 CT, TemplateArgs[1].getLocation())));
3311 return HasNoTypeMember;
3314 llvm_unreachable(
"unexpected BuiltinTemplateDecl!");
3333 if (BinOp->getOpcode() == BO_LAnd) {
3340 Terms.push_back(Clause);
3349 if (!BinOp)
return Cond;
3351 if (BinOp->getOpcode() != BO_LOr)
return Cond;
3354 Expr *LHS = BinOp->getLHS();
3356 if (!InnerBinOp)
return Cond;
3358 if (InnerBinOp->getOpcode() != BO_EQ ||
3359 !isa<IntegerLiteral>(InnerBinOp->getRHS()))
3369 if (MacroName ==
"CONCEPT_REQUIRES" || MacroName ==
"CONCEPT_REQUIRES_")
3370 return BinOp->getRHS();
3380class FailedBooleanConditionPrinterHelper :
public PrinterHelper {
3385 bool handledStmt(
Stmt *
E, raw_ostream &OS)
override {
3386 const auto *DR = dyn_cast<DeclRefExpr>(
E);
3387 if (DR && DR->getQualifier()) {
3390 DR->getQualifier()->print(OS, Policy,
true);
3394 if (
const auto *IV = dyn_cast<VarTemplateSpecializationDecl>(VD)) {
3397 OS, IV->getTemplateArgs().asArray(), Policy,
3398 IV->getSpecializedTemplate()->getTemplateParameters());
3411std::pair<Expr *, std::string>
3420 Expr *FailedCond =
nullptr;
3421 for (
Expr *Term : Terms) {
3425 if (isa<CXXBoolLiteralExpr>(TermAsWritten) ||
3426 isa<IntegerLiteral>(TermAsWritten))
3435 if (Term->EvaluateAsBooleanCondition(Succeeded,
Context) &&
3437 FailedCond = TermAsWritten;
3444 std::string Description;
3446 llvm::raw_string_ostream Out(Description);
3449 FailedBooleanConditionPrinterHelper Helper(Policy);
3450 FailedCond->
printPretty(Out, &Helper, Policy, 0,
"\n",
nullptr);
3452 return { FailedCond, Description };
3459 Name.getUnderlying().getAsDependentTemplateName();
3469 if (Name.getAsAssumedTemplateName() &&
3473 auto [Template, DefaultArgs] = Name.getTemplateDeclAndDefaultArgs();
3475 if (!Template || isa<FunctionTemplateDecl>(Template) ||
3476 isa<VarTemplateDecl>(Template) || isa<ConceptDecl>(Template)) {
3479 if (Name.getAsSubstTemplateTemplateParmPack())
3483 Diag(TemplateLoc, diag::err_template_id_not_a_type)
3493 DefaultArgs,
false, SugaredConverted,
3501 dyn_cast<TypeAliasTemplateDecl>(Template)) {
3516 Template, SugaredConverted,
3517 !
getLangOpts().RetainSubstTemplateTypeParmTypeAstNodes);
3533 std::optional<ContextRAII> SavedContext;
3535 SavedContext.emplace(*
this,
AliasTemplate->getDeclContext());
3540 if (CanonType.
isNull()) {
3546 if (*DeductionInfo &&
3547 (*DeductionInfo)->hasSFINAEDiagnostic() &&
3548 (*DeductionInfo)->peekSFINAEDiagnostic().second.getDiagID() ==
3549 diag::err_typename_nested_not_found_enable_if &&
3550 TemplateArgs[0].getArgument().getKind()
3553 std::string FailedDescription;
3554 std::tie(FailedCond, FailedDescription) =
3560 (*DeductionInfo)->takeSFINAEDiagnostic(OldDiag);
3564 (*DeductionInfo)->addSFINAEDiagnostic(
3566 PDiag(diag::err_typename_nested_not_found_requirement)
3567 << FailedDescription
3575 }
else if (
auto *BTD = dyn_cast<BuiltinTemplateDecl>(Template)) {
3577 TemplateLoc, TemplateArgs);
3578 }
else if (Name.isDependent() ||
3580 TemplateArgs, CanonicalConverted)) {
3589 Name, CanonicalConverted);
3597 if (isa<ClassTemplateDecl>(Template)) {
3600 if (Ctx->isFileContext())
break;
3608 if (!isa<ClassTemplatePartialSpecializationDecl>(
Record) &&
3609 !
Record->getDescribedClassTemplate())
3615 QualType Injected = cast<InjectedClassNameType>(ICNT)
3616 ->getInjectedSpecializationType();
3629 dyn_cast<ClassTemplateDecl>(Template)) {
3632 void *InsertPos =
nullptr;
3634 ClassTemplate->findSpecialization(CanonicalConverted, InsertPos);
3666 assert(isa<RecordType>(CanonType) &&
3667 "type of non-dependent specialization is not a RecordType");
3669 llvm_unreachable(
"Unhandled template kind");
3686 auto *ATN = Name.getAsAssumedTemplateName();
3687 assert(ATN &&
"not an assumed template name");
3688 II = ATN->getDeclName().getAsIdentifierInfo();
3704 assert(ATN &&
"not an assumed template name");
3712 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
3713 return std::make_unique<CandidateCallback>(*
this);
3739 bool IsCtorOrDtorName,
bool IsClassName,
3744 if (!IsCtorOrDtorName && !IsClassName && SS.
isSet()) {
3770 TemplateD, TemplateII, TemplateIILoc, LAngleLoc,
3771 TemplateArgsIn, RAngleLoc);
3778 auto *LookupRD = dyn_cast_or_null<CXXRecordDecl>(LookupCtx);
3779 if (LookupRD && LookupRD->getIdentifier() == TemplateII) {
3782 ? diag::err_out_of_line_qualified_id_type_names_constructor
3783 : diag::ext_out_of_line_qualified_id_type_names_constructor)
3813 for (
unsigned I = 0, N = SpecTL.
getNumArgs(); I != N; ++I)
3830 for (
unsigned i = 0, e = SpecTL.
getNumArgs(); i != e; ++i)
3871 Keyword, DTN->getQualifier(), DTN->getIdentifier(),
3884 for (
unsigned I = 0, N = SpecTL.
getNumArgs(); I != N; ++I)
3895 Diag(TemplateLoc, diag::err_tag_reference_non_tag)
3897 Diag(TAT->getLocation(), diag::note_declared_at);
3909 assert(
Id &&
"templated class must have an identifier");
3913 Diag(TagLoc, diag::err_use_with_wrong_tag)
3928 for (
unsigned i = 0, e = SpecTL.
getNumArgs(); i != e; ++i)
3963 return TPT && !
Type.hasQualifiers() &&
3972 dyn_cast<NonTypeTemplateParmDecl>(DRE->
getDecl());
3978 dyn_cast_or_null<TemplateTemplateParmDecl>(
3982 llvm_unreachable(
"unexpected kind of template argument");
3987 if (Params->
size() != Args.size())
3990 unsigned Depth = Params->
getDepth();
3992 for (
unsigned I = 0, N = Args.size(); I != N; ++I) {
4011template<
typename PartialSpecDecl>
4013 if (Partial->getDeclContext()->isDependentContext())
4022 auto *Template = Partial->getSpecializedTemplate();
4023 S.
Diag(Partial->getLocation(),
4024 diag::ext_partial_spec_not_more_specialized_than_primary)
4025 << isa<VarTemplateDecl>(Template);
4034 diag::note_partial_spec_not_more_specialized_than_primary)
4040 Template->getAssociatedConstraints(TemplateAC);
4041 Partial->getAssociatedConstraints(PartialAC);
4048 const llvm::SmallBitVector &DeducibleParams) {
4049 for (
unsigned I = 0, N = DeducibleParams.size(); I != N; ++I) {
4050 if (!DeducibleParams[I]) {
4063template<
typename PartialSpecDecl>
4065 PartialSpecDecl *Partial) {
4078 auto *TemplateParams = Partial->getTemplateParameters();
4079 llvm::SmallBitVector DeducibleParams(TemplateParams->size());
4081 TemplateParams->getDepth(), DeducibleParams);
4083 if (!DeducibleParams.all()) {
4084 unsigned NumNonDeducible = DeducibleParams.size() - DeducibleParams.count();
4085 S.
Diag(Partial->getLocation(), diag::ext_partial_specs_not_deducible)
4086 << isa<VarTemplatePartialSpecializationDecl>(Partial)
4087 << (NumNonDeducible > 1)
4089 Partial->getTemplateArgsAsWritten()->RAngleLoc);
4110 llvm::SmallBitVector DeducibleParams(TemplateParams->size());
4112 for (
unsigned I = 0; I != TemplateParams->size(); ++I) {
4114 auto *Param = TemplateParams->getParam(I);
4116 DeducibleParams[I] =
true;
4119 if (!DeducibleParams.all()) {
4120 unsigned NumNonDeducible = DeducibleParams.size() - DeducibleParams.count();
4121 Diag(TD->
getLocation(), diag::err_deduction_guide_template_not_deducible)
4122 << (NumNonDeducible > 1);
4133 "Variable template specialization is declared with a template id.");
4146 dyn_cast_or_null<VarTemplateDecl>(Name.getAsTemplateDecl());
4149 if (
auto *OTS = Name.getAsOverloadedTemplate())
4150 FnTemplate = *OTS->begin();
4152 FnTemplate = dyn_cast_or_null<FunctionTemplateDecl>(Name.getAsTemplateDecl());
4154 return Diag(
D.getIdentifierLoc(), diag::err_var_spec_no_template_but_method)
4156 return Diag(
D.getIdentifierLoc(), diag::err_var_spec_no_template)
4160 if (
const auto *DSA =
VarTemplate->getAttr<NoSpecializationsAttr>()) {
4161 auto Message = DSA->getMessage();
4162 Diag(TemplateNameLoc, diag::warn_invalid_specialization)
4164 Diag(DSA->getLoc(), diag::note_marked_here) << DSA;
4168 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
4179 {},
false, SugaredConverted,
4188 TemplateArgs.
size(),
4189 CanonicalConverted))
4194 if (!Name.isDependent() &&
4196 TemplateArgs, CanonicalConverted)) {
4197 Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized)
4203 CanonicalConverted) &&
4210 Diag(TemplateNameLoc, diag::err_partial_spec_args_match_primary_template)
4220 void *InsertPos =
nullptr;
4224 PrevDecl =
VarTemplate->findPartialSpecialization(
4225 CanonicalConverted, TemplateParams, InsertPos);
4227 PrevDecl =
VarTemplate->findSpecialization(CanonicalConverted, InsertPos);
4249 cast_or_null<VarTemplatePartialSpecializationDecl>(PrevDecl);
4254 CanonicalConverted);
4258 VarTemplate->AddPartialSpecialization(Partial, InsertPos);
4297 Diag(TemplateNameLoc, diag::err_specialization_after_instantiation)
4301 diag::note_instantiation_required_here)
4331struct PartialSpecMatchResult {
4341 assert(Template &&
"A variable template id without template?");
4346 Template, TemplateNameLoc,
4348 {},
false, SugaredConverted, CanonicalConverted,
4355 TemplateArgs, CanonicalConverted))
4360 void *InsertPos =
nullptr;
4374 bool AmbiguousPartialSpec =
false;
4400 !Partial->getMostRecentDecl()->isMemberSpecialization())
4415 Matched.push_back(PartialSpecMatchResult());
4416 Matched.back().Partial = Partial;
4421 if (Matched.size() >= 1) {
4423 if (Matched.size() == 1) {
4436 PEnd = Matched.end();
4439 PointOfInstantiation) ==
4447 PEnd = Matched.end();
4450 P->Partial, Best->Partial,
4451 PointOfInstantiation) != Best->Partial) {
4452 AmbiguousPartialSpec =
true;
4459 InstantiationPattern = Best->Partial;
4460 PartialSpecArgs = Best->Args;
4472 Template, InstantiationPattern, PartialSpecArgs, TemplateArgs,
4473 CanonicalConverted, TemplateNameLoc );
4477 if (AmbiguousPartialSpec) {
4480 Diag(PointOfInstantiation, diag::err_partial_spec_ordering_ambiguous)
4485 Diag(
P.Partial->getLocation(), diag::note_partial_spec_match)
4492 dyn_cast<VarTemplatePartialSpecializationDecl>(InstantiationPattern))
4493 Decl->setInstantiationOf(
D, PartialSpecArgs);
4497 assert(
Decl &&
"No variable template specialization?");
4508 if (
Decl.isInvalid())
4525 Diag(
Loc, diag::err_template_missing_args)
4533 bool TemplateKeyword,
4548 assert(NamedConcept &&
"A concept template id without a template?");
4552 NamedConcept, ConceptNameInfo.
getLoc(),
4555 false, SugaredConverted, CanonicalConverted,
4563 CanonicalConverted);
4565 bool AreArgsDependent =
4567 *TemplateArgs, CanonicalConverted);
4575 if (!AreArgsDependent &&
4585 TemplateKWLoc, ConceptNameInfo, FoundDecl, NamedConcept,
4588 Context, CL, CSD, AreArgsDependent ?
nullptr : &Satisfaction);
4607 assert(!R.
isAmbiguous() &&
"ambiguous lookup when building templateid");
4611 if (!TemplateArgs && !isa<FunctionTemplateDecl>(TD)) {
4617 bool KnownDependent =
false;
4626 KnownDependent =
true;
4641 R.
begin(), R.
end(), KnownDependent,
4658 assert(TemplateArgs || TemplateKWLoc.
isValid());
4662 false, TemplateKWLoc))
4691 bool EnteringContext,
4693 bool AllowInjectedClassName) {
4694 if (TemplateKWLoc.
isValid() && S && !S->getTemplateParamParent())
4697 diag::warn_cxx98_compat_template_outside_of_template :
4698 diag::ext_template_outside_of_template)
4708 else if (ObjectType)
4727 bool MemberOfUnknownSpecialization;
4729 ObjectType, EnteringContext,
Result,
4730 MemberOfUnknownSpecialization);
4733 auto *LookupRD = dyn_cast_or_null<CXXRecordDecl>(LookupCtx);
4734 if (!AllowInjectedClassName && SS.
isNotEmpty() && LookupRD &&
4736 Name.Identifier && LookupRD->getIdentifier() == Name.Identifier) {
4746 Diag(Name.getBeginLoc(),
4747 diag::ext_out_of_line_qualified_id_type_names_constructor)
4755 if (!MemberOfUnknownSpecialization) {
4772 Diag(Name.getBeginLoc(), diag::err_no_member)
4775 Diag(Name.getBeginLoc(), diag::err_undeclared_use)
4783 switch (Name.getKind()) {
4791 Qualifier, Name.OperatorFunctionId.Operator));
4805 Diag(Name.getBeginLoc(),
4806 diag::err_template_kw_refers_to_dependent_non_template)
4808 << TemplateKWLoc.
isValid() << TemplateKWLoc;
4845 dyn_cast<DependentScopeDeclRefExpr>(Arg.
getAsExpr())) {
4846 SS.
Adopt(ArgExpr->getQualifierLoc());
4847 NameInfo = ArgExpr->getNameInfo();
4849 dyn_cast<CXXDependentScopeMemberExpr>(Arg.
getAsExpr())) {
4850 if (ArgExpr->isImplicitAccess()) {
4851 SS.
Adopt(ArgExpr->getQualifierLoc());
4852 NameInfo = ArgExpr->getMemberNameInfo();
4861 Result.wasNotFoundInCurrentInstantiation()) {
4862 assert(SS.
getScopeRep() &&
"dependent scope expr must has a scope!");
4866 ? diag::ext_ms_template_type_arg_missing_typename
4867 : diag::err_template_arg_must_be_type_suggest)
4899 SugaredConverted.push_back(Arg);
4900 CanonicalConverted.push_back(Arg);
4906 Diag(SR.
getBegin(), diag::err_template_arg_must_be_type) << SR;
4928 CanonicalConverted.push_back(
4977 for (
unsigned i = 0, e = Param->
getDepth(); i != e; ++i)
4980 bool ForLambdaCallOperator =
false;
4981 if (
const auto *Rec = dyn_cast<CXXRecordDecl>(Template->
getDeclContext()))
4982 ForLambdaCallOperator = Rec->isLambda();
4984 !ForLambdaCallOperator);
5032 for (
unsigned i = 0, e = Param->
getDepth(); i != e; ++i)
5039 TemplateArgLists, Output);
5075 SugaredConverted,
SourceRange(TemplateLoc, RAngleLoc));
5082 for (
unsigned i = 0, e = Param->
getDepth(); i != e; ++i)
5107 HasDefaultArg =
false;
5113 HasDefaultArg =
true;
5116 TypeParm, SugaredConverted,
5117 CanonicalConverted, Output))
5123 = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
5127 HasDefaultArg =
true;
5130 NonTypeParm, SugaredConverted,
5131 CanonicalConverted, Output))
5137 = cast<TemplateTemplateParmDecl>(Param);
5141 HasDefaultArg =
true;
5144 *
this, Template, TemplateLoc, RAngleLoc, TempTempParm, SugaredConverted,
5145 CanonicalConverted, QualifierLoc);
5166 QualLoc = ETLoc.getQualifierLoc();
5167 TLoc = ETLoc.getNamedTypeLoc();
5173 QualLoc, InjLoc.getNameLoc());
5181 dyn_cast<ClassTemplateSpecializationDecl>(RecLoc.getDecl()))
5184 QualLoc, RecLoc.getNameLoc());
5192 unsigned ArgumentPackIndex,
5199 CanonicalConverted);
5206 QualType NTTPType = NTTP->getType();
5207 if (NTTP->isParameterPack() && NTTP->isExpandedParameterPack())
5208 NTTPType = NTTP->getExpansionType(ArgumentPackIndex);
5211 !isa<TemplateTemplateParmDecl>(Template) &&
5226 NTTPType =
SubstType(PET->getPattern(), MLTAL, NTTP->getLocation(),
5227 NTTP->getDeclName());
5229 NTTPType =
SubstType(NTTPType, MLTAL, NTTP->getLocation(),
5230 NTTP->getDeclName());
5237 NTTP->getLocation());
5244 llvm_unreachable(
"Should never see a NULL template argument here");
5251 CanonicalResult, CTAK);
5260 if (Res.
get() !=
E) {
5265 SugaredConverted.push_back(SugaredResult);
5266 CanonicalConverted.push_back(CanonicalResult);
5277 CanonicalConverted.push_back(
5320 SugaredConverted.push_back(SugaredResult);
5321 CanonicalConverted.push_back(CanonicalResult);
5348 Diag(SR.
getBegin(), diag::err_template_arg_nontype_ambig) << SR <<
T;
5350 Diag(SR.
getBegin(), diag::err_template_arg_must_be_expr) << SR;
5356 llvm_unreachable(
"Caller must expand template argument packs");
5387 Template, SugaredConverted,
true),
5406 llvm_unreachable(
"Should never see a NULL template argument here");
5415 CanonicalConverted.push_back(
5431 llvm_unreachable(
"non-type argument with template template parameter");
5434 llvm_unreachable(
"Caller must expand template argument packs");
5441template<
typename TemplateParmDecl>
5444 const TemplateParmDecl *
D,
5449 ->getTemplateParameters()
5450 ->getParam(
D->getIndex()));
5457 D->getDefaultArgumentLoc(), Modules,
5468 S.
Diag(
Loc, diag::err_template_arg_list_different_arity)
5481 bool PartialTemplateArgs,
5485 bool PartialOrderingTTP) {
5504 bool isTemplateTemplateParameter = isa<TemplateTemplateParmDecl>(Template);
5507 unsigned ArgIdx = 0, NumArgs = NewArgs.
size();
5510 ParamEnd = Params->
end(),
5514 if (
size_t ParamIdx = Param - ParamBegin;
5517 assert(ArgIdx == NumArgs &&
"bad default argument deduction");
5520 assert(Param + DefaultArgs.
Args.size() <= ParamEnd);
5523 SugaredConverted.push_back(DefArg);
5524 CanonicalConverted.push_back(
5535 if (*Expansions == SugaredArgumentPack.size()) {
5538 SugaredConverted.push_back(
5540 SugaredArgumentPack.clear();
5542 CanonicalConverted.push_back(
5544 CanonicalArgumentPack.clear();
5549 }
else if (ArgIdx == NumArgs && !PartialTemplateArgs) {
5551 Diag(TemplateLoc, diag::err_template_arg_list_different_arity)
5560 if (ArgIdx < NumArgs) {
5563 RAngleLoc, SugaredArgumentPack.size(),
5564 SugaredConverted, CanonicalConverted,
5568 CanonicalConverted.back().setIsDefaulted(
5571 CanonicalConverted, Params->
getDepth()));
5573 bool PackExpansionIntoNonPack =
5574 NewArgs[ArgIdx].getArgument().isPackExpansion() &&
5580 if (PackExpansionIntoNonPack && !PartialOrderingTTP &&
5581 (isa<TypeAliasTemplateDecl>(Template) ||
5582 isa<ConceptDecl>(Template))) {
5588 Diag(NewArgs[ArgIdx].getLocation(),
5589 diag::err_template_expansion_into_fixed_list)
5590 << (isa<ConceptDecl>(Template) ? 1 : 0)
5591 << NewArgs[ArgIdx].getSourceRange();
5599 if ((*Param)->isTemplateParameterPack()) {
5604 SugaredArgumentPack.push_back(SugaredConverted.pop_back_val());
5605 CanonicalArgumentPack.push_back(CanonicalConverted.pop_back_val());
5614 if (PackExpansionIntoNonPack) {
5615 if (!SugaredArgumentPack.empty()) {
5618 SugaredConverted.insert(SugaredConverted.end(),
5619 SugaredArgumentPack.begin(),
5620 SugaredArgumentPack.end());
5621 SugaredArgumentPack.clear();
5623 CanonicalConverted.insert(CanonicalConverted.end(),
5624 CanonicalArgumentPack.begin(),
5625 CanonicalArgumentPack.end());
5626 CanonicalArgumentPack.clear();
5629 while (ArgIdx < NumArgs) {
5631 SugaredConverted.push_back(Arg);
5632 CanonicalConverted.push_back(
5644 if (PartialTemplateArgs) {
5645 if ((*Param)->isTemplateParameterPack() && !SugaredArgumentPack.empty()) {
5646 SugaredConverted.push_back(
5648 CanonicalConverted.push_back(
5656 if ((*Param)->isTemplateParameterPack()) {
5658 "Should have dealt with this already");
5663 if (Param + 1 != ParamEnd) {
5666 "Concept templates must have parameter packs at the end.");
5670 SugaredConverted.push_back(
5672 SugaredArgumentPack.clear();
5674 CanonicalConverted.push_back(
5676 CanonicalArgumentPack.clear();
5691 Template, TemplateLoc, RAngleLoc, *Param, SugaredConverted,
5692 CanonicalConverted, HasDefaultArg);
5695 if (!HasDefaultArg) {
5700 dyn_cast<NonTypeTemplateParmDecl>(*Param))
5704 cast<TemplateTemplateParmDecl>(*Param),
5722 SugaredConverted, CanonicalConverted,
5726 SugaredConverted.back().setIsDefaulted(
true);
5727 CanonicalConverted.back().setIsDefaulted(
true);
5732 if (isTemplateTemplateParameter)
5746 while (ArgIdx < NumArgs &&
5747 NewArgs[ArgIdx].
getArgument().isPackExpansion()) {
5749 SugaredConverted.push_back(Arg);
5756 if (ArgIdx < NumArgs) {
5757 Diag(TemplateLoc, diag::err_template_arg_list_different_arity)
5768 if (UpdateArgsWithConversions)
5769 TemplateArgs = std::move(NewArgs);
5771 if (!PartialTemplateArgs) {
5778 if (
auto *TD = dyn_cast<TemplateDecl>(NewContext))
5780 auto *RD = dyn_cast<CXXRecordDecl>(NewContext);
5783 if (
const auto *Method =
5785 ThisQuals = Method->getMethodQualifiers();
5791 Template, NewContext,
false, CanonicalConverted,
5808 class UnnamedLocalNoLinkageFinder
5809 :
public TypeVisitor<UnnamedLocalNoLinkageFinder, bool>
5817 UnnamedLocalNoLinkageFinder(
Sema &S,
SourceRange SR) : S(S), SR(SR) { }
5820 return T.isNull() ?
false : inherited::Visit(
T.getTypePtr());
5823#define TYPE(Class, Parent) \
5824 bool Visit##Class##Type(const Class##Type *);
5825#define ABSTRACT_TYPE(Class, Parent) \
5826 bool Visit##Class##Type(const Class##Type *) { return false; }
5827#define NON_CANONICAL_TYPE(Class, Parent) \
5828 bool Visit##Class##Type(const Class##Type *) { return false; }
5829#include "clang/AST/TypeNodes.inc"
5831 bool VisitTagDecl(
const TagDecl *Tag);
5836bool UnnamedLocalNoLinkageFinder::VisitBuiltinType(
const BuiltinType*) {
5840bool UnnamedLocalNoLinkageFinder::VisitComplexType(
const ComplexType*
T) {
5841 return Visit(
T->getElementType());
5844bool UnnamedLocalNoLinkageFinder::VisitPointerType(
const PointerType*
T) {
5848bool UnnamedLocalNoLinkageFinder::VisitBlockPointerType(
5853bool UnnamedLocalNoLinkageFinder::VisitLValueReferenceType(
5858bool UnnamedLocalNoLinkageFinder::VisitRValueReferenceType(
5863bool UnnamedLocalNoLinkageFinder::VisitMemberPointerType(
5868bool UnnamedLocalNoLinkageFinder::VisitConstantArrayType(
5870 return Visit(
T->getElementType());
5873bool UnnamedLocalNoLinkageFinder::VisitIncompleteArrayType(
5875 return Visit(
T->getElementType());
5878bool UnnamedLocalNoLinkageFinder::VisitVariableArrayType(
5880 return Visit(
T->getElementType());
5883bool UnnamedLocalNoLinkageFinder::VisitDependentSizedArrayType(
5885 return Visit(
T->getElementType());
5888bool UnnamedLocalNoLinkageFinder::VisitDependentSizedExtVectorType(
5890 return Visit(
T->getElementType());
5893bool UnnamedLocalNoLinkageFinder::VisitDependentSizedMatrixType(
5895 return Visit(
T->getElementType());
5898bool UnnamedLocalNoLinkageFinder::VisitDependentAddressSpaceType(
5903bool UnnamedLocalNoLinkageFinder::VisitVectorType(
const VectorType*
T) {
5904 return Visit(
T->getElementType());
5907bool UnnamedLocalNoLinkageFinder::VisitDependentVectorType(
5909 return Visit(
T->getElementType());
5912bool UnnamedLocalNoLinkageFinder::VisitExtVectorType(
const ExtVectorType*
T) {
5913 return Visit(
T->getElementType());
5916bool UnnamedLocalNoLinkageFinder::VisitConstantMatrixType(
5918 return Visit(
T->getElementType());
5921bool UnnamedLocalNoLinkageFinder::VisitFunctionProtoType(
5931bool UnnamedLocalNoLinkageFinder::VisitFunctionNoProtoType(
5936bool UnnamedLocalNoLinkageFinder::VisitUnresolvedUsingType(
5941bool UnnamedLocalNoLinkageFinder::VisitTypeOfExprType(
const TypeOfExprType*) {
5945bool UnnamedLocalNoLinkageFinder::VisitTypeOfType(
const TypeOfType*
T) {
5946 return Visit(
T->getUnmodifiedType());
5949bool UnnamedLocalNoLinkageFinder::VisitDecltypeType(
const DecltypeType*) {
5953bool UnnamedLocalNoLinkageFinder::VisitPackIndexingType(
5958bool UnnamedLocalNoLinkageFinder::VisitUnaryTransformType(
5963bool UnnamedLocalNoLinkageFinder::VisitAutoType(
const AutoType *
T) {
5964 return Visit(
T->getDeducedType());
5967bool UnnamedLocalNoLinkageFinder::VisitDeducedTemplateSpecializationType(
5969 return Visit(
T->getDeducedType());
5972bool UnnamedLocalNoLinkageFinder::VisitRecordType(
const RecordType*
T) {
5973 return VisitTagDecl(
T->getDecl());
5976bool UnnamedLocalNoLinkageFinder::VisitEnumType(
const EnumType*
T) {
5977 return VisitTagDecl(
T->getDecl());
5980bool UnnamedLocalNoLinkageFinder::VisitTemplateTypeParmType(
5985bool UnnamedLocalNoLinkageFinder::VisitSubstTemplateTypeParmPackType(
5990bool UnnamedLocalNoLinkageFinder::VisitTemplateSpecializationType(
5995bool UnnamedLocalNoLinkageFinder::VisitInjectedClassNameType(
5997 return VisitTagDecl(
T->getDecl());
6000bool UnnamedLocalNoLinkageFinder::VisitDependentNameType(
6002 return VisitNestedNameSpecifier(
T->getQualifier());
6005bool UnnamedLocalNoLinkageFinder::VisitDependentTemplateSpecializationType(
6007 if (
auto *Q =
T->getQualifier())
6008 return VisitNestedNameSpecifier(Q);
6012bool UnnamedLocalNoLinkageFinder::VisitPackExpansionType(
6014 return Visit(
T->getPattern());
6017bool UnnamedLocalNoLinkageFinder::VisitObjCObjectType(
const ObjCObjectType *) {
6021bool UnnamedLocalNoLinkageFinder::VisitObjCInterfaceType(
6026bool UnnamedLocalNoLinkageFinder::VisitObjCObjectPointerType(
6031bool UnnamedLocalNoLinkageFinder::VisitAtomicType(
const AtomicType*
T) {
6032 return Visit(
T->getValueType());
6035bool UnnamedLocalNoLinkageFinder::VisitPipeType(
const PipeType*
T) {
6039bool UnnamedLocalNoLinkageFinder::VisitBitIntType(
const BitIntType *
T) {
6043bool UnnamedLocalNoLinkageFinder::VisitArrayParameterType(
6045 return VisitConstantArrayType(
T);
6048bool UnnamedLocalNoLinkageFinder::VisitDependentBitIntType(
6053bool UnnamedLocalNoLinkageFinder::VisitTagDecl(
const TagDecl *Tag) {
6054 if (
Tag->getDeclContext()->isFunctionOrMethod()) {
6055 S.
Diag(SR.getBegin(),
6057 diag::warn_cxx98_compat_template_arg_local_type :
6058 diag::ext_template_arg_local_type)
6063 if (!
Tag->hasNameForLinkage()) {
6064 S.
Diag(SR.getBegin(),
6066 diag::warn_cxx98_compat_template_arg_unnamed_type :
6067 diag::ext_template_arg_unnamed_type) << SR;
6068 S.
Diag(
Tag->getLocation(), diag::note_template_unnamed_type_here);
6075bool UnnamedLocalNoLinkageFinder::VisitNestedNameSpecifier(
6093 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
6096bool UnnamedLocalNoLinkageFinder::VisitHLSLAttributedResourceType(
6098 if (
T->hasContainedType() && Visit(
T->getContainedType()))
6100 return Visit(
T->getWrappedType());
6104 assert(ArgInfo &&
"invalid TypeSourceInfo");
6110 return Diag(SR.
getBegin(), diag::err_variably_modified_template_arg) << Arg;
6112 return Diag(SR.
getBegin(), diag::err_template_arg_overload_type) << SR;
6123 UnnamedLocalNoLinkageFinder Finder(*
this, SR);
6124 (void)Finder.Visit(CanonArg);
6141 Decl *Entity =
nullptr) {
6147 if (Entity && Entity->hasAttr<DLLImportAttr>())
6152 "Incomplete parameter type in isNullPointerValueTemplateArgument!");
6165 EvalResult.
Diag = &Notes;
6173 if (Notes.size() == 1 && Notes[0].second.getDiagID() ==
6174 diag::note_invalid_subexpr_in_const_expr) {
6175 DiagLoc = Notes[0].first;
6179 S.
Diag(DiagLoc, diag::err_template_arg_not_address_constant)
6181 for (
unsigned I = 0, N = Notes.size(); I != N; ++I)
6182 S.
Diag(Notes[I].first, Notes[I].second);
6200 bool ObjCLifetimeConversion;
6203 ObjCLifetimeConversion))
6208 S.
Diag(Arg->
getExprLoc(), diag::err_template_arg_wrongtype_null_constant)
6227 std::string Code =
"static_cast<" + ParamType.
getAsString() +
">(";
6228 S.
Diag(Arg->
getExprLoc(), diag::err_template_arg_untyped_null_constant)
6247 bool ObjCLifetimeConversion;
6251 ObjCLifetimeConversion)) {
6256 if (!ParamRef->getPointeeType()->isFunctionType()) {
6266 unsigned ParamQuals = ParamRef->getPointeeType().getCVRQualifiers();
6269 if ((ParamQuals | ArgQuals) != ParamQuals) {
6271 diag::err_template_arg_ref_bind_ignores_quals)
6308 bool AddressTaken =
false;
6315 bool ExtWarnMSTemplateArg =
false;
6318 while (
UnaryOperator *UnOp = dyn_cast<UnaryOperator>(Arg)) {
6320 if (UnOpKind == UO_Deref)
6321 ExtWarnMSTemplateArg =
true;
6322 if (UnOpKind == UO_AddrOf || UnOpKind == UO_Deref) {
6325 FirstOpKind = UnOpKind;
6326 FirstOpLoc = UnOp->getOperatorLoc();
6332 if (ExtWarnMSTemplateArg)
6336 if (FirstOpKind == UO_AddrOf)
6337 AddressTaken =
true;
6341 assert(FirstOpKind == UO_Deref);
6364 bool ExtraParens =
false;
6366 if (!
Invalid && !ExtraParens) {
6369 ? diag::warn_cxx98_compat_template_arg_extra_parens
6370 : diag::ext_template_arg_extra_parens)
6375 Arg =
Parens->getSubExpr();
6379 dyn_cast<SubstNonTypeTemplateParmExpr>(Arg))
6383 if (UnOp->getOpcode() == UO_AddrOf) {
6384 Arg = UnOp->getSubExpr();
6385 AddressTaken =
true;
6386 AddrOpLoc = UnOp->getOperatorLoc();
6391 dyn_cast<SubstNonTypeTemplateParmExpr>(Arg))
6396 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Arg))
6397 Entity = DRE->getDecl();
6399 Entity = CUE->getGuidDecl();
6406 S.
Diag(Arg->
getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
6409 CanonicalConverted =
6426 CanonicalConverted =
6439 if (isa<FieldDecl>(Entity) || isa<IndirectFieldDecl>(Entity)) {
6447 if (
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Entity)) {
6448 if (!Method->isStatic()) {
6457 VarDecl *Var = dyn_cast<VarDecl>(Entity);
6458 MSGuidDecl *Guid = dyn_cast<MSGuidDecl>(Entity);
6461 if (!
Func && !Var && !Guid) {
6473 ? diag::warn_cxx98_compat_template_arg_object_internal
6474 : diag::ext_template_arg_object_internal)
6476 S.
Diag(Entity->
getLocation(), diag::note_template_arg_internal_object)
6481 S.
Diag(Entity->
getLocation(), diag::note_template_arg_internal_object)
6510 S.
Diag(AddrOpLoc, diag::err_template_arg_address_of_non_pointer)
6516 S.
Diag(AddrOpLoc, diag::err_template_arg_address_of_non_pointer)
6558 CanonicalConverted =
6574 Expr *Arg = ResultArg;
6575 bool ObjCLifetimeConversion;
6587 bool ExtraParens =
false;
6589 if (!
Invalid && !ExtraParens) {
6592 ? diag::warn_cxx98_compat_template_arg_extra_parens
6593 : diag::ext_template_arg_extra_parens)
6598 Arg =
Parens->getSubExpr();
6602 dyn_cast<SubstNonTypeTemplateParmExpr>(Arg))
6607 if (UnOp->getOpcode() == UO_AddrOf) {
6608 DRE = dyn_cast<DeclRefExpr>(UnOp->getSubExpr());
6614 else if ((DRE = dyn_cast<DeclRefExpr>(Arg))) {
6617 if (isa<NonTypeTemplateParmDecl>(VD)) {
6620 CanonicalConverted =
6624 CanonicalConverted =
6643 S.
Diag(ResultArg->
getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
6655 ObjCLifetimeConversion)) {
6662 S.
Diag(ResultArg->
getBeginLoc(), diag::err_template_arg_not_convertible)
6670 diag::err_template_arg_not_pointer_to_member_form)
6673 if (isa<FieldDecl>(DRE->
getDecl()) ||
6674 isa<IndirectFieldDecl>(DRE->
getDecl()) ||
6675 isa<CXXMethodDecl>(DRE->
getDecl())) {
6676 assert((isa<FieldDecl>(DRE->
getDecl()) ||
6677 isa<IndirectFieldDecl>(DRE->
getDecl()) ||
6678 cast<CXXMethodDecl>(DRE->
getDecl())
6679 ->isImplicitObjectMemberFunction()) &&
6680 "Only non-static member pointers can make it here");
6686 CanonicalConverted =
6691 CanonicalConverted =
6699 S.
Diag(Arg->
getBeginLoc(), diag::err_template_arg_not_pointer_to_member_form)
6721 auto *AT = dyn_cast<AutoType>(DeducedT);
6722 if (AT && AT->isDecltypeAuto()) {
6733 Expr *DeductionArg = Arg;
6734 if (
auto *PE = dyn_cast<PackExpansionExpr>(DeductionArg))
6735 DeductionArg = PE->getPattern();
6738 if (isa<DeducedTemplateSpecializationType>(DeducedT)) {
6742 DeductionArg->
getBeginLoc(),
false, DeductionArg);
6743 Expr *Inits[1] = {DeductionArg};
6766 diag::err_non_type_template_parm_type_deduction_failure)
6778 if (ParamType.
isNull()) {
6786 "non-type template parameter type cannot be qualified");
6812 Diag(StartLoc, diag::err_deduced_non_type_template_arg_type_mismatch)
6823 auto *PE = dyn_cast<PackExpansionExpr>(Arg);
6825 Arg = PE->getPattern();
6837 PE->getNumExpansions());
6855 if (ParamType->
isRecordType() && isa<DeclRefExpr>(InnerArg) &&
6857 NamedDecl *ND = cast<DeclRefExpr>(InnerArg)->getDecl();
6858 if (
auto *TPO = dyn_cast<TemplateParamObjectDecl>(ND)) {
6861 CanonicalConverted =
6865 if (isa<NonTypeTemplateParmDecl>(ND)) {
6867 CanonicalConverted =
6878 bool IsConvertedConstantExpression =
true;
6879 if (isa<InitListExpr>(Arg) || ParamType->
isRecordType()) {
6882 Expr *Inits[1] = {Arg};
6896 IsConvertedConstantExpression =
false;
6905 if (IsConvertedConstantExpression) {
6918 CanonicalConverted =
6926 false, PreNarrowingValue);
6930 if (
Value.isLValue()) {
6943 isa<LifetimeExtendedTemporaryDecl, UnnamedGlobalConstantDecl>(VD))) {
6949 if (
Value.hasLValuePath() &&
Value.getLValuePath().size() == 1 && VD &&
6951 Value.getLValuePath()[0].getAsArrayIndex() == 0 &&
6956 return ArgResult.
get();
6961 if (!
Value.hasLValuePath() ||
Value.getLValuePath().size() ||
6962 Value.isLValueOnePastTheEnd()) {
6963 Diag(StartLoc, diag::err_non_type_template_arg_subobject)
6968 "null reference should not be a constant expression");
6970 "non-null value of type nullptr_t?");
6974 if (
Value.isAddrLabelDiff())
6975 return Diag(StartLoc, diag::err_non_type_template_arg_addr_label_diff);
6979 return ArgResult.
get();
7017 CanonicalConverted =
7027 IntegerType =
Enum->getDecl()->getIntegerType();
7033 CanonicalConverted =
7041 Arg = ArgResult.
get();
7054 Diag(Arg->
getBeginLoc(), diag::err_template_arg_not_integral_or_enumeral)
7067 return S.
Diag(
Loc, diag::err_template_arg_not_ice) <<
T;
7069 } Diagnoser(ArgType);
7105 CanonicalConverted =
7112 IntegerType =
Enum->getDecl()->getIntegerType();
7119 if (
Value.getBitWidth() != AllowedBits)
7123 llvm::APSInt OldValue =
Value;
7130 if (
Value.getBitWidth() != AllowedBits)
7136 (OldValue.isSigned() && OldValue.isNegative())) {
7144 unsigned RequiredBits;
7146 RequiredBits = OldValue.getActiveBits();
7147 else if (OldValue.isUnsigned())
7148 RequiredBits = OldValue.getActiveBits() + 1;
7150 RequiredBits = OldValue.getSignificantBits();
7151 if (RequiredBits > AllowedBits) {
7161 CanonicalConverted =
7211 *
this, Param, ParamType, Arg, SugaredConverted,
7212 CanonicalConverted))
7218 *
this, Param, ParamType, Arg, SugaredConverted, CanonicalConverted))
7229 "Only object pointers allowed here");
7232 *
this, Param, ParamType, Arg, SugaredConverted, CanonicalConverted))
7244 assert(ParamRefType->getPointeeType()->isIncompleteOrObjectType() &&
7245 "Only object references allowed here");
7249 ParamRefType->getPointeeType(),
7264 *
this, Param, ParamType, Arg, SugaredConverted, CanonicalConverted))
7273 CanonicalConverted =
7281 << Arg->
getType() << ParamType;
7289 Diag(Arg->
getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
7303 *
this, Param, ParamType, Arg, SugaredConverted, CanonicalConverted))
7317 auto [Template, DefaultArgs] = Name.getTemplateDeclAndDefaultArgs();
7320 assert(Name.isDependent() &&
"Non-dependent template isn't a declaration?");
7324 if (Template->isInvalidDecl())
7339 if (!isa<ClassTemplateDecl>(Template) &&
7340 !isa<TemplateTemplateParmDecl>(Template) &&
7341 !isa<TypeAliasTemplateDecl>(Template) &&
7342 !isa<BuiltinTemplateDecl>(Template)) {
7343 assert(isa<FunctionTemplateDecl>(Template) &&
7344 "Only function templates are possible here");
7346 Diag(Template->getLocation(), diag::note_template_arg_refers_here_func)
7359 Template->getTemplateParameters(), Params,
false,
7364 !Template->hasAssociatedConstraints())
7368 Params, Template, DefaultArgs, Arg.
getLocation(), IsDeduced)) {
7378 if (ParamsAC.empty())
7381 Template->getAssociatedConstraints(TemplateAC);
7383 bool IsParamAtLeastAsConstrained;
7385 IsParamAtLeastAsConstrained))
7387 if (!IsParamAtLeastAsConstrained) {
7389 diag::err_template_template_parameter_not_at_least_as_constrained)
7392 Diag(Template->getLocation(), diag::note_entity_declared_at)
7411 unsigned HereDiagID,
7412 unsigned ExternalDiagID) {
7417 llvm::raw_svector_ostream Out(Str);
7425 std::optional<SourceRange> ParamRange) {
7428 diag::note_template_decl_external);
7429 if (ParamRange && ParamRange->isValid()) {
7431 "Parameter range has location when Decl does not");
7438 diag::note_template_param_external);
7461 ? CK_NullToMemberPointer
7462 : CK_NullToPointer);
7465 "Only declaration template arguments permitted here");
7474 (isa<CXXMethodDecl>(VD) || isa<FieldDecl>(VD) ||
7475 isa<IndirectFieldDecl>(VD)));
7503 assert(isa<TemplateParamObjectDecl>(VD) &&
7504 "arg for class template param not a template parameter object");
7509 "unexpected type for decl template argument");
7511 dyn_cast_if_present<NonTypeTemplateParmDecl>(
TemplateParam)) {
7512 QualType TemplateParamType = NTTP->getType();
7526 "value kind mismatch for non-type template argument");
7546 "unexpected conversion required for non-type template argument");
7573 T = ET->getDecl()->getIntegerType();
7624 llvm_unreachable(
"unexpected template argument value");
7649 return MakeInitList(
7662 return MakeInitList(Elts);
7667 llvm_unreachable(
"Unexpected APValue kind.");
7683 llvm_unreachable(
"Unhandled APValue::ValueKind enum");
7695 llvm_unreachable(
"not a non-type template argument");
7713 llvm_unreachable(
"Unhandled TemplateArgument::ArgKind enum");
7720 const NamedDecl *OldInstFrom,
bool Complain,
7725 unsigned NextDiag = diag::err_template_param_different_kind;
7726 if (TemplateArgLoc.
isValid()) {
7727 S.
Diag(TemplateArgLoc, diag::err_template_arg_template_params_mismatch);
7728 NextDiag = diag::note_template_param_different_kind;
7747 unsigned NextDiag = diag::err_template_parameter_pack_non_pack;
7748 if (TemplateArgLoc.
isValid()) {
7749 S.
Diag(TemplateArgLoc,
7750 diag::err_template_arg_template_params_mismatch);
7751 NextDiag = diag::note_template_parameter_pack_non_pack;
7754 unsigned ParamKind = isa<TemplateTypeParmDecl>(New)? 0
7755 : isa<NonTypeTemplateParmDecl>(New)? 1
7768 = dyn_cast<NonTypeTemplateParmDecl>(Old)) {
7776 (!OldNTTP->getType()->isDependentType() &&
7786 unsigned NextDiag = diag::err_template_nontype_parm_different_type;
7787 if (TemplateArgLoc.
isValid()) {
7788 S.
Diag(TemplateArgLoc,
7789 diag::err_template_arg_template_params_mismatch);
7790 NextDiag = diag::note_template_nontype_parm_different_type;
7795 S.
Diag(OldNTTP->getLocation(),
7796 diag::note_template_nontype_parm_prev_declaration)
7797 << OldNTTP->getType();
7808 dyn_cast<TemplateTemplateParmDecl>(Old)) {
7812 OldTTP->getTemplateParameters(), Complain,
7822 !isa<TemplateTemplateParmDecl>(Old)) {
7823 const Expr *NewC =
nullptr, *OldC =
nullptr;
7825 if (isa<TemplateTypeParmDecl>(New)) {
7826 if (
const auto *TC = cast<TemplateTypeParmDecl>(New)->getTypeConstraint())
7827 NewC = TC->getImmediatelyDeclaredConstraint();
7828 if (
const auto *TC = cast<TemplateTypeParmDecl>(Old)->getTypeConstraint())
7829 OldC = TC->getImmediatelyDeclaredConstraint();
7830 }
else if (isa<NonTypeTemplateParmDecl>(New)) {
7831 if (
const Expr *
E = cast<NonTypeTemplateParmDecl>(New)
7832 ->getPlaceholderTypeConstraint())
7834 if (
const Expr *
E = cast<NonTypeTemplateParmDecl>(Old)
7835 ->getPlaceholderTypeConstraint())
7838 llvm_unreachable(
"unexpected template parameter type");
7840 auto Diagnose = [&] {
7842 diag::err_template_different_type_constraint);
7844 diag::note_template_prev_declaration) << 0;
7847 if (!NewC != !OldC) {
7874 unsigned NextDiag = diag::err_template_param_list_different_arity;
7875 if (TemplateArgLoc.
isValid()) {
7876 S.
Diag(TemplateArgLoc, diag::err_template_arg_template_params_mismatch);
7877 NextDiag = diag::note_template_param_list_different_arity;
7909 OldParmEnd = Old->
end();
7910 OldParm != OldParmEnd; ++OldParm) {
7912 !(*OldParm)->isTemplateParameterPack()) {
7913 if (NewParm == NewParmEnd) {
7922 OldInstFrom, Complain, Kind,
7937 for (; NewParm != NewParmEnd; ++NewParm) {
7939 OldInstFrom, Complain, Kind,
7946 if (NewParm != NewParmEnd) {
7961 diag::err_template_different_requires_clause);
7963 diag::note_template_prev_declaration) << 0;
7966 if (!NewRC != !OldRC) {
7991 S = S->getDeclParent();
8001 Diag(LSD->getExternLoc(), diag::note_extern_c_begins_here);
8021 if (RD->isLocalClass())
8023 diag::err_template_inside_local_class)
8031 diag::err_template_outside_namespace_or_class_scope)
8042 return Record->getTemplateSpecializationKind();
8044 return Function->getTemplateSpecializationKind();
8045 if (
VarDecl *Var = dyn_cast<VarDecl>(
D))
8046 return Var->getTemplateSpecializationKind();
8083 if (isa<ClassTemplateDecl>(Specialized))
8085 else if (isa<VarTemplateDecl>(Specialized))
8087 else if (isa<FunctionTemplateDecl>(Specialized))
8089 else if (isa<CXXMethodDecl>(Specialized))
8091 else if (isa<VarDecl>(Specialized))
8093 else if (isa<RecordDecl>(Specialized))
8095 else if (isa<EnumDecl>(Specialized) && S.
getLangOpts().CPlusPlus11)
8098 S.
Diag(
Loc, diag::err_template_spec_unknown_kind)
8108 S.
Diag(
Loc, diag::err_template_spec_decl_function_scope)
8123 : DC->
Equals(SpecializedContext))) {
8124 if (isa<TranslationUnitDecl>(SpecializedContext))
8125 S.
Diag(
Loc, diag::err_template_spec_redecl_global_scope)
8126 << EntityKind << Specialized;
8128 auto *ND = cast<NamedDecl>(SpecializedContext);
8129 int Diag = diag::err_template_spec_redecl_out_of_scope;
8131 Diag = diag::ext_ms_template_spec_redecl_out_of_scope;
8133 << ND << isa<CXXRecordDecl>(ND);
8136 S.
Diag(Specialized->getLocation(), diag::note_specialized_entity);
8150 DependencyChecker Checker(Depth,
true);
8151 Checker.TraverseStmt(
E);
8152 if (Checker.MatchLoc.isInvalid())
8154 return Checker.MatchLoc;
8160 DependencyChecker Checker(Depth,
true);
8161 Checker.TraverseTypeLoc(TL);
8162 if (Checker.MatchLoc.isInvalid())
8164 return Checker.MatchLoc;
8172 for (
unsigned I = 0; I != NumArgs; ++I) {
8175 S, TemplateNameLoc, Param, Args[I].pack_begin(),
8176 Args[I].pack_size(), IsDefaultArgument))
8189 ArgExpr = Expansion->getPattern();
8193 ArgExpr = ICE->getSubExpr();
8203 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ArgExpr))
8204 if (isa<NonTypeTemplateParmDecl>(DRE->getDecl()))
8224 if (ParamUseRange.
isValid()) {
8225 if (IsDefaultArgument) {
8226 S.
Diag(TemplateNameLoc,
8227 diag::err_dependent_non_type_arg_in_partial_spec);
8229 diag::note_dependent_non_type_default_arg_in_partial_spec)
8233 diag::err_dependent_non_type_arg_in_partial_spec)
8241 if (ParamUseRange.
isValid()) {
8243 diag::err_dependent_typed_non_type_arg_in_partial_spec)
8263 for (
unsigned I = 0, N = TemplateParams->
size(); I != N; ++I) {
8265 = dyn_cast<NonTypeTemplateParmDecl>(TemplateParams->
getParam(I));
8270 Param, &TemplateArgs[I],
8271 1, I >= NumExplicit))
8292 = dyn_cast_or_null<ClassTemplateDecl>(Name.getAsTemplateDecl());
8295 Diag(TemplateNameLoc, diag::err_not_class_template_specialization)
8296 << (Name.getAsTemplateDecl() &&
8297 isa<TemplateTemplateParmDecl>(Name.getAsTemplateDecl()));
8301 if (
const auto *DSA =
ClassTemplate->getAttr<NoSpecializationsAttr>()) {
8302 auto Message = DSA->getMessage();
8303 Diag(TemplateNameLoc, diag::warn_invalid_specialization)
8305 Diag(DSA->getLoc(), diag::note_marked_here) << DSA;
8308 if (S->isTemplateParamScope())
8313 bool isMemberSpecialization =
false;
8314 bool isPartialSpecialization =
false;
8319 TemplateNameLoc, &TemplateId,
8331 KWLoc, TemplateNameLoc, SS, &TemplateId, TemplateParameterLists,
8346 if (TemplateParams && TemplateParams->
size() > 0) {
8347 isPartialSpecialization =
true;
8350 Diag(KWLoc, diag::err_partial_specialization_friend)
8358 for (
unsigned I = 0, N = TemplateParams->
size(); I != N; ++I) {
8361 if (TTP->hasDefaultArgument()) {
8362 Diag(TTP->getDefaultArgumentLoc(),
8363 diag::err_default_arg_in_partial_spec);
8364 TTP->removeDefaultArgument();
8367 = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
8368 if (NTTP->hasDefaultArgument()) {
8369 Diag(NTTP->getDefaultArgumentLoc(),
8370 diag::err_default_arg_in_partial_spec)
8371 << NTTP->getDefaultArgument().getSourceRange();
8372 NTTP->removeDefaultArgument();
8378 diag::err_default_arg_in_partial_spec)
8384 }
else if (TemplateParams) {
8386 Diag(KWLoc, diag::err_template_spec_friend)
8393 "should have a 'template<>' for this decl");
8400 "Invalid enum tag in class template spec!");
8404 Diag(KWLoc, diag::err_use_with_wrong_tag)
8409 diag::note_previous_use);
8418 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
8420 isPartialSpecialization
8430 false, SugaredConverted,
8437 if (isPartialSpecialization) {
8439 TemplateArgs.
size(),
8440 CanonicalConverted))
8445 if (!Name.isDependent() &&
8447 TemplateArgs, CanonicalConverted)) {
8448 Diag(TemplateNameLoc, diag::err_partial_spec_fully_specialized)
8450 isPartialSpecialization =
false;
8455 void *InsertPos =
nullptr;
8458 if (isPartialSpecialization)
8460 CanonicalConverted, TemplateParams, InsertPos);
8462 PrevDecl =
ClassTemplate->findSpecialization(CanonicalConverted, InsertPos);
8471 isPartialSpecialization))
8476 if (isPartialSpecialization) {
8481 CanonicalConverted);
8494 Diag(TemplateNameLoc, diag::err_partial_spec_args_match_primary_template)
8502 TemplateParameterLists.data());
8507 = cast_or_null<ClassTemplatePartialSpecializationDecl>(PrevDecl);
8510 Context, Kind, DC, KWLoc, TemplateNameLoc, TemplateParams,
8514 if (TemplateParameterLists.size() > 1 && SS.
isSet()) {
8516 Context, TemplateParameterLists.drop_back(1));
8520 ClassTemplate->AddPartialSpecialization(Partial, InsertPos);
8534 CanonicalConverted, PrevDecl);
8537 if (TemplateParameterLists.size() > 0) {
8539 TemplateParameterLists);
8548 CanonicalConverted);
8572 Diag(TemplateNameLoc, diag::err_specialization_after_instantiation)
8576 diag::note_instantiation_required_here)
8614 if (ModulePrivateLoc.
isValid())
8616 << (isPartialSpecialization? 1 : 0)
8642 Name, TemplateNameLoc, TemplateArgs, CanonType);
8679 diag::err_concept_decls_may_only_appear_in_global_namespace_scope);
8683 if (TemplateParameterLists.size() > 1) {
8684 Diag(NameLoc, diag::err_concept_extra_headers);
8690 if (Params->
size() == 0) {
8691 Diag(NameLoc, diag::err_concept_no_parameters);
8698 ParamEnd = Params->
end();
8699 ParamIt != ParamEnd; ++ParamIt) {
8700 Decl const *Param = *ParamIt;
8702 if (++ParamIt == ParamEnd)
8705 diag::err_template_param_pack_must_be_last_template_parameter);
8716 Diag(NameLoc, diag::err_concept_no_associated_constraints);
8753 Expr *ConstraintExpr,
8755 assert(!
C->hasDefinition() &&
"Concept already defined");
8758 C->setDefinition(ConstraintExpr);
8769 bool AddToScope =
true;
8773 if (!WasAlreadyAdded && AddToScope)
8786 auto *OldConcept = dyn_cast<ConceptDecl>(
Previous.getRepresentativeDecl()->getUnderlyingDecl());
8788 auto *Old =
Previous.getRepresentativeDecl();
8798 Diag(NewDecl->
getLocation(), diag::err_redefinition_different_concept)
8825 Diag(
Concept->getLocation(), diag::note_declared_at);
8834 if (MinGW || (isa<FunctionDecl>(
D) &&
8835 cast<FunctionDecl>(
D)->isFunctionTemplateSpecialization()))
8836 D->
dropAttrs<DLLImportAttr, DLLExportAttr>();
8839 FD->setInlineSpecified(
false);
8851 Prev = Prev->getPreviousDecl()) {
8852 PrevDiagLoc = Prev->getLocation();
8854 assert(PrevDiagLoc.
isValid() &&
8855 "Explicit instantiation without point of instantiation?");
8865 bool &HasNoEffect) {
8866 HasNoEffect =
false;
8873 "previous declaration must be implicit!");
8886 if (PrevPointOfInstantiation.
isInvalid()) {
8900 PrevPointOfInstantiation.
isValid()) &&
8901 "Explicit instantiation without point of instantiation?");
8915 Diag(NewLoc, diag::err_specialization_after_instantiation)
8917 Diag(PrevPointOfInstantiation, diag::note_instantiation_required_here)
8922 llvm_unreachable(
"The switch over PrevTSK must be exhaustive.");
8952 diag::err_explicit_instantiation_declaration_after_definition);
8958 diag::note_explicit_instantiation_definition_here);
8962 llvm_unreachable(
"Unexpected TemplateSpecializationKind!");
8978 Diag(NewLoc, diag::warn_explicit_instantiation_after_specialization)
8981 diag::note_previous_template_specialization);
9012 ? diag::ext_explicit_instantiation_duplicate
9013 : diag::err_explicit_instantiation_duplicate)
9016 diag::note_previous_explicit_instantiation);
9022 llvm_unreachable(
"Missing specialization/instantiation case?");
9032 enum DiscardReason { NotAFunctionTemplate, NotAMemberOfEnclosing };
9036 if (!isa<FunctionTemplateDecl>(
D)) {
9038 DiscardedCandidates.push_back(std::make_pair(NotAFunctionTemplate,
D));
9045 DiscardedCandidates.push_back(std::make_pair(NotAMemberOfEnclosing,
D));
9053 Diag(FD->
getLocation(), diag::err_dependent_function_template_spec_no_match)
9055 for (
auto &
P : DiscardedCandidates)
9056 Diag(
P.second->getLocation(),
9057 diag::note_dependent_function_template_spec_discard_reason)
9058 <<
P.first << IsFriend;
9063 ExplicitTemplateArgs);
9076 llvm::SmallDenseMap<FunctionDecl *, TemplateArgumentListInfo, 8>
9077 ConvertedTemplateArgs;
9100 if (
auto *NewMD = dyn_cast<CXXMethodDecl>(FD);
9101 !
getLangOpts().CPlusPlus14 && NewMD && NewMD->isConstexpr() &&
9102 !isa<CXXConstructorDecl, CXXDestructorDecl>(NewMD)) {
9103 auto *OldMD = dyn_cast<CXXMethodDecl>(FunTmpl->getTemplatedDecl());
9104 if (OldMD && OldMD->isConst()) {
9114 if (ExplicitTemplateArgs)
9115 Args = *ExplicitTemplateArgs;
9127 cast<FunctionTemplateDecl>(FunTmpl->getFirstDecl()),
9128 ExplicitTemplateArgs ? &Args :
nullptr, FT,
Specialization, Info);
9133 I.getPair(), FunTmpl->getTemplatedDecl(),
9149 I.getPair(), FunTmpl->getTemplatedDecl(),
9156 if (ExplicitTemplateArgs)
9165 if (QualifiedFriend && Candidates.
empty()) {
9171 if (
auto *OldFD = dyn_cast<FunctionDecl>(OldND->getUnderlyingDecl()))
9182 PDiag(diag::err_function_template_spec_ambiguous)
9183 << FD->
getDeclName() << (ExplicitTemplateArgs !=
nullptr),
9184 PDiag(diag::note_function_template_spec_matched));
9193 const auto *DSA = PT->getAttr<NoSpecializationsAttr>()) {
9194 auto Message = DSA->getMessage();
9196 << PT << !Message.empty() << Message;
9197 Diag(DSA->getLoc(), diag::note_marked_here) << DSA;
9225 auto *SpecializationFPT =
9236 assert(SpecInfo &&
"Function template specialization info missing?");
9274 bool HasNoEffect =
false;
9300 "This must be the only existing declaration of this specialization");
9315 FD->setFunctionTemplateSpecialization(
9318 ExplicitTemplateArgs ? &ConvertedTemplateArgs[
Specialization] :
nullptr);
9337 assert(!
Member->isTemplateDecl() && !
Member->getDescribedTemplate() &&
9338 "Only for non-template members");
9341 NamedDecl *FoundInstantiation =
nullptr;
9351 auto *Method = dyn_cast<CXXMethodDecl>(Candidate->getUnderlyingDecl());
9369 Method->getTrailingRequiresClause() &&
9373 !Satisfaction.IsSatisfied))
9376 Candidates.
addDecl(Candidate);
9380 if (Candidates.
empty())
9389 auto *Method = cast<CXXMethodDecl>(I->getUnderlyingDecl());
9393 BestMethod = Method;
9397 FoundInstantiation = *Best;
9398 Instantiation = BestMethod;
9403 bool Ambiguous =
false;
9406 auto *Method = cast<CXXMethodDecl>(I->getUnderlyingDecl());
9415 Diag(
Member->getLocation(), diag::err_function_member_spec_ambiguous)
9416 <<
Member << (InstantiatedFrom ? InstantiatedFrom : Instantiation);
9417 for (
NamedDecl *Candidate : Candidates) {
9418 Candidate = Candidate->getUnderlyingDecl();
9419 Diag(Candidate->getLocation(), diag::note_function_member_spec_matched)
9424 }
else if (isa<VarDecl>(
Member)) {
9427 (PrevVar = dyn_cast<VarDecl>(
Previous.getFoundDecl())))
9429 FoundInstantiation =
Previous.getRepresentativeDecl();
9430 Instantiation = PrevVar;
9434 }
else if (isa<RecordDecl>(
Member)) {
9437 (PrevRecord = dyn_cast<CXXRecordDecl>(
Previous.getFoundDecl()))) {
9438 FoundInstantiation =
Previous.getRepresentativeDecl();
9439 Instantiation = PrevRecord;
9443 }
else if (isa<EnumDecl>(
Member)) {
9446 (PrevEnum = dyn_cast<EnumDecl>(
Previous.getFoundDecl()))) {
9447 FoundInstantiation =
Previous.getRepresentativeDecl();
9448 Instantiation = PrevEnum;
9454 if (!Instantiation) {
9468 if (InstantiatedFrom && isa<CXXMethodDecl>(
Member)) {
9469 cast<CXXMethodDecl>(
Member)->setInstantiationOfMemberFunction(
9470 cast<CXXMethodDecl>(InstantiatedFrom),
9472 }
else if (InstantiatedFrom && isa<CXXRecordDecl>(
Member)) {
9473 cast<CXXRecordDecl>(
Member)->setInstantiationOfMemberClass(
9474 cast<CXXRecordDecl>(InstantiatedFrom),
9479 Previous.addDecl(FoundInstantiation);
9484 if (!InstantiatedFrom) {
9485 Diag(
Member->getLocation(), diag::err_spec_member_not_instantiated)
9497 assert(MSInfo &&
"Member specialization info missing?");
9499 bool HasNoEffect =
false;
9511 Instantiation,
Member->getLocation(),
9517 if (
auto *MemberFunction = dyn_cast<FunctionDecl>(
Member)) {
9518 FunctionDecl *InstantiationFunction = cast<FunctionDecl>(Instantiation);
9523 if (InstantiationFunction->
isDeleted()) {
9526 InstantiationFunction);
9532 MemberFunction->setInstantiationOfMemberFunction(
9534 }
else if (
auto *MemberVar = dyn_cast<VarDecl>(
Member)) {
9535 MemberVar->setInstantiationOfStaticDataMember(
9537 }
else if (
auto *MemberClass = dyn_cast<CXXRecordDecl>(
Member)) {
9538 MemberClass->setInstantiationOfMemberClass(
9540 }
else if (
auto *MemberEnum = dyn_cast<EnumDecl>(
Member)) {
9541 MemberEnum->setInstantiationOfMemberEnum(
9544 llvm_unreachable(
"unknown member specialization kind");
9550 Previous.addDecl(FoundInstantiation);
9559template<
typename DeclT>
9570 OrigD->setLocation(
Loc);
9575 NamedDecl *Instantiation = cast<NamedDecl>(
Member->getCanonicalDecl());
9576 if (Instantiation ==
Member)
9579 if (
auto *
Function = dyn_cast<CXXMethodDecl>(Instantiation))
9581 else if (
auto *Var = dyn_cast<VarDecl>(Instantiation))
9583 else if (
auto *
Record = dyn_cast<CXXRecordDecl>(Instantiation))
9585 else if (
auto *
Enum = dyn_cast<EnumDecl>(Instantiation))
9588 llvm_unreachable(
"unknown member specialization kind");
9596 bool WasQualifiedName) {
9601 S.
Diag(InstLoc, diag::err_explicit_instantiation_in_class)
9614 if (WasQualifiedName) {
9615 if (CurContext->
Encloses(OrigContext))
9622 if (
NamespaceDecl *NS = dyn_cast<NamespaceDecl>(OrigContext)) {
9623 if (WasQualifiedName)
9626 diag::err_explicit_instantiation_out_of_scope :
9627 diag::warn_explicit_instantiation_out_of_scope_0x)
9632 diag::err_explicit_instantiation_unqualified_wrong_namespace :
9633 diag::warn_explicit_instantiation_unqualified_wrong_namespace_0x)
9638 diag::err_explicit_instantiation_must_be_global :
9639 diag::warn_explicit_instantiation_must_be_global_0x)
9648 bool WasQualifiedName,
9655 S.
Diag(InstLoc, diag::err_explicit_instantiation_internal_linkage) <<
D;
9683 if (isa<TemplateSpecializationType>(
T))
9693 auto *A = cast_or_null<InheritableAttr>(
getDLLAttr(Def));
9694 assert(A &&
"dllExportImportClassTemplateSpecialization called "
9695 "on Def without dllexport or dllimport");
9700 "delayed exports present at explicit instantiation");
9704 for (
auto &B : Def->
bases()) {
9705 if (
auto *BT = dyn_cast_or_null<ClassTemplateSpecializationDecl>(
9706 B.getType()->getAsCXXRecordDecl()))
9726 "Invalid enum tag in class template explicit instantiation!");
9732 Diag(TemplateNameLoc, diag::err_tag_reference_non_tag)
9733 << TD << NTK << llvm::to_underlying(Kind);
9741 Diag(KWLoc, diag::err_use_with_wrong_tag)
9746 diag::note_previous_use);
9763 if (AL.getKind() == ParsedAttr::AT_DLLExport) {
9765 diag::warn_attribute_dllexport_explicit_instantiation_decl);
9766 Diag(AL.getLoc(), diag::note_attribute);
9771 if (
auto *A =
ClassTemplate->getTemplatedDecl()->getAttr<DLLExportAttr>()) {
9773 diag::warn_attribute_dllexport_explicit_instantiation_decl);
9774 Diag(A->getLocation(), diag::note_attribute);
9780 bool DLLImportExplicitInstantiationDef =
false;
9785 ClassTemplate->getTemplatedDecl()->getAttr<DLLImportAttr>();
9787 if (AL.getKind() == ParsedAttr::AT_DLLImport)
9789 if (AL.getKind() == ParsedAttr::AT_DLLExport) {
9797 DLLImportExplicitInstantiationDef =
true;
9809 {},
false, SugaredConverted,
9816 void *InsertPos =
nullptr;
9818 ClassTemplate->findSpecialization(CanonicalConverted, InsertPos);
9828 if (AL.getKind() == ParsedAttr::AT_DLLExport) {
9830 diag::warn_attribute_dllexport_explicit_instantiation_def);
9842 bool HasNoEffect =
false;
9845 PrevDecl, PrevDecl_TSK,
9866 DLLImportExplicitInstantiationDef) {
9868 HasNoEffect =
false;
9883 if (
const auto *A = PrevDecl->
getAttr<MSInheritanceAttr>()) {
9885 Clone->setInherited(
true);
9891 if (!HasNoEffect && !PrevDecl) {
9904 bool PreviouslyDLLExported =
Specialization->hasAttr<DLLExportAttr>();
9929 = cast_or_null<ClassTemplateSpecializationDecl>(
9939 Def = cast_or_null<ClassTemplateSpecializationDecl>(
9947 DLLImportExplicitInstantiationDef)) {
9956 auto *A = cast<InheritableAttr>(
9958 A->setInherited(
true);
9966 bool NewlyDLLExported =
9967 !PreviouslyDLLExported &&
Specialization->hasAttr<DLLExportAttr>();
9983 "Def and Specialization should match for implicit instantiation");
9991 PrevDecl->
hasAttr<DLLExportAttr>()) {
10015 bool Owned =
false;
10016 bool IsDependent =
false;
10024 assert(!IsDependent &&
"explicit instantiation of dependent name not yet handled");
10029 TagDecl *Tag = cast<TagDecl>(TagD);
10030 assert(!Tag->isEnum() &&
"shouldn't see enumerations here");
10032 if (Tag->isInvalidDecl())
10038 Diag(TemplateLoc, diag::err_explicit_instantiation_nontemplate_type)
10040 Diag(
Record->getLocation(), diag::note_nontemplate_decl_here);
10051 Diag(TemplateLoc, diag::ext_explicit_instantiation_without_qualified_id)
10066 = cast_or_null<CXXRecordDecl>(
Record->getPreviousDecl());
10071 bool HasNoEffect =
false;
10072 assert(MSInfo &&
"No member specialization information?");
10084 = cast_or_null<CXXRecordDecl>(
Record->getDefinition());
10092 Diag(TemplateLoc, diag::err_explicit_instantiation_undefined_member)
10093 << 0 <<
Record->getDeclName() <<
Record->getDeclContext();
10103 RecordDef = cast_or_null<CXXRecordDecl>(
Record->getDefinition());
10132 if (!
D.isInvalidType())
10134 diag::err_explicit_instantiation_requires_name)
10141 S = S->getDeclParent();
10153 Diag(
D.getIdentifierLoc(), diag::err_explicit_instantiation_of_typedef)
10156 }
else if (
D.getDeclSpec().getStorageClassSpec()
10159 Diag(
D.getIdentifierLoc(), diag::err_explicit_instantiation_storage_class)
10162 D.getMutableDeclSpec().ClearStorageClassSpecs();
10170 if (
D.getDeclSpec().isInlineSpecified())
10171 Diag(
D.getDeclSpec().getInlineSpecLoc(),
10173 diag::err_explicit_instantiation_inline :
10174 diag::warn_explicit_instantiation_inline_0x)
10179 Diag(
D.getDeclSpec().getConstexprSpecLoc(),
10180 diag::err_explicit_instantiation_constexpr);
10185 Diag(
D.getDeclSpec().
getBeginLoc(), diag::err_deduction_guide_specialized)
10216 if (!PrevTemplate) {
10219 Diag(
D.getIdentifierLoc(), diag::err_explicit_instantiation_not_known)
10223 Diag((*P)->getLocation(), diag::note_explicit_instantiation_here);
10229 Diag(
D.getIdentifierLoc(),
10230 diag::err_explicit_instantiation_data_member_not_instantiated)
10245 Diag(
T->getTypeLoc().getBeginLoc(),
10246 diag::err_auto_not_allowed_var_inst);
10254 Diag(
D.getIdentifierLoc(),
10255 diag::err_explicit_instantiation_without_template_id)
10257 Diag(PrevTemplate->getLocation(),
10258 diag::note_explicit_instantiation_here);
10267 D.getIdentifierLoc(), TemplateArgs);
10275 Diag(
D.getIdentifierLoc(), diag::err_explicit_instantiation_dependent);
10281 Prev = cast<VarDecl>(Res.
get());
10295 Diag(
D.getIdentifierLoc(),
10296 diag::ext_explicit_instantiation_without_qualified_id)
10297 << Prev <<
D.getCXXScopeSpec().getRange();
10304 bool HasNoEffect =
false;
10306 PrevTSK, POI, HasNoEffect))
10309 if (!HasNoEffect) {
10312 if (
auto *VTSD = dyn_cast<VarTemplatePartialSpecializationDecl>(Prev)) {
10313 VTSD->setExternKeywordLoc(ExternLoc);
10314 VTSD->setTemplateKeywordLoc(TemplateLoc);
10328 Diag(
T->getTypeLoc().getBeginLoc(),
10329 diag::err_invalid_var_template_spec_type)
10330 << 0 << PrevTemplate << R << Prev->
getType();
10331 Diag(PrevTemplate->getLocation(), diag::note_template_declared_here)
10332 << 2 << PrevTemplate->getDeclName();
10337 return (
Decl*)
nullptr;
10342 bool HasExplicitTemplateArgs =
false;
10346 HasExplicitTemplateArgs =
true;
10361 if (!HasExplicitTemplateArgs) {
10362 if (
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Prev)) {
10366 if (Method->getPrimaryTemplate()) {
10367 TemplateMatches.
addDecl(Method,
P.getAccess());
10370 C.FoundDecl =
P.getPair();
10371 C.Function = Method;
10374 if (Method->getTrailingRequiresClause() &&
10393 FunTmpl, (HasExplicitTemplateArgs ? &TemplateArgs :
nullptr), R,
10424 if (!NonTemplateMatches.
empty()) {
10435 Msg = diag::err_explicit_instantiation_ambiguous;
10439 Msg = diag::err_explicit_instantiation_no_candidate;
10455 TemplateMatches.
begin(), TemplateMatches.
end(),
10456 FailedTemplateCandidates,
D.getIdentifierLoc(),
10457 PDiag(diag::err_explicit_instantiation_not_known) << Name,
10458 PDiag(diag::err_explicit_instantiation_ambiguous) << Name,
10459 PDiag(diag::note_explicit_instantiation_candidate));
10475 if (FPT->hasExceptionSpec()) {
10477 diag::err_mismatched_exception_spec_explicit_instantiation;
10479 DiagID = diag::ext_mismatched_exception_spec_explicit_instantiation;
10482 PDiag(diag::note_explicit_instantiation_here),
10492 Diag(
D.getIdentifierLoc(),
10493 diag::err_explicit_instantiation_member_function_not_instantiated)
10502 if (!PrevDecl &&
Specialization->isThisDeclarationADefinition())
10506 bool HasNoEffect =
false;
10517 return (
Decl*)
nullptr;
10528 if (
auto *RD = dyn_cast<CXXRecordDecl>(
Specialization->getDeclContext()))
10529 if (RD->getIdentifier() && RD->getIdentifier()->isStr(
"valarray") &&
10530 RD->isInStdNamespace())
10531 return (
Decl*)
nullptr;
10544 Specialization->setTemplateSpecializationKind(TSK,
D.getIdentifierLoc());
10562 D.getCXXScopeSpec().isSet() &&
10564 Diag(
D.getIdentifierLoc(),
10565 diag::ext_explicit_instantiation_without_qualified_id)
10572 D.getIdentifierLoc(),
D.getCXXScopeSpec().isSet(), TSK);
10575 return (
Decl*)
nullptr;
10584 assert(Name &&
"Expected a name in a dependent tag");
10593 Diag(NameLoc, diag::err_dependent_tag_decl)
10620 if (TypenameLoc.
isValid() && S && !S->getTemplateParamParent())
10623 diag::warn_cxx98_compat_typename_outside_of_template :
10624 diag::ext_typename_outside_of_template)
10634 TypenameLoc, QualifierLoc, II, IdLoc, &TSI,
10648 if (TypenameLoc.
isValid() && S && !S->getTemplateParamParent())
10651 diag::warn_cxx98_compat_typename_outside_of_template :
10652 diag::ext_typename_outside_of_template)
10660 if (LookupRD && LookupRD->getIdentifier() == TemplateII) {
10661 Diag(TemplateIILoc,
10662 diag::ext_out_of_line_qualified_id_type_names_constructor)
10664 << (TemplateKWLoc.
isValid() ? 1 : 0 );
10675 assert(DTN &&
"dependent template has non-dependent name?");
10678 if (!DTN->isIdentifier()) {
10679 Diag(TemplateIILoc, diag::err_template_id_not_a_type) << Template;
10686 DTN->getIdentifier(), TemplateArgs.
arguments());
10698 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
10715 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
10733 if (!II.
isStr(
"type"))
10742 if (!EnableIfTSTLoc || EnableIfTSTLoc.
getNumArgs() == 0)
10755 if (!EnableIfII || !EnableIfII->
isStr(
"enable_if"))
10783 bool DeducedTSTContext) {
10785 DeducedTSTContext);
10790 if (isa<DependentNameType>(
T)) {
10814 SS.
Adopt(QualifierLoc);
10817 if (QualifierLoc) {
10844 unsigned DiagID = 0;
10845 Decl *Referenced =
nullptr;
10846 switch (
Result.getResultKind()) {
10851 Expr *Cond =
nullptr;
10852 if (Ctx &&
isEnableIf(QualifierLoc, II, CondRange, Cond)) {
10857 std::string FailedDescription;
10858 std::tie(FailedCond, FailedDescription) =
10862 diag::err_typename_nested_not_found_requirement)
10863 << FailedDescription
10869 diag::err_typename_nested_not_found_enable_if)
10870 << Ctx << CondRange;
10874 DiagID = Ctx ? diag::err_typename_nested_not_found
10875 : diag::err_unknown_typename;
10884 Diag(IILoc, diag::err_typename_refers_to_using_value_decl)
10885 << Name << Ctx << FullRange;
10887 = dyn_cast<UnresolvedUsingValueDecl>(
Result.getRepresentativeDecl())){
10889 Diag(
Loc, diag::note_using_value_decl_missing_typename)
10919 auto *LookupRD = dyn_cast_or_null<CXXRecordDecl>(Ctx);
10920 auto *FoundRD = dyn_cast<CXXRecordDecl>(
Type);
10922 FoundRD->isInjectedClassName() &&
10924 Diag(IILoc, diag::ext_out_of_line_qualified_id_type_names_constructor)
10941 if (!DeducedTSTContext) {
10946 Diag(IILoc, diag::err_dependent_deduced_tst)
10949 Diag(IILoc, diag::err_deduced_tst)
10961 DiagID = Ctx ? diag::err_typename_nested_not_type
10962 : diag::err_typename_not_type;
10963 Referenced =
Result.getFoundDecl();
10967 DiagID = Ctx ? diag::err_typename_nested_not_type
10968 : diag::err_typename_not_type;
10969 Referenced = *
Result.begin();
10981 Diag(IILoc, DiagID) << FullRange << Name << Ctx;
10983 Diag(IILoc, DiagID) << FullRange << Name;
10986 Ctx ? diag::note_typename_member_refers_here
10987 : diag::note_typename_refers_here)
10994 class CurrentInstantiationRebuilder
11002 CurrentInstantiationRebuilder(
Sema &SemaRef,
11006 Loc(
Loc), Entity(Entity) { }
11028 this->Entity = Entity;
11044 CurrentInstantiationRebuilder Rebuilder(*
this,
Loc, Name);
11045 return Rebuilder.TransformType(
T);
11049 CurrentInstantiationRebuilder Rebuilder(*
this,
E->
getExprLoc(),
11051 return Rebuilder.TransformExpr(
E);
11062 = Rebuilder.TransformNestedNameSpecifierLoc(QualifierLoc);
11072 for (
unsigned I = 0, N = Params->
size(); I != N; ++I) {
11076 if (isa<TemplateTypeParmDecl>(Param))
11081 = dyn_cast<TemplateTemplateParmDecl>(Param)) {
11083 TTP->getTemplateParameters()))
11125 unsigned NumArgs) {
11127 llvm::raw_svector_ostream Out(Str);
11129 if (!Params || Params->
size() == 0 || NumArgs == 0)
11130 return std::string();
11132 for (
unsigned I = 0, N = Params->
size(); I != N; ++I) {
11142 Out <<
Id->getName();
11154 return std::string(Out.str());
11162 auto LPT = std::make_unique<LateParsedTemplate>();
11165 LPT->Toks.swap(Toks);
11212class ExplicitSpecializationVisibilityChecker {
11224 if (
auto *FD = dyn_cast<FunctionDecl>(ND))
11225 return checkImpl(FD);
11226 if (
auto *RD = dyn_cast<CXXRecordDecl>(ND))
11227 return checkImpl(RD);
11228 if (
auto *VD = dyn_cast<VarDecl>(ND))
11229 return checkImpl(VD);
11230 if (
auto *ED = dyn_cast<EnumDecl>(ND))
11231 return checkImpl(ED);
11235 void diagnose(
NamedDecl *
D,
bool IsPartialSpec) {
11236 auto Kind = IsPartialSpec ? Sema::MissingImportKind::PartialSpecialization
11237 : Sema::MissingImportKind::ExplicitSpecialization;
11238 const bool Recover =
true;
11243 if (Modules.empty())
11249 bool CheckMemberSpecialization(
const NamedDecl *
D) {
11250 return Kind == Sema::AcceptableKind::Visible
11255 bool CheckExplicitSpecialization(
const NamedDecl *
D) {
11256 return Kind == Sema::AcceptableKind::Visible
11278 template<
typename SpecDecl>
11279 void checkImpl(SpecDecl *Spec) {
11280 bool IsHiddenExplicitSpecialization =
false;
11282 IsHiddenExplicitSpecialization = Spec->getMemberSpecializationInfo()
11283 ? !CheckMemberSpecialization(Spec)
11284 : !CheckExplicitSpecialization(Spec);
11286 checkInstantiated(Spec);
11289 if (IsHiddenExplicitSpecialization)
11290 diagnose(Spec->getMostRecentDecl(),
false);
11299 auto *SD = dyn_cast<ClassTemplateSpecializationDecl>(RD);
11303 auto From = SD->getSpecializedTemplateOrPartial();
11306 else if (
auto *TD =
11308 if (!CheckDeclaration(TD))
11309 diagnose(TD,
true);
11314 void checkInstantiated(
VarDecl *RD) {
11315 auto *SD = dyn_cast<VarTemplateSpecializationDecl>(RD);
11319 auto From = SD->getSpecializedTemplateOrPartial();
11322 else if (
auto *TD =
11324 if (!CheckDeclaration(TD))
11325 diagnose(TD,
true);
11330 void checkInstantiated(
EnumDecl *FD) {}
11332 template<
typename TemplDecl>
11333 void checkTemplate(TemplDecl *TD) {
11334 if (TD->isMemberSpecialization()) {
11335 if (!CheckMemberSpecialization(TD))
11336 diagnose(TD->getMostRecentDecl(),
false);
11346 ExplicitSpecializationVisibilityChecker(*
this,
Loc,
11356 ExplicitSpecializationVisibilityChecker(*
this,
Loc,
11364 if (
const auto *FD = dyn_cast<FunctionDecl>(N)) {
11372 if (!CSC.isInstantiationRecord() || CSC.PointOfInstantiation.isInvalid())
11374 return CSC.PointOfInstantiation;
Defines the clang::ASTContext interface.
Defines enum values for all the target-independent builtin functions.
enum clang::sema::@1712::IndirectLocalPathEntry::EntryKind Kind
static Decl::Kind getKind(const Decl *D)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::LangOptions interface.
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.
llvm::MachO::Record Record
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
MatchFinder::MatchResult MatchResult
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
This file declares semantic analysis for CUDA constructs.
static void SetNestedNameSpecifier(Sema &S, DeclaratorDecl *DD, Declarator &D)
static bool DependsOnTemplateParameters(QualType T, TemplateParameterList *Params)
Determines whether a given type depends on the given parameter list.
static TemplateSpecializationKind getTemplateSpecializationKind(Decl *D)
Determine what kind of template specialization the given declaration is.
static Expr * BuildExpressionFromNonTypeTemplateArgumentValue(Sema &S, QualType T, const APValue &Val, SourceLocation Loc)
static void maybeDiagnoseTemplateParameterShadow(Sema &SemaRef, Scope *S, SourceLocation Loc, const IdentifierInfo *Name)
static TemplateArgumentLoc convertTypeTemplateArgumentToTemplate(ASTContext &Context, TypeLoc TLoc)
Convert a template-argument that we parsed as a type into a template, if possible.
static bool CheckTemplateSpecializationScope(Sema &S, NamedDecl *Specialized, NamedDecl *PrevDecl, SourceLocation Loc, bool IsPartialSpecialization)
Check whether a specialization is well-formed in the current context.
static bool ScopeSpecifierHasTemplateId(const CXXScopeSpec &SS)
Determine whether the given scope specifier has a template-id in it.
static SourceRange findTemplateParameterInType(unsigned Depth, Expr *E)
static Sema::SemaDiagnosticBuilder noteLocation(Sema &S, const NamedDecl &Decl, unsigned HereDiagID, unsigned ExternalDiagID)
static SourceRange getRangeOfTypeInNestedNameSpecifier(ASTContext &Context, QualType T, const CXXScopeSpec &SS)
static Expr * BuildExpressionFromIntegralTemplateArgumentValue(Sema &S, QualType OrigT, const llvm::APSInt &Int, SourceLocation Loc)
Construct a new expression that refers to the given integral template argument with the given source-...
static SourceRange findTemplateParameter(unsigned Depth, TypeLoc TL)
static NullPointerValueKind isNullPointerValueTemplateArgument(Sema &S, NonTypeTemplateParmDecl *Param, QualType ParamType, Expr *Arg, Decl *Entity=nullptr)
Determine whether the given template argument is a null pointer value of the appropriate type.
static ExprResult formImmediatelyDeclaredConstraint(Sema &S, NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, NamedDecl *FoundDecl, SourceLocation LAngleLoc, SourceLocation RAngleLoc, QualType ConstrainedType, SourceLocation ParamNameLoc, ArgumentLocAppender Appender, SourceLocation EllipsisLoc)
static bool SubstDefaultTemplateArgument(Sema &SemaRef, TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, TemplateTypeParmDecl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, TemplateArgumentLoc &Output)
Substitute template arguments into the default template argument for the given template type paramete...
static bool CheckNonTypeTemplatePartialSpecializationArgs(Sema &S, SourceLocation TemplateNameLoc, NonTypeTemplateParmDecl *Param, const TemplateArgument *Args, unsigned NumArgs, bool IsDefaultArgument)
Subroutine of Sema::CheckTemplatePartialSpecializationArgs that checks non-type template partial spec...
static void StripImplicitInstantiation(NamedDecl *D, bool MinGW)
Strips various properties off an implicit instantiation that has just been explicitly specialized.
static bool isEnableIf(NestedNameSpecifierLoc NNS, const IdentifierInfo &II, SourceRange &CondRange, Expr *&Cond)
Determine whether this failed name lookup should be treated as being disabled by a usage of std::enab...
static void DiagnoseTemplateParameterListArityMismatch(Sema &S, TemplateParameterList *New, TemplateParameterList *Old, Sema::TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc)
Diagnose a known arity mismatch when comparing template argument lists.
static bool isTemplateArgumentTemplateParameter(const TemplateArgument &Arg, unsigned Depth, unsigned Index)
static QualType builtinCommonTypeImpl(Sema &S, TemplateName BaseTemplate, SourceLocation TemplateLoc, ArrayRef< TemplateArgument > Ts)
static TemplateArgumentListInfo makeTemplateArgumentListInfo(Sema &S, TemplateIdAnnotation &TemplateId)
Convert the parser's template argument list representation into our form.
static bool CheckTemplateArgumentIsCompatibleWithParameter(Sema &S, NonTypeTemplateParmDecl *Param, QualType ParamType, Expr *ArgIn, Expr *Arg, QualType ArgType)
Checks whether the given template argument is compatible with its template parameter.
static bool CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, NonTypeTemplateParmDecl *Param, QualType ParamType, Expr *ArgIn, TemplateArgument &SugaredConverted, TemplateArgument &CanonicalConverted)
Checks whether the given template argument is the address of an object or function according to C++ [...
static void collectConjunctionTerms(Expr *Clause, SmallVectorImpl< Expr * > &Terms)
Collect all of the separable terms in the given condition, which might be a conjunction.
static void checkMoreSpecializedThanPrimary(Sema &S, PartialSpecDecl *Partial)
static bool CheckTemplateArgumentPointerToMember(Sema &S, NonTypeTemplateParmDecl *Param, QualType ParamType, Expr *&ResultArg, TemplateArgument &SugaredConverted, TemplateArgument &CanonicalConverted)
Checks whether the given template argument is a pointer to member constant according to C++ [temp....
static SourceLocation DiagLocForExplicitInstantiation(NamedDecl *D, SourceLocation PointOfInstantiation)
Compute the diagnostic location for an explicit instantiation.
static bool RemoveLookupResult(LookupResult &R, NamedDecl *C)
static bool isEnableIfAliasTemplate(TypeAliasTemplateDecl *AliasTemplate)
Determine whether this alias template is "enable_if_t".
static bool DiagnoseUnexpandedParameterPacks(Sema &S, TemplateTemplateParmDecl *TTP)
Check for unexpanded parameter packs within the template parameters of a template template parameter,...
static bool CheckExplicitInstantiationScope(Sema &S, NamedDecl *D, SourceLocation InstLoc, bool WasQualifiedName)
Check the scope of an explicit instantiation.
static TemplateArgumentLoc translateTemplateArgument(Sema &SemaRef, const ParsedTemplateArgument &Arg)
static bool isSameAsPrimaryTemplate(TemplateParameterList *Params, ArrayRef< TemplateArgument > Args)
static void checkTemplatePartialSpecialization(Sema &S, PartialSpecDecl *Partial)
static bool CheckExplicitInstantiation(Sema &S, NamedDecl *D, SourceLocation InstLoc, bool WasQualifiedName, TemplateSpecializationKind TSK)
Common checks for whether an explicit instantiation of D is valid.
static Expr * lookThroughRangesV3Condition(Preprocessor &PP, Expr *Cond)
static bool DiagnoseDefaultTemplateArgument(Sema &S, Sema::TemplateParamListContext TPC, SourceLocation ParamLoc, SourceRange DefArgRange)
Diagnose the presence of a default template argument on a template parameter, which is ill-formed in ...
static QualType checkBuiltinTemplateIdType(Sema &SemaRef, BuiltinTemplateDecl *BTD, ArrayRef< TemplateArgument > Converted, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
static void noteNonDeducibleParameters(Sema &S, TemplateParameterList *TemplateParams, const llvm::SmallBitVector &DeducibleParams)
static void completeMemberSpecializationImpl(Sema &S, DeclT *OrigD, SourceLocation Loc)
Complete the explicit specialization of a member of a class template by updating the instantiated mem...
static bool diagnoseMissingArgument(Sema &S, SourceLocation Loc, TemplateDecl *TD, const TemplateParmDecl *D, TemplateArgumentListInfo &Args)
Diagnose a missing template argument.
static bool MatchTemplateParameterKind(Sema &S, NamedDecl *New, const Sema::TemplateCompareNewDeclInfo &NewInstFrom, NamedDecl *Old, const NamedDecl *OldInstFrom, bool Complain, Sema::TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc)
Match two template parameters within template parameter lists.
static void dllExportImportClassTemplateSpecialization(Sema &S, ClassTemplateSpecializationDecl *Def)
Make a dllexport or dllimport attr on a class template specialization take effect.
Defines the clang::SourceLocation class and associated facilities.
static const TemplateArgument & getArgument(const TemplateArgument &A)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
const LValueBase getLValueBase() const
APSInt & getComplexIntImag()
ValueKind getKind() const
APFixedPoint & getFixedPoint()
const ValueDecl * getMemberPointerDecl() const
APValue & getVectorElt(unsigned I)
unsigned getVectorLength() const
bool isMemberPointer() const
std::string getAsString(const ASTContext &Ctx, QualType Ty) const
@ Indeterminate
This object has an indeterminate value (C++ [basic.indet]).
@ None
There is no such object (it's outside its lifetime).
bool isNullPointer() const
APSInt & getComplexIntReal()
APFloat & getComplexFloatImag()
APFloat & getComplexFloatReal()
virtual bool HandleTopLevelDecl(DeclGroupRef D)
HandleTopLevelDecl - Handle the specified top-level declaration.
virtual void AssignInheritanceModel(CXXRecordDecl *RD)
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
unsigned getIntWidth(QualType T) const
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
DeclarationNameTable DeclarationNames
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
TemplateName getCanonicalTemplateName(TemplateName Name, bool IgnoreDeduced=false) const
Retrieves the "canonical" template name that refers to a given template.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
const LangOptions & getLangOpts() const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
CanQualType UnresolvedTemplateTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
bool isSameEntity(const NamedDecl *X, const NamedDecl *Y) const
Determine whether the two declarations refer to the same entity.
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
bool hasSimilarType(QualType T1, QualType T2) const
Determine if two types are similar, according to the C++ rules.
const TargetInfo & getTargetInfo() const
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
void setPrimaryMergedDecl(Decl *D, Decl *Primary)
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
Represents a constant array type that does not decay to a pointer when used as a function parameter.
A structure for storing the information associated with a name that has been assumed to be a template...
DeclarationName getDeclName() const
Get the name of the template.
Attr - This represents one attribute.
AutoTypeKeyword getAutoKeyword() const
const NestedNameSpecifierLoc getNestedNameSpecifierLoc() const
SourceLocation getRAngleLoc() const
ConceptDecl * getNamedConcept() const
SourceLocation getLAngleLoc() const
NamedDecl * getFoundDecl() const
DeclarationNameInfo getConceptNameInfo() const
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
bool isDecltypeAuto() const
A fixed int type of a specified bitwidth.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
BuiltinTemplateKind getBuiltinTemplateKind() const
This class is used for builtin types like 'int'.
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, FPOptionsOverride FPO, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
static CXXBoolLiteralExpr * Create(const ASTContext &C, bool Val, QualType Ty, SourceLocation Loc)
Represents a C++ member access expression where the actual member referenced could not be resolved be...
static CXXDependentScopeMemberExpr * Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
Represents a static or instance method of a struct/union/class.
The null pointer literal (C++11 [lex.nullptr])
Represents a C++ struct/union/class.
CXXRecordDecl * getMostRecentDecl()
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
CXXRecordDecl * getDefinition() const
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
void setDescribedClassTemplate(ClassTemplateDecl *Template)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
CXXRecordDecl * getPreviousDecl()
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
char * location_data() const
Retrieve the data associated with the source-location information.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceRange getRange() const
SourceLocation getBeginLoc() const
bool isSet() const
Deprecated.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Declaration of a class template.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a class template node.
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
void setMemberSpecialization()
Note that this member template is a specialization.
Represents a class template specialization, which refers to a class template with a given set of temp...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
Complex values, per C99 6.2.5p11.
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
bool isTypeConcept() const
ConceptDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static ConceptDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr=nullptr)
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
static ConceptSpecializationExpr * Create(const ASTContext &C, ConceptReference *ConceptRef, ImplicitConceptSpecializationDecl *SpecDecl, const ConstraintSatisfaction *Satisfaction)
const TypeClass * getTypePtr() const
Represents the canonical version of C arrays with a specified constant size.
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
Represents a concrete matrix type with constant number of rows and columns.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC.
bool isFileContext() const
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
bool isTransparentContext() const
isTransparentContext - Determines whether this context is a "transparent" context,...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool InEnclosingNamespaceSetOf(const DeclContext *NS) const
Test if this context is part of the enclosing namespace set of the context NS, as defined in C++0x [n...
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
DeclContext * getEnclosingNamespaceContext()
Retrieve the nearest enclosing namespace context.
bool isFunctionOrMethod() const
DeclContext * getLookupParent()
Find the parent context of this context that will be used for unqualified name lookup.
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
const LinkageSpecDecl * getExternCContext() const
Retrieve the nearest enclosing C linkage specification context.
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
A reference to a declared variable, function, enum, etc.
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Captures information about "declaration specifiers".
bool isVirtualSpecified() const
bool isNoreturnSpecified() const
SourceLocation getStorageClassSpecLoc() const
SCS getStorageClassSpec() const
SourceLocation getNoreturnSpecLoc() const
SourceLocation getExplicitSpecLoc() const
TSCS getThreadStorageClassSpec() const
bool isInlineSpecified() const
SourceLocation getThreadStorageClassSpecLoc() const
SourceLocation getVirtualSpecLoc() const
SourceLocation getConstexprSpecLoc() const
SourceLocation getInlineSpecLoc() const
bool hasExplicitSpecifier() const
bool hasConstexprSpecifier() const
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
bool isParameterPack() const
Whether this declaration is a parameter pack.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
@ FOK_None
Not a friend object.
bool isTemplated() const
Determine whether this declaration is a templated entity (whether it is.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
static DeclContext * castToDeclContext(const Decl *)
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration.
bool isTemplateParameter() const
isTemplateParameter - Determines whether this declaration is a template parameter.
bool isInvalidDecl() const
void setAccess(AccessSpecifier AS)
SourceLocation getLocation() const
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
void setLexicalDeclContext(DeclContext *DC)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
std::string getAsString() const
Retrieve the human-readable string for this name.
void setTypeSourceInfo(TypeSourceInfo *TI)
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
Represents the type decltype(expr) (C++11).
Represents a C++17 deduced template specialization type.
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Represents an extended address space qualifier where the input address space value is dependent.
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Represents a qualified type name for which the type name is dependent.
A qualified reference to a name whose declaration cannot yet be resolved.
static DependentScopeDeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Represents a dependent template name that cannot be resolved prior to template instantiation.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
unsigned getNumArgs() const
void setTemplateKeywordLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateNameLoc(SourceLocation Loc)
Represents a template specialization type whose template cannot be resolved, e.g.
Represents a vector type where either the type or size is dependent.
Recursive AST visitor that supports extension via dynamic dispatch.
virtual bool TraverseTypeLoc(TypeLoc TL)
Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...
virtual bool TraverseStmt(Stmt *S)
Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...
virtual bool TraverseTemplateName(TemplateName Template)
Recursively visit a template name and dispatch to the appropriate method.
void setElaboratedKeywordLoc(SourceLocation Loc)
TypeLoc getNamedTypeLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
RAII object that enters a new expression evaluation context.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
@ NPC_NeverValueDependent
Specifies that the expression should never be value-dependent.
bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsRValue - Return true if this is a constant which we can fold to an rvalue using any crazy t...
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
ExtVectorType - Extended vector type.
Represents a member of a struct/union/class.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
static FixedPointLiteral * CreateFromRawInt(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l, unsigned Scale)
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, SourceLocation EllipsisLoc={}, ArrayRef< TemplateParameterList * > FriendTypeTPLists={})
Represents a function declaration or definition.
ConstexprSpecKind getConstexprKind() const
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
SourceLocation getPointOfInstantiation() const
Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isDeleted() const
Whether this function has been deleted.
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo *TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization.
void setLateTemplateParsed(bool ILT=true)
State that this templated function will be late parsed.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
void setDeletedAsWritten(bool D=true, StringLiteral *Message=nullptr)
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
ArrayRef< QualType > param_types() const
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
bool isExplicitSpecialization() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
QualType getReturnType() const
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef getName() const
Return the actual identifier string.
void AddDecl(NamedDecl *D)
AddDecl - Link the decl to its shadowed decl chain.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static ImplicitConceptSpecializationDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation SL, ArrayRef< TemplateArgument > ConvertedArgs)
Represents a C array with an unspecified size.
const TypeClass * getTypePtr() const
Describes an C or C++ initializer list.
Describes the kind of initialization being performed, along with location information for tokens rela...
static InitializationKind CreateForInit(SourceLocation Loc, bool DirectInit, Expr *Init)
Create an initialization from an initializer (which, for direct initialization from a parenthesized l...
Describes the sequence of initializations required to initialize a given object or reference with a s...
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence.
Describes an entity that is being initialized.
static InitializedEntity InitializeTemplateParameter(QualType T, NonTypeTemplateParmDecl *Param)
Create the initialization entity for a template parameter.
Wrapper for source info for injected class names of class templates.
The injected class name of a C++ class template or class template partial specialization.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
An lvalue reference type, per C++11 [dcl.ref].
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Represents a linkage specification.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
NamedDecl * getPartiallySubstitutedPack(const TemplateArgument **ExplicitArgs=nullptr, unsigned *NumExplicitArgs=nullptr) const
Retrieve the partially-substitued template parameter pack.
A class for iterating through a result set and possibly filtering out results.
void erase()
Erase the last element returned from this iterator.
Represents the results of name lookup.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
@ Found
Name lookup found a single declaration that met the criteria.
bool wasNotFoundInCurrentInstantiation() const
Determine whether no result was found because we could not search into dependent base classes of the ...
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
void setTemplateNameLookup(bool TemplateName)
Sets whether this is a template-name lookup.
DeclClass * getAsSingle() const
bool empty() const
Return true if no decls were found.
SourceLocation getNameLoc() const
Gets the location of the identifier.
Filter makeFilter()
Create a filter for this result set.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
CXXRecordDecl * getNamingClass() const
Returns the 'naming class' for this lookup, i.e.
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
DeclarationName getLookupName() const
Gets the name to look up.
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getPointeeType() const
Provides information a specialization of a member of a class template, which may be a member function...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
Data structure that captures multiple levels of template argument lists for use in template instantia...
const ArgList & getInnermost() const
Retrieve the innermost template argument list.
void addOuterTemplateArguments(Decl *AssociatedDecl, ArgList Args, bool Final)
Add a new outmost level to the multi-level template argument list.
void addOuterRetainedLevels(unsigned Num)
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
NamedDecl * getMostRecentDecl()
Linkage getFormalLinkage() const
Get the linkage from a semantic point of view.
void setModulePrivate()
Specify that this declaration was marked as being private to the module in which it was defined.
bool hasLinkage() const
Determine whether this declaration has linkage.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
void setPlaceholderTypeConstraint(Expr *E)
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
Interfaces are the core concept in Objective-C for object oriented design.
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
static OpaquePtr make(TemplateName P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
@ CSK_Normal
Normal lookup.
SmallVectorImpl< OverloadCandidate >::iterator iterator
void NoteCandidates(PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, StringRef Opc="", SourceLocation Loc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
When overload resolution fails, prints diagnostic messages containing the candidates in the candidate...
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
OverloadCandidate & addCandidate(unsigned NumConversions=0, ConversionSequenceList Conversions={})
Add a new candidate with NumConversions conversion sequence slots to the overload set.
A structure for storing the information associated with an overloaded template name.
NamedDecl *const * iterator
Represents a C++11 pack expansion that produces a sequence of expressions.
Represents a pack expansion of types.
A single parameter index whose accessors require each use to make explicit the parameter index encodi...
ParenExpr - This represents a parenthesized expression, e.g.
ParsedAttr - Represents a syntactic attribute.
Represents the parsed form of a C++ template argument.
KindType getKind() const
Determine what kind of template argument we have.
SourceLocation getLocation() const
Retrieve the location of the template argument.
ParsedTemplateTy getAsTemplate() const
Retrieve the template template argument's template name.
ParsedTemplateArgument getTemplatePackExpansion(SourceLocation EllipsisLoc) const
Retrieve a pack expansion of the given template template argument.
ParsedType getAsType() const
Retrieve the template type argument's type.
@ Type
A template type parameter, stored as a type.
@ Template
A template template argument, stored as a template name.
@ NonType
A non-type template parameter, stored as an expression.
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that makes a template template argument into a pack expansion.
Expr * getAsExpr() const
Retrieve the non-type template argument's expression.
const CXXScopeSpec & getScopeSpec() const
Retrieve the nested-name-specifier that precedes the template name in a template template argument.
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
StringRef getImmediateMacroName(SourceLocation Loc)
Retrieve the name of the immediate macro expansion.
A (possibly-)qualified type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
void addConst()
Add the const type qualifier to this QualType.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
void * getAsOpaquePtr() const
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
The collection of all-type qualifiers we support.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
void setObjCLifetime(ObjCLifetime type)
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
Wrapper for source info for record types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
void setMemberSpecialization()
Note that this member template is a specialization.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
Scope - A scope is a transient data structure that is used while parsing the program.
unsigned getFlags() const
getFlags - Return the flags for this scope.
const Scope * getParent() const
getParent - Return the scope that this is nested in.
@ TemplateParamScope
This is a scope that corresponds to the template parameters of a C++ template.
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
CUDAFunctionTarget IdentifyTarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
void inheritTargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD)
Copies target attributes from the template TD to the function FD.
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Whether and why a template name is required in this lookup.
SourceLocation getTemplateKeywordLoc() const
bool hasTemplateKeyword() const
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Abstract base class used for diagnosing integer constant expression violations.
Sema - This implements semantic analysis and AST building for C.
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList *PartialSpecArgs, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, CXXScopeSpec &SS, TemplateIdAnnotation &TemplateId, const ParsedAttributesView &Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
ConceptDecl * ActOnStartConceptDefinition(Scope *S, MultiTemplateParamsArg TemplateParameterLists, const IdentifierInfo *Name, SourceLocation NameLoc)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
sema::CapturingScopeInfo * getEnclosingLambdaOrBlock() const
Get the innermost lambda or block enclosing the current location, if any.
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc, NamedDecl *TemplateParam=nullptr)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr, bool IsAfterAmp=false)
LookupNameKind
Describes the kind of name lookup to perform.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
ExprResult ActOnConstantExpression(ExprResult Res)
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, RequiredTemplateKind RequiredTemplate=SourceLocation(), AssumedTemplateKind *ATK=nullptr, bool AllowTypoCorrection=true)
bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, NamedDecl *PrevMemberDecl, AccessSpecifier LexicalAS)
SetMemberAccessSpecifier - Set the access specifier of a member.
bool BuildTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc, bool AllowUnexpandedPack)
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc, TemplateIdAnnotation *TemplateId, bool IsMemberSpecialization)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, const IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
NamedDecl * ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, bool Typename, SourceLocation EllipsisLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg)
ActOnTemplateTemplateParameter - Called when a C++ template template parameter (e....
bool ActOnTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
bool hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class,...
void NoteAllFoundTemplates(TemplateName Name)
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, const IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
void InstantiateClassTemplateSpecializationMembers(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK)
Instantiate the definitions of all of the members of the given class template specialization,...
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
bool TemplateParameterListsAreEqual(const TemplateCompareNewDeclInfo &NewInstFrom, TemplateParameterList *New, const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
DeclResult ActOnVarTemplateSpecialization(Scope *S, Declarator &D, TypeSourceInfo *DI, LookupResult &Previous, SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization)
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
FunctionDecl * getMoreConstrainedFunction(FunctionDecl *FD1, FunctionDecl *FD2)
Returns the more constrained function according to the rules of partial ordering by constraints (C++ ...
void referenceDLLExportedClassMethods()
static NamedDecl * getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates=true, bool AllowDependent=true)
Try to interpret the lookup result D as a template-name.
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid, bool SuppressDiagnostic=false)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
bool RequireStructuralType(QualType T, SourceLocation Loc)
Require the given type to be a structural type, and diagnose if it is not.
ExprResult EvaluateConvertedConstantExpression(Expr *E, QualType T, APValue &Value, CCEKind CCE, bool RequireInt, const APValue &PreNarrowingValue)
EvaluateConvertedConstantExpression - Evaluate an Expression That is a converted constant expression ...
ConceptDecl * ActOnFinishConceptDefinition(Scope *S, ConceptDecl *C, Expr *ConstraintExpr, const ParsedAttributesView &Attrs)
FPOptionsOverride CurFPFeatureOverrides()
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs)
ActOnDependentIdExpression - Handle a dependent id-expression that was just parsed.
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
bool IsInsideALocalClassWithinATemplateFunction()
Decl * ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D)
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Look up a name, looking for a single declaration.
bool CheckConceptUseInDefinition(ConceptDecl *Concept, SourceLocation Loc)
LateParsedTemplateMapT LateParsedTemplateMap
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
@ CTAK_Deduced
The template argument was deduced via template argument deduction.
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization, bool Disambiguation=false)
ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType)
Convert a parsed type into a parsed template argument.
bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind)
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
bool ConstraintExpressionDependsOnEnclosingTemplate(const FunctionDecl *Friend, unsigned TemplateDepth, const Expr *Constraint)
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...
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
DiagnosticsEngine & getDiagnostics() const
ExprResult BuildExpressionFromNonTypeTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
void propagateDLLAttrToBaseClassTemplate(CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc)
Perform propagation of DLL attributes from a derived class to a templated base class for MS compatibi...
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
void checkSpecializationReachability(SourceLocation Loc, NamedDecl *Spec)
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
ASTContext & getASTContext() const
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
UnresolvedSetIterator getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, TemplateSpecCandidateSet &FailedCandidates, SourceLocation Loc, const PartialDiagnostic &NoneDiag, const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &CandidateDiag, bool Complain=true, QualType TargetType=QualType())
Retrieve the most specialized of the given function template specializations.
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
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.
bool IsRedefinitionInModule(const NamedDecl *New, const NamedDecl *Old) const
Check the redefinition in C++20 Modules.
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
bool CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param, TemplateParameterList *Params, TemplateArgumentLoc &Arg, bool IsDeduced)
Check a template argument against its corresponding template template parameter.
TemplateParameterList * GetTemplateParameterList(TemplateDecl *TD)
Returns the template parameter list with all default template argument information.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
@ TPL_TemplateTemplateParmMatch
We are matching the template parameter lists of two template template parameters as part of matching ...
@ TPL_TemplateTemplateArgumentMatch
We are matching the template parameter lists of a template template argument against the template par...
@ TPL_TemplateMatch
We are matching the template parameter lists of two templates that might be redeclarations.
@ TPL_TemplateParamsEquivalent
We are determining whether the template-parameters are equivalent according to C++ [temp....
NamedDecl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg, bool HasTypeConstraint)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed.
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
@ FoundFunctions
This is assumed to be a template name because lookup found one or more functions (but no function tem...
@ None
This is not assumed to be a template name.
@ FoundNothing
This is assumed to be a template name because lookup found nothing.
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
ArrayRef< InventedTemplateParameterInfo > getInventedParameterInfos() const
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
FPOptions & getCurFPFeatures()
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
bool EnsureTemplateArgumentListConstraints(TemplateDecl *Template, const MultiLevelTemplateArgumentList &TemplateArgs, SourceRange TemplateIDRange)
Ensure that the given template arguments satisfy the constraints associated with the given template,...
@ UPPC_PartialSpecialization
Partial specialization.
@ UPPC_DefaultArgument
A default argument.
@ UPPC_ExplicitSpecialization
Explicit specialization.
@ UPPC_NonTypeTemplateParameterType
The type of a non-type template parameter.
@ UPPC_TypeConstraint
A type constraint.
const LangOptions & getLangOpts() const
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl, bool SupportedForCompatibility=false)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
bool RebuildTemplateParamsInCurrentInstantiation(TemplateParameterList *Params)
Rebuild the template parameters now that we know we're in a current instantiation.
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, NamedDecl *FoundDecl, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, QualType ConstrainedType, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
void EnterTemplatedContext(Scope *S, DeclContext *DC)
Enter a template parameter scope, after it's been associated with a particular DeclContext.
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
void NoteTemplateLocation(const NamedDecl &Decl, std::optional< SourceRange > ParamRange={})
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, QualType ObjectType, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, const MultiLevelTemplateArgumentList &TemplateArgLists, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
const LangOptions & LangOpts
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
std::pair< Expr *, std::string > findFailedBooleanCondition(Expr *Cond)
Find the failed Boolean condition within a given Boolean constant expression, and describe it with a ...
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true, bool AllowNonTemplateFunctions=false)
ExprResult BuildConvertedConstantExpression(Expr *From, QualType T, CCEKind CCE, NamedDecl *Dest=nullptr)
bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, const TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given dependent function template specialization.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
bool hasExplicitCallingConv(QualType T)
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted)
bool AreConstraintExpressionsEqual(const NamedDecl *Old, const Expr *OldConstr, const TemplateCompareNewDeclInfo &New, const Expr *NewConstr)
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2)
If D1 was not at least as constrained as D2, but would've been if a pair of atomic constraints involv...
ExprResult DefaultLvalueConversion(Expr *E)
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
void NoteOverloadCandidate(const NamedDecl *Found, const FunctionDecl *Fn, OverloadCandidateRewriteKind RewriteKind=OverloadCandidateRewriteKind(), QualType DestType=QualType(), bool TakingAddress=false)
bool hasReachableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a reachable default argument.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument > > Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false, bool ForDefaultArgumentSubstitution=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
TypeSourceInfo * RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, SourceLocation Loc, DeclarationName Name)
Rebuilds a type within the context of the current instantiation.
QualType BuiltinDecay(QualType BaseType, SourceLocation Loc)
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation(), bool ForOverloadResolution=false)
Check whether the given function decl's trailing requires clause is satisfied, if any.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
void notePreviousDefinition(const NamedDecl *Old, SourceLocation New)
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind ActOnExplicitInstantiationNewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
bool CheckTypeConstraint(TemplateIdAnnotation *TypeConstraint)
TemplateNameKind ActOnTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a template name from a name that is syntactically required to name a template,...
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater)
ExprResult FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
Get the specialization of the given variable template corresponding to the specified argument list,...
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
void diagnoseMissingImport(SourceLocation Loc, const NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true)
TypeSourceInfo * SubstAutoTypeSourceInfoDependent(TypeSourceInfo *TypeWithAuto)
bool IsAtLeastAsConstrained(NamedDecl *D1, MutableArrayRef< const Expr * > AC1, NamedDecl *D2, MutableArrayRef< const Expr * > AC2, bool &Result)
Check whether the given declaration's associated constraints are at least as constrained than another...
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams)
Check whether a template can be declared within this scope.
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraints=true)
SourceLocation getTopMostPointOfInstantiation(const NamedDecl *) const
Returns the top most location responsible for the definition of N.
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
void ActOnUndeclaredTypeTemplateName(Scope *S, TemplateTy &Name, TemplateNameKind &TNK, SourceLocation NameLoc, IdentifierInfo *&II)
Try to resolve an undeclared template name as a type template.
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
Perform semantic analysis for the given non-template member specialization.
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc, ImplicitTypenameContext IsImplicitTypename=ImplicitTypenameContext::No)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
bool hasReachableMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is a member specialization declaration (as op...
RedeclarationKind forRedeclarationInCurContext() const
bool SubstTemplateArgument(const TemplateArgumentLoc &Input, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentLoc &Output, SourceLocation Loc={}, const DeclarationName &Entity={})
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.
@ CCEK_TemplateArg
Value of a non-type template parameter.
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
void MarkUnusedFileScopedDecl(const DeclaratorDecl *D)
If it's a file scoped decl that must warn if not used, keep track of it.
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, bool IsAddressOfOperand)
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
DeclResult ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, const ParsedAttributesView &Attr)
QualType CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc)
Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
TypeSourceInfo * GetTypeForDeclarator(Declarator &D)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
DeclResult ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, bool IsTemplateParamOrArg, OffsetOfKind OOK, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, const DefaultArguments &DefaultArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr, bool PartialOrderingTTP=false)
Check that the given template arguments can be provided to the given template, converting the argumen...
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
void makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location.
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
bool hasReachableExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is an explicit specialization declaration for...
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, CXXScopeSpec &SS, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration.
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
NamedDecl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc)
void CheckFunctionOrTemplateParamDeclarator(Scope *S, Declarator &D)
Common checks for a parameter-declaration that should apply to both function parameters and non-type ...
TemplateParamListContext
The context in which we are checking a template parameter list.
@ TPC_FriendFunctionTemplate
@ TPC_ClassTemplateMember
@ TPC_FriendClassTemplate
@ TPC_FriendFunctionTemplateDefinition
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, ArrayRef< TemplateArgument > TemplateArgs, sema::TemplateDeductionInfo &Info)
bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)
static Scope * getScopeForDeclContext(Scope *S, DeclContext *DC)
Finds the scope corresponding to the given decl context, if it happens to be an enclosing scope.
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
void CheckConceptRedefinition(ConceptDecl *NewDecl, LookupResult &Previous, bool &AddToScope)
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
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...
bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, sema::TemplateDeductionInfo &Info)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(TemplateParameterList *PParam, TemplateDecl *AArg, const DefaultArguments &DefaultArgs, SourceLocation Loc, bool IsDeduced)
void ProcessAPINotes(Decl *D)
Map any API notes provided for this declaration to attributes on the declaration.
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments.
bool CheckRedeclarationInModule(NamedDecl *New, NamedDecl *Old)
A wrapper function for checking the semantic restrictions of a redeclaration within a module.
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
unsigned getTemplateDepth(Scope *S) const
Determine the number of levels of enclosing template parameters.
ExprResult BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc, NamedDecl *TemplateParam=nullptr)
Given a non-type template argument that refers to a declaration and the type of its corresponding non...
TemplateDeductionResult DeduceAutoType(TypeLoc AutoTypeLoc, Expr *Initializer, QualType &Result, sema::TemplateDeductionInfo &Info, bool DependentDeduction=false, bool IgnoreConstraints=false, TemplateSpecCandidateSet *FailedTSC=nullptr)
Deduce the type for an auto type-specifier (C++11 [dcl.spec.auto]p6)
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
void NoteTemplateParameterLocation(const NamedDecl &Decl)
IdentifierResolver IdResolver
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
TypeResult ActOnTagTemplateIdType(TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc)
Parsed an elaborated-type-specifier that refers to a template-id, such as class T::template apply.
bool hasReachableDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is reachable.
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
void warnOnReservedIdentifier(const NamedDecl *D)
void inferNullableClassAttribute(CXXRecordDecl *CRD)
Add _Nullable attributes for std:: types.
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Represents the result of substituting a set of types for a template type parameter pack.
Represents the result of substituting a type for a template type parameter.
Represents the declaration of a struct/union/class/enum.
StringRef getKindName() const
void startDefinition()
Starts the definition of this tag declaration.
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)
TagKind getTagKind() const
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
virtual bool shouldDLLImportComdatSymbols() const
Does this target aim for semantic compatibility with Microsoft C++ code using dllimport/export attrib...
A convenient class for passing around template argument information.
SourceLocation getRAngleLoc() const
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
SourceLocation getLAngleLoc() const
A template argument list.
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Location wrapper for a TemplateArgument.
SourceLocation getLocation() const
SourceLocation getTemplateEllipsisLoc() const
const TemplateArgument & getArgument() const
SourceLocation getTemplateNameLoc() const
TypeSourceInfo * getTypeSourceInfo() const
SourceRange getSourceRange() const LLVM_READONLY
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Expr * getSourceExpression() const
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
bool isDependent() const
Whether this template argument is dependent on a template parameter such that its result can change f...
bool isInstantiationDependent() const
Whether this template argument is dependent on a template parameter.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
TemplateArgument getPackExpansionPattern() const
When the template argument is a pack expansion, returns the pattern of the pack expansion.
bool isNull() const
Determine whether this template argument has no value.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
void print(const PrintingPolicy &Policy, raw_ostream &Out, bool IncludeType) const
Print this template argument to the given output stream.
QualType getIntegralType() const
Retrieve the type of the integral value.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
bool hasAssociatedConstraints() const
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
bool isNull() const
Determine whether this template name is NULL.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
SourceRange getSourceRange() const LLVM_READONLY
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
bool hasAssociatedConstraints() const
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to form a template specialization.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
SourceLocation getRAngleLoc() const
SourceLocation getLAngleLoc() const
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
All associated constraints derived from this template parameter list, including the requires clause a...
static bool shouldIncludeTypeForArgument(const PrintingPolicy &Policy, const TemplateParameterList *TPL, unsigned Idx)
SourceLocation getTemplateLoc() const
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
void NoteCandidates(Sema &S, SourceLocation Loc)
NoteCandidates - When no template specialization match is found, prints diagnostic messages containin...
SourceLocation getLocation() const
TemplateSpecCandidate & addCandidate()
Add a new candidate with NumConversions conversion sequence slots to the overload set.
unsigned getNumArgs() const
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
TemplateArgumentLoc getArgLoc(unsigned i) const
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, ArrayRef< TemplateArgument > Converted)
Determine whether any of the given template arguments are dependent.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
void setInheritedDefaultArgument(const ASTContext &C, TemplateTemplateParmDecl *Prev)
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, bool Typename, TemplateParameterList *Params)
void removeDefaultArgument()
Removes the default argument of this template parameter.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool isParameterPack() const
Returns whether this is a parameter pack.
unsigned getDepth() const
Retrieve the depth of the template parameter.
void setTypeConstraint(ConceptReference *CR, Expr *ImmediatelyDeclaredConstraint)
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter.
Wrapper for template type parameters.
TemplateTypeParmDecl * getDecl() const
unsigned getIndex() const
unsigned getDepth() const
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Represents a declaration of a type.
SourceLocation getBeginLoc() const LLVM_READONLY
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
SourceLocation getBeginLoc() const
Get the begin source location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier.
SourceLocation getNameLoc() const
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into a tag type kind.
The base class of the type hierarchy.
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBooleanType() const
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
bool isRValueReferenceType() const
bool isVoidPointerType() const
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
bool isScalarType() const
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
bool isObjCObjectOrInterfaceType() const
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isLValueReferenceType() const
bool isBitIntType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isChar16Type() const
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
QualType getCanonicalTypeInternal() const
bool isMemberPointerType() const
bool isChar32Type() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
bool hasUnnamedOrLocalType() const
Whether this type is or contains a local or unnamed type.
bool isPointerOrReferenceType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isVectorType() const
bool isWideCharType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isNullPtrType() const
bool isRecordType() const
QualType getUnderlyingType() const
Simple class containing the result of Sema::CorrectTypo.
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
DeclClass * getCorrectionDeclAs() const
NamedDecl * getFoundDecl() const
Get the correction declaration found by name lookup (before we looked through using shadow declaratio...
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represents a C++ unqualified-id that has been parsed.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, bool KnownDependent, bool KnownInstantiationDependent)
void addDecl(NamedDecl *D)
The iterator over UnresolvedSets.
A set of unresolved declarations.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a dependent using declaration which was not marked with typename.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
Represents a variable declaration or definition.
TLSKind getTLSKind() const
bool isStaticDataMember() const
Determines whether this is a static data member.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization,...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template,...
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Declaration of a variable template.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
VarTemplateDecl * getMostRecentDecl()
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
void setMemberSpecialization()
Note that this member template is a specialization.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
Retains information about a function, method, or block that is currently being parsed.
Provides information about an attempted template argument deduction, whose success or failure was des...
TemplateArgumentList * takeSugared()
Take ownership of the deduced template argument lists.
bool hasSFINAEDiagnostic() const
Is a SFINAE diagnostic available?
void takeSFINAEDiagnostic(PartialDiagnosticAt &PD)
Take ownership of the SFINAE diagnostic.
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
TypeSpecifierType
Specifies the kind of type.
bool isa(CodeGen::Address addr)
@ OR_Deleted
Succeeded, but refers to a deleted function.
@ OR_Success
Overload resolution succeeded.
@ OR_Ambiguous
Ambiguous candidates found.
@ OR_No_Viable_Function
No viable function found.
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ ovl_fail_constraints_not_satisfied
This candidate was not viable because its associated constraints were not satisfied.
OverloadCandidateDisplayKind
@ OCD_AmbiguousCandidates
Requests that only tied-for-best candidates be shown.
@ OCD_AllCandidates
Requests that all candidates be shown.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ IK_TemplateId
A template-id, e.g., f<int>.
@ IK_LiteralOperatorId
A user-defined literal name, e.g., operator "" _i.
@ IK_Identifier
An identifier.
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
StorageClass
Storage classes.
@ CRK_None
Candidate is not a rewritten candidate.
@ Internal
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
TemplateDecl * getAsTypeTemplateDecl(Decl *D)
@ Result
The result type of a method or function.
InheritableAttr * getDLLAttr(Decl *D)
Return a DLL attribute from the declaration.
ActionResult< Expr * > ExprResult
TagTypeKind
The kind of a tag type.
@ Enum
The "enum" keyword.
MutableArrayRef< TemplateParameterList * > MultiTemplateParamsArg
DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context, TemplateDeductionResult TDK, sema::TemplateDeductionInfo &Info)
Convert from Sema's representation of template deduction information to the form used in overload-can...
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__builtin_common_type
This names the __builtin_common_type BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
CastKind
CastKind - The kind of operation required for a conversion.
std::optional< unsigned > getExpandedPackSize(const NamedDecl *Param)
Check whether the template parameter is a pack expansion, and if so, determine the number of paramete...
SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params, unsigned NumParams)
Retrieves the range of the given template parameter lists.
bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg, const NamedDecl *Param, ArrayRef< TemplateArgument > Args, unsigned Depth)
Make a best-effort determination of whether the type T can be produced by substituting Args into the ...
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
@ TNK_Dependent_template_name
The name refers to a dependent template name:
@ TNK_Function_template
The name refers to a function template or a set of overloaded functions that includes at least one fu...
@ TNK_Concept_template
The name refers to a concept.
@ TNK_Non_template
The name does not refer to a template.
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
ActionResult< ParsedType > TypeResult
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL=nullptr)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
TemplateDeductionResult
Describes the result of template argument deduction.
@ ConstraintsNotSatisfied
The deduced arguments did not satisfy the constraints associated with the template.
@ CUDATargetMismatch
CUDA Target attributes do not match.
@ Success
Template argument deduction was successful.
@ AlreadyDiagnosed
Some error which was already diagnosed.
ActionResult< Decl * > DeclResult
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
@ Parens
New-expression has a C++98 paren-delimited initializer.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayRef< TemplateArgument > Args
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
bool HasSideEffects
Whether the evaluated expression has side effects.
Extra information about a function prototype.
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Describes how types, statements, expressions, and declarations should be printed.
unsigned PrintCanonicalTypes
Whether to print types as written or canonically.
unsigned TerseOutput
Provide a 'terse' output.
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
@ BuildingDeductionGuides
We are building deduction guides for a class.
A stack object to be created when performing template instantiation.
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Location information for a TemplateArgument.
Information about a template-id annotation token.
const IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
unsigned NumArgs
NumArgs - The number of template arguments.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
void set(DeclAccessPair Found, Decl *Spec, DeductionFailureInfo Info)
Contains all information for a given match.