[clang] [clang-tools-extra] [Clang] Add __type_list_dedup builtin to deduplicate types in templat… (PR #106730)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 06:58:52 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff fee48365b44d161575314c67328fa21104c4537d 0151fbf9a8cea2d1c60dc399f088258dd94ad562 --extensions cpp,h -- clang/test/PCH/type_list_dedup.cpp clang/test/SemaTemplate/temp-param-list-dedup.cpp clang-tools-extra/clangd/unittests/FindTargetTests.cpp clang/include/clang/AST/ASTContext.h clang/include/clang/AST/DeclID.h clang/include/clang/Basic/Builtins.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp clang/lib/AST/DeclTemplate.cpp clang/lib/Lex/PPMacroExpansion.cpp clang/lib/Sema/SemaLookup.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/Import/builtin-template/Inputs/S.cpp clang/test/Import/builtin-template/test.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index b34f1eafc8..0cae2bae4b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1170,8 +1170,7 @@ ASTContext::getTypePackElementDecl() const {
   return TypePackElementDecl;
 }
 
-BuiltinTemplateDecl *
-ASTContext::getTypeListDedupDecl() const {
+BuiltinTemplateDecl *ASTContext::getTypeListDedupDecl() const {
   if (!TypeListDedupDecl)
     TypeListDedupDecl =
         buildBuiltinTemplateDecl(BTK__type_list_dedup, getTypeListDedupName());
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 252e1c9999..4b7694f1d1 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3160,10 +3160,9 @@ checkBuiltinTemplateIdType(Sema &SemaRef, BuiltinTemplateDecl *BTD,
       if (!Seen.insert(T.getAsType().getCanonicalType()).second)
         continue;
       SyntheticTemplateArgs.addArgument(TemplateArgumentLoc(
-          TemplateArgument(T),
-          SemaRef.Context.getTrivialTypeSourceInfo(
-              T.getAsType(),
-              /*FIXME: add location*/ SourceLocation())));
+          TemplateArgument(T), SemaRef.Context.getTrivialTypeSourceInfo(
+                                   T.getAsType(),
+                                   /*FIXME: add location*/ SourceLocation())));
     }
     return SemaRef.CheckTemplateIdType(Template.getAsTemplate(), TemplateLoc,
                                        SyntheticTemplateArgs);
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 04025474f9..707b8a34c4 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5043,8 +5043,7 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) {
                      PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID);
   RegisterPredefDecl(Context.TypePackElementDecl,
                      PREDEF_DECL_TYPE_PACK_ELEMENT_ID);
-  RegisterPredefDecl(Context.TypeListDedupDecl,
-                     PREDEF_DECL_TYPE_LIST_DEDUP_ID);
+  RegisterPredefDecl(Context.TypeListDedupDecl, PREDEF_DECL_TYPE_LIST_DEDUP_ID);
 
   const TranslationUnitDecl *TU = Context.getTranslationUnitDecl();
 

``````````

</details>


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


More information about the cfe-commits mailing list