[clang] [clang-repl] Introduce common fixture class in unittests (NFC) (PR #93816)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 05:46:40 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 662b1305292d69507a09164c911cfc782e0e4e73 fd02a874601b8a72d05c3c1b219e28600851b56b -- clang/unittests/Interpreter/InterpreterTestFixture.h clang/unittests/Interpreter/CodeCompletionTest.cpp clang/unittests/Interpreter/IncrementalProcessingTest.cpp clang/unittests/Interpreter/InterpreterExtensionsTest.cpp clang/unittests/Interpreter/InterpreterTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/unittests/Interpreter/CodeCompletionTest.cpp b/clang/unittests/Interpreter/CodeCompletionTest.cpp
index 89a86a5391..1dbd983da0 100644
--- a/clang/unittests/Interpreter/CodeCompletionTest.cpp
+++ b/clang/unittests/Interpreter/CodeCompletionTest.cpp
@@ -35,10 +35,11 @@ public:
   std::unique_ptr<CompilerInstance> CI;
   std::unique_ptr<Interpreter> Interp;
 
-  CodeCompletionTest() : CI(cantFail(CB.CreateCpp())), Interp(cantFail(clang::Interpreter::create(std::move(CI)))) {}
+  CodeCompletionTest()
+      : CI(cantFail(CB.CreateCpp())),
+        Interp(cantFail(clang::Interpreter::create(std::move(CI)))) {}
 
-  std::vector<std::string> runComp(llvm::StringRef Input,
-                                   llvm::Error &ErrR) {
+  std::vector<std::string> runComp(llvm::StringRef Input, llvm::Error &ErrR) {
     auto ComplCI = CB.CreateCpp();
     if (auto Err = ComplCI.takeError()) {
       ErrR = std::move(Err);
@@ -56,8 +57,8 @@ public:
     auto *ParentCI = this->Interp->getCompilerInstance();
     auto *MainCI = (*ComplInterp)->getCompilerInstance();
     auto CC = ReplCodeCompleter();
-    CC.codeComplete(MainCI, Input, /* Lines */ 1, Input.size() + 1,
-                    ParentCI, Results);
+    CC.codeComplete(MainCI, Input, /* Lines */ 1, Input.size() + 1, ParentCI,
+                    Results);
 
     for (auto Res : Results)
       if (Res.find(CC.Prefix) == 0)
diff --git a/clang/unittests/Interpreter/InterpreterTestFixture.h b/clang/unittests/Interpreter/InterpreterTestFixture.h
index 6b4cba2080..f8c99a26a1 100644
--- a/clang/unittests/Interpreter/InterpreterTestFixture.h
+++ b/clang/unittests/Interpreter/InterpreterTestFixture.h
@@ -44,24 +44,22 @@ protected:
 #endif
   }
 
-  void TearDown() override {
-  }
+  void TearDown() override {}
 
   static void SetUpTestSuite() {
     llvm::InitializeNativeTarget();
     llvm::InitializeNativeTargetAsmPrinter();
   }
 
-  static void TearDownTestSuite() {
-    llvm::llvm_shutdown();
-  }
+  static void TearDownTestSuite() { llvm::llvm_shutdown(); }
 };
 
-class InterpreterTestWithParams : public InterpreterTestBase,
-                                  public ::testing::WithParamInterface<TestClangConfig> {};
+class InterpreterTestWithParams
+    : public InterpreterTestBase,
+      public ::testing::WithParamInterface<TestClangConfig> {};
 
 } // namespace clang
 
-//#undef CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
+// #undef CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
 
 #endif // LLVM_CLANG_UNITTESTS_INTERPRETER_INTERPRETERTESTBASE_H

``````````

</details>


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


More information about the cfe-commits mailing list