[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader sets textual headers' HeaderFileInfo non-external when it shouldn't (PR #89005)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 17:06:22 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 602634d70cba2c51f6177740c4a98a377d10ab6a f6bcc20d07248069dee1ff19c1aa334152b311a8 -- clang/include/clang/Lex/HeaderSearch.h clang/lib/Lex/HeaderSearch.cpp clang/unittests/Lex/HeaderSearchTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/unittests/Lex/HeaderSearchTest.cpp b/clang/unittests/Lex/HeaderSearchTest.cpp
index b55d52df14..8bea41c642 100644
--- a/clang/unittests/Lex/HeaderSearchTest.cpp
+++ b/clang/unittests/Lex/HeaderSearchTest.cpp
@@ -350,15 +350,19 @@ TEST_F(HeaderSearchTest, HeaderFileInfoMerge) {
   EXPECT_TRUE(Search.getExistingFileInfo(TextualFE)->External);
 
   // Marking the same role should keep it external
-  Search.MarkFileModuleHeader(ModularFE, ModuleMap::NormalHeader, /*isCompilingModuleHeader=*/false);
-  Search.MarkFileModuleHeader(TextualFE, ModuleMap::TextualHeader, /*isCompilingModuleHeader=*/false);
+  Search.MarkFileModuleHeader(ModularFE, ModuleMap::NormalHeader,
+                              /*isCompilingModuleHeader=*/false);
+  Search.MarkFileModuleHeader(TextualFE, ModuleMap::TextualHeader,
+                              /*isCompilingModuleHeader=*/false);
   EXPECT_TRUE(Search.getExistingFileInfo(ModularFE)->External);
   EXPECT_TRUE(Search.getExistingFileInfo(TextualFE)->External);
 
   // textual -> modular should update the HFI, but modular -> textual should be
   // a no-op.
-  Search.MarkFileModuleHeader(ModularFE, ModuleMap::TextualHeader, /*isCompilingModuleHeader=*/false);
-  Search.MarkFileModuleHeader(TextualFE, ModuleMap::NormalHeader, /*isCompilingModuleHeader=*/false);
+  Search.MarkFileModuleHeader(ModularFE, ModuleMap::TextualHeader,
+                              /*isCompilingModuleHeader=*/false);
+  Search.MarkFileModuleHeader(TextualFE, ModuleMap::NormalHeader,
+                              /*isCompilingModuleHeader=*/false);
   auto ModularFI = Search.getExistingFileInfo(ModularFE);
   auto TextualFI = Search.getExistingFileInfo(TextualFE);
   EXPECT_TRUE(ModularFI->External);
@@ -369,8 +373,10 @@ TEST_F(HeaderSearchTest, HeaderFileInfoMerge) {
   EXPECT_FALSE(ModularFI->isTextualModuleHeader);
 
   // Compiling the module should make the HFI local.
-  Search.MarkFileModuleHeader(ModularFE, ModuleMap::NormalHeader, /*isCompilingModuleHeader=*/true);
-  Search.MarkFileModuleHeader(TextualFE, ModuleMap::NormalHeader, /*isCompilingModuleHeader=*/true);
+  Search.MarkFileModuleHeader(ModularFE, ModuleMap::NormalHeader,
+                              /*isCompilingModuleHeader=*/true);
+  Search.MarkFileModuleHeader(TextualFE, ModuleMap::NormalHeader,
+                              /*isCompilingModuleHeader=*/true);
   EXPECT_FALSE(Search.getExistingFileInfo(ModularFE)->External);
   EXPECT_FALSE(Search.getExistingFileInfo(TextualFE)->External);
 }

``````````

</details>


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


More information about the cfe-commits mailing list