[clang] [clang][ASTImporter] Fix crash when template class static member imported to other translation unit. (PR #68774)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 01:34:51 PDT 2023


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 9a8ff346bb20a684e8edd62035077aba06bea084 67f878a270d159d5d09d1dd029f862443125b511 -- clang/lib/AST/ASTImporter.cpp clang/unittests/AST/ASTImporterTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 746c4f7a7658..b0cc598a369a 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -1373,8 +1373,8 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportCorrectTemplatedDecl) {
   ASSERT_EQ(ToTemplated1, ToTemplated);
 }
 
-
-TEST_P(ASTImporterOptionSpecificTestBase, ImportTemplateSpecializationStaticMember) {
+TEST_P(ASTImporterOptionSpecificTestBase,
+       ImportTemplateSpecializationStaticMember) {
   auto FromCode = R"(
       template <typename H> class Test{
       public:
@@ -1397,14 +1397,14 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportTemplateSpecializationStaticMemb
     }
     )";
   Decl *FromTU = getTuDecl(FromCode, Lang_CXX14);
-  auto FromDecl =
-      FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("length"),isDefinition()));
-  Decl *ToTu = getToTuDecl(ToCode,Lang_CXX14);
+  auto FromDecl = FirstDeclMatcher<VarDecl>().match(
+      FromTU, varDecl(hasName("length"), isDefinition()));
+  Decl *ToTu = getToTuDecl(ToCode, Lang_CXX14);
   auto ToX = Import(FromDecl, Lang_CXX03);
-  auto ToDecl =
-      FirstDeclMatcher<VarDecl>().match(ToTu,varDecl(hasName("length"),isDefinition()));
+  auto ToDecl = FirstDeclMatcher<VarDecl>().match(
+      ToTu, varDecl(hasName("length"), isDefinition()));
   EXPECT_TRUE(ToX);
-  EXPECT_EQ(ToX,ToDecl);
+  EXPECT_EQ(ToX, ToDecl);
 }
 
 TEST_P(ASTImporterOptionSpecificTestBase, ImportChooseExpr) {

``````````

</details>


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


More information about the cfe-commits mailing list