[clang] [clang][CodeGen] Add missing error check (PR #81777)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 14 11:06:31 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-codegen

Author: Jacob Lambert (lamb-j)

<details>
<summary>Changes</summary>

Add missing error check. This resolves "error: variable 'Err' set but not used" warnings

---
Full diff: https://github.com/llvm/llvm-project/pull/81777.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CodeGenAction.cpp (+3) 


``````````diff
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index ab08a875e7e9c1..bb9aaba025fa59 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -291,6 +291,9 @@ bool BackendConsumer::LinkInModules(llvm::Module *M, bool ShouldLinkFiles) {
           });
     } else
       Err = Linker::linkModules(*M, std::move(LM.Module), LM.LinkFlags);
+
+    if (Err)
+      return true;
   }
 
   LinkModules.clear();

``````````

</details>


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


More information about the cfe-commits mailing list