[clang] [clang-tools-extra] [llvm] [Clang] Add __type_list_dedup builtin to deduplicate types in template arguments (PR #106730)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 06:09:25 PDT 2024


================
@@ -3158,6 +3161,33 @@ checkBuiltinTemplateIdType(Sema &SemaRef, BuiltinTemplateDecl *BTD,
     int64_t N = Index.getExtValue();
     return Ts.getPackAsArray()[N].getAsType();
   }
+  case BTK__type_list_dedup: {
+    assert(Converted.size() == 2 &&
+           "__type_list_dedup should be given a template and a parameter pack");
+    TemplateArgument Template = Converted[0];
+    TemplateArgument Ts = Converted[1];
+    if (Template.isDependent() || Ts.isDependent())
+      return Context.getCanonicalTemplateSpecializationType(TemplateName(BTD),
+                                                            Converted);
+
+    assert(Template.getKind() == clang::TemplateArgument::Template);
+    assert(Ts.getKind() == clang::TemplateArgument::Pack);
+    TemplateArgumentListInfo SyntheticTemplateArgs;
+    llvm::DenseSet<QualType> Seen;
----------------
ilya-biryukov wrote:

Done.

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


More information about the cfe-commits mailing list