Skip to content

Commit aee13c7

Browse files
committed
Address review comments.
1 parent e77cc4d commit aee13c7

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ C++20 Feature Support
9292
Fixes `#84002 <https://github.com/llvm/llvm-project/issues/84002>`_.
9393

9494
- Initial support for class template argument deduciton (CTAD) for type alias
95-
templates.
95+
templates (`P1814R0 <https://wg21.link/p1814r0>`_).
9696
(`#54051 https://github.com/llvm/llvm-project/issues/54051`_).
9797

9898
C++23 Feature Support

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,12 +2682,12 @@ struct ConvertConstructorToDeductionGuideTransform {
26822682
SmallVector<unsigned> TemplateParamsReferencedInTemplateArgumentList(
26832683
ArrayRef<NamedDecl *> TemplateParams,
26842684
ArrayRef<TemplateArgument> DeducedArgs) {
2685-
struct FindAppearedTemplateParams
2686-
: public RecursiveASTVisitor<FindAppearedTemplateParams> {
2685+
struct ReferenceFinder
2686+
: public RecursiveASTVisitor<ReferenceFinder> {
26872687
llvm::DenseSet<NamedDecl *> TemplateParams;
2688-
llvm::DenseSet<const NamedDecl *> AppearedTemplateParams;
2688+
llvm::DenseSet<const NamedDecl *> ReferencedTemplateParams;
26892689

2690-
FindAppearedTemplateParams(ArrayRef<NamedDecl *> TemplateParams)
2690+
ReferenceFinder(ArrayRef<NamedDecl *> TemplateParams)
26912691
: TemplateParams(TemplateParams.begin(), TemplateParams.end()) {}
26922692

26932693
bool VisitTemplateTypeParmType(TemplateTypeParmType *TTP) {
@@ -2702,15 +2702,15 @@ SmallVector<unsigned> TemplateParamsReferencedInTemplateArgumentList(
27022702

27032703
void MarkAppeared(NamedDecl *ND) {
27042704
if (TemplateParams.contains(ND))
2705-
AppearedTemplateParams.insert(ND);
2705+
ReferencedTemplateParams.insert(ND);
27062706
}
27072707
};
2708-
FindAppearedTemplateParams MarkAppeared(TemplateParams);
2709-
MarkAppeared.TraverseTemplateArguments(DeducedArgs);
2708+
ReferenceFinder Finder(TemplateParams);
2709+
Finder.TraverseTemplateArguments(DeducedArgs);
27102710

27112711
SmallVector<unsigned> Results;
27122712
for (unsigned Index = 0; Index < TemplateParams.size(); ++Index) {
2713-
if (MarkAppeared.AppearedTemplateParams.contains(
2713+
if (Finder.ReferencedTemplateParams.contains(
27142714
TemplateParams[Index]))
27152715
Results.push_back(Index);
27162716
}
@@ -2911,7 +2911,12 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
29112911
Context.getCanonicalTemplateArgument(
29122912
Context.getInjectedTemplateArg(NewParam));
29132913
}
2914-
// FIXME: support require clause.
2914+
// FIXME: implement the associated constraint per C++
2915+
// [over.match.class.deduct]p3.3:
2916+
// The associated constraints ([temp.constr.decl]) are the
2917+
// conjunction of the associated constraints of g and a
2918+
// constraint that is satisfied if and only if the arguments
2919+
// of A are deducible (see below) from the return type.
29152920
auto *FPrimeTemplateParamList = TemplateParameterList::Create(
29162921
Context, AliasTemplate->getTemplateParameters()->getTemplateLoc(),
29172922
AliasTemplate->getTemplateParameters()->getLAngleLoc(),
@@ -2963,12 +2968,6 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
29632968
F, TemplateArgListForBuildingFPrime, AliasTemplate->getLocation(),
29642969
Sema::CodeSynthesisContext::BuildingDeductionGuides)) {
29652970
auto *GG = dyn_cast<CXXDeductionGuideDecl>(FPrime);
2966-
// FIXME: implement the associated constraint per C++
2967-
// [over.match.class.deduct]p3.3:
2968-
// The associated constraints ([temp.constr.decl]) are the
2969-
// conjunction of the associated constraints of g and a
2970-
// constraint that is satisfied if and only if the arguments
2971-
// of A are deducible (see below) from the return type.
29722971
buildDeductionGuide(SemaRef, AliasTemplate, FPrimeTemplateParamList,
29732972
GG->getCorrespondingConstructor(),
29742973
GG->getExplicitSpecifier(), GG->getTypeSourceInfo(),

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ namespace {
14751475
std::vector<TemplateArgument> TArgs;
14761476
switch (Arg.getKind()) {
14771477
case TemplateArgument::Pack:
1478-
// Iterially rewrite the template argument pack, instead of unpacking
1478+
// Literally rewrite the template argument pack, instead of unpacking
14791479
// it.
14801480
assert(
14811481
SemaRef.CodeSynthesisContexts.back().Kind ==

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6287,8 +6287,8 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
62876287
CXXRecordDecl *SubstRecord = T->getAsCXXRecordDecl();
62886288

62896289
if (!SubstRecord) {
6290-
// The T can be a dependent TemplateSpecializationType when
6291-
// performing a substitution for building a deduction guide,
6290+
// T can be a dependent TemplateSpecializationType when performing a
6291+
// substitution for building a deduction guide.
62926292
assert(CodeSynthesisContexts.back().Kind ==
62936293
CodeSynthesisContext::BuildingDeductionGuides);
62946294
// Return a nullptr as a sentinel value, we handle it properly in

0 commit comments

Comments
 (0)