[clang] [clang] Implement CTAD for type alias template. (PR #77890)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 15:01:02 PST 2024


================
@@ -2612,44 +2671,309 @@ struct ConvertConstructorToDeductionGuideTransform {
     SemaRef.CurrentInstantiationScope->InstantiatedLocal(OldParam, NewParam);
     return NewParam;
   }
+};
 
-  FunctionTemplateDecl *buildDeductionGuide(
-      TemplateParameterList *TemplateParams, CXXConstructorDecl *Ctor,
-      ExplicitSpecifier ES, TypeSourceInfo *TInfo, SourceLocation LocStart,
-      SourceLocation Loc, SourceLocation LocEnd,
-      llvm::ArrayRef<TypedefNameDecl *> MaterializedTypedefs = {}) {
-    DeclarationNameInfo Name(DeductionGuideName, Loc);
-    ArrayRef<ParmVarDecl *> Params =
-        TInfo->getTypeLoc().castAs<FunctionProtoTypeLoc>().getParams();
+// Find all template parameters of the AliasTemplate that appear in the
+// given DeducedArgs.
+SmallVector<unsigned>
+FindAppearedTemplateParamsInAlias(ArrayRef<TemplateArgument> DeducedArgs,
----------------
erichkeane wrote:

I might suggest we instead genericize this to not be AliasTemplate specific, and have it take a list of NamedDecls and template args.  Then call it something like, `DeclsReferencedInTemplateArgumentList`.

I also probably wouldn't have this return a list of 'ints', and just return the pointers themselves, as this little trade back and forth is a little awkward.

https://github.com/llvm/llvm-project/pull/77890


More information about the cfe-commits mailing list