[clang] [clang-repl] Fix generation of wasm binaries while running clang-repl in browser (PR #117978)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 28 00:35:53 PST 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 332719561000dcac94384234ace1fa959362ad8e 987f77db9d45dee264c60f434652131438784f6f --extensions cpp -- clang/lib/Interpreter/Interpreter.cpp clang/lib/Interpreter/Wasm.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index 0fd6ad509c..4c9149663e 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -41,12 +41,12 @@ struct DriverDef {
 };
 
 struct Result {
-    int retCode;
-    bool canRunAgain;
+  int retCode;
+  bool canRunAgain;
 };
 
 Result lldMain(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
-                llvm::raw_ostream &stderrOS, llvm::ArrayRef<DriverDef> drivers);
+               llvm::raw_ostream &stderrOS, llvm::ArrayRef<DriverDef> drivers);
 
 namespace wasm {
 bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
@@ -76,8 +76,10 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
   llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
       PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
   PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
-  std::string ObjectFileName = PTU.TheModule->getName().str() + ".o";  // For the wasm object
-  std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm";  // For the wasm binary
+  std::string ObjectFileName =
+      PTU.TheModule->getName().str() + ".o"; // For the wasm object
+  std::string BinaryFileName =
+      PTU.TheModule->getName().str() + ".wasm"; // For the wasm binary
 
   std::error_code Error;
   llvm::raw_fd_ostream ObjectFileOutput(llvm::StringRef(ObjectFileName), Error);
@@ -109,7 +111,8 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
   const lld::DriverDef WasmDriver = {lld::Flavor::Wasm, &lld::wasm::link};
   std::vector<lld::DriverDef> WasmDriverArgs;
   WasmDriverArgs.push_back(WasmDriver);
-  lld::Result Result = lld::lldMain(LinkerArgs, llvm::outs(), llvm::errs(), WasmDriverArgs);
+  lld::Result Result =
+      lld::lldMain(LinkerArgs, llvm::outs(), llvm::errs(), WasmDriverArgs);
 
   if (Result.retCode != 0)
     return llvm::make_error<llvm::StringError>(

``````````

</details>


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


More information about the cfe-commits mailing list