[clang] [clang][test] Fix test failures when LLVM_WINDOWS_PREFER_FORWARD_SLAS… (PR #193156)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 22:21:40 PDT 2026


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 origin/main HEAD --extensions cpp,c -- clang/test/DebugInfo/Generic/debug-prefix-map.c clang/test/Driver/ps4-ps5-linker-win.c clang/test/Frontend/dependency-gen-windows-duplicates.c clang/test/Preprocessor/file_test_windows.c clang/unittests/Basic/FileManagerTest.cpp clang/unittests/Driver/ToolChainTest.cpp clang/unittests/Frontend/ReparseWorkingDirTest.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp
index 1a789c992..737d9018c 100644
--- a/clang/unittests/Driver/ToolChainTest.cpp
+++ b/clang/unittests/Driver/ToolChainTest.cpp
@@ -828,8 +828,7 @@ TEST(ToolChainTest, ConfigInexistentInclude) {
 #define UNEXISTENT "/home/user/file.rsp"
 #endif
   FS->setCurrentWorkingDirectory(TestRoot);
-  FS->addFile(USERCONFIG, 0,
-              llvm::MemoryBuffer::getMemBuffer("@file.rsp"));
+  FS->addFile(USERCONFIG, 0, llvm::MemoryBuffer::getMemBuffer("@file.rsp"));
 
   {
     Driver TheDriver("/home/test/bin/clang", "arm-linux-gnueabi", Diags,
@@ -840,8 +839,9 @@ TEST(ToolChainTest, ConfigInexistentInclude) {
     ASSERT_TRUE(C);
     ASSERT_TRUE(C->containsError());
     EXPECT_EQ(1U, DiagConsumer->Errors.size());
-    // Expected path style in diagnostics depends on LLVM_WINDOWS_PREFER_FORWARD_SLASH.
-    // Construct the expected string dynamically to match the native path style.
+    // Expected path style in diagnostics depends on
+    // LLVM_WINDOWS_PREFER_FORWARD_SLASH. Construct the expected string
+    // dynamically to match the native path style.
     std::string ExpectedError =
         (std::string("cannot read configuration file '") +
          llvm::sys::path::native(USERCONFIG) + "': cannot not open file '" +
@@ -871,10 +871,8 @@ TEST(ToolChainTest, ConfigRecursiveInclude) {
 #define INCLUDED1 "/home/user/file1.cfg"
 #endif
   FS->setCurrentWorkingDirectory(TestRoot);
-  FS->addFile(USERCONFIG, 0,
-              llvm::MemoryBuffer::getMemBuffer("@file1.cfg"));
-  FS->addFile(INCLUDED1, 0,
-              llvm::MemoryBuffer::getMemBuffer("@file2.cfg"));
+  FS->addFile(USERCONFIG, 0, llvm::MemoryBuffer::getMemBuffer("@file1.cfg"));
+  FS->addFile(INCLUDED1, 0, llvm::MemoryBuffer::getMemBuffer("@file2.cfg"));
   FS->addFile("/home/user/file2.cfg", 0,
               llvm::MemoryBuffer::getMemBuffer("@file3.cfg"));
   FS->addFile("/home/user/file3.cfg", 0,
@@ -889,13 +887,13 @@ TEST(ToolChainTest, ConfigRecursiveInclude) {
     ASSERT_TRUE(C);
     ASSERT_TRUE(C->containsError());
     EXPECT_EQ(1U, DiagConsumer->Errors.size());
-    // Expected path style in diagnostics depends on LLVM_WINDOWS_PREFER_FORWARD_SLASH.
-    // Construct the expected string dynamically to match the native path style.
+    // Expected path style in diagnostics depends on
+    // LLVM_WINDOWS_PREFER_FORWARD_SLASH. Construct the expected string
+    // dynamically to match the native path style.
     std::string ExpectedError =
         (std::string("cannot read configuration file '") +
-         llvm::sys::path::native(USERCONFIG) +
-         "': recursive expansion of: '" + llvm::sys::path::native(INCLUDED1) +
-         "'");
+         llvm::sys::path::native(USERCONFIG) + "': recursive expansion of: '" +
+         llvm::sys::path::native(INCLUDED1) + "'");
     EXPECT_EQ(ExpectedError, DiagConsumer->Errors[0]);
   }
 

``````````

</details>


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


More information about the cfe-commits mailing list