[llvm] [Support] Add VirtualOutputBackends to virtualize the output from tools (PR #68447)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 14:06:34 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 5d2a7101b72a8cae8c4c1f7a11ede7f656efd583 58763b6dcc5682636073a22a574f85b19fce9e70 -- llvm/include/llvm/Support/HashingOutputBackend.h llvm/include/llvm/Support/VirtualOutputBackend.h llvm/include/llvm/Support/VirtualOutputBackends.h llvm/include/llvm/Support/VirtualOutputConfig.h llvm/include/llvm/Support/VirtualOutputError.h llvm/include/llvm/Support/VirtualOutputFile.h llvm/include/llvm/Support/raw_ostream_proxy.h llvm/lib/Support/VirtualOutputBackend.cpp llvm/lib/Support/VirtualOutputBackends.cpp llvm/lib/Support/VirtualOutputConfig.cpp llvm/lib/Support/VirtualOutputError.cpp llvm/lib/Support/VirtualOutputFile.cpp llvm/lib/Support/raw_ostream_proxy.cpp llvm/unittests/Support/VirtualOutputBackendTest.cpp llvm/unittests/Support/VirtualOutputBackendsTest.cpp llvm/unittests/Support/VirtualOutputConfigTest.cpp llvm/unittests/Support/VirtualOutputFileTest.cpp llvm/unittests/Support/raw_ostream_proxy_test.cpp clang/include/clang/Frontend/CompilerInstance.h clang/lib/Frontend/CompilerInstance.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index f00eb145d8d2..56bb53f4e3bb 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -819,7 +819,8 @@ void CompilerInstance::setOutputBackend(
 
 void CompilerInstance::createOutputBackend() {
   assert(!TheOutputBackend && "Already has an output manager");
-  TheOutputBackend = llvm::makeIntrusiveRefCnt<llvm::vfs::OnDiskOutputBackend>();
+  TheOutputBackend =
+      llvm::makeIntrusiveRefCnt<llvm::vfs::OnDiskOutputBackend>();
 }
 
 llvm::vfs::OutputBackend &CompilerInstance::getOutputBackend() {
diff --git a/llvm/lib/Support/VirtualOutputBackends.cpp b/llvm/lib/Support/VirtualOutputBackends.cpp
index 4b8b35b68826..e3b7464dd59b 100644
--- a/llvm/lib/Support/VirtualOutputBackends.cpp
+++ b/llvm/lib/Support/VirtualOutputBackends.cpp
@@ -523,7 +523,7 @@ Error OnDiskOutputFile::keep() {
 
     case FileDifference::SameContents:
       // Files are identical; remove the source file.
-      (void) sys::fs::remove(*TempPath);
+      (void)sys::fs::remove(*TempPath);
       return Error::success();
 
     case FileDifference::DifferentContents:
diff --git a/llvm/unittests/Support/VirtualOutputFileTest.cpp b/llvm/unittests/Support/VirtualOutputFileTest.cpp
index 486218513f3d..8712bf048944 100644
--- a/llvm/unittests/Support/VirtualOutputFileTest.cpp
+++ b/llvm/unittests/Support/VirtualOutputFileTest.cpp
@@ -150,10 +150,10 @@ TEST(VirtualOutputFileTest, discard) {
     EXPECT_EQ(1, Data.Discarded);
 
 #if GTEST_HAS_DEATH_TEST
-    EXPECT_DEATH(
-        consumeError(F.keep()), "some/file/path: output already closed");
-    EXPECT_DEATH(
-        consumeError(F.discard()), "some/file/path: output already closed");
+    EXPECT_DEATH(consumeError(F.keep()),
+                 "some/file/path: output already closed");
+    EXPECT_DEATH(consumeError(F.discard()),
+                 "some/file/path: output already closed");
 #endif
   }
   EXPECT_EQ(0, Data.Kept);
@@ -230,10 +230,10 @@ TEST(VirtualOutputFileTest, keep) {
     EXPECT_EQ(0, Data.Discarded);
 
 #if GTEST_HAS_DEATH_TEST
-    EXPECT_DEATH(
-        consumeError(F.keep()), "some/file/path: output already closed");
-    EXPECT_DEATH(
-        consumeError(F.discard()), "some/file/path: output already closed");
+    EXPECT_DEATH(consumeError(F.keep()),
+                 "some/file/path: output already closed");
+    EXPECT_DEATH(consumeError(F.discard()),
+                 "some/file/path: output already closed");
 #endif
   }
   EXPECT_EQ(1, Data.Kept);

``````````

</details>


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


More information about the llvm-commits mailing list