[clang] [CodeGen] Add conditional to module cloning in bitcode linking (PR #72478)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 22:18:28 PST 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 c3b9c36f3ab4d9021951a00c9a6798e3fe0a48a5 3a2a066eeadce6b8f3cd5645965ffe564e68fba3 -- clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CodeGenAction.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index e3ceb3adbc..0c8ea52f4b 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -269,13 +269,12 @@ bool BackendConsumer::LinkInModules(llvm::Module *M, bool ShouldLinkFiles) {
 
       if (LM.Internalize) {
         Err = Linker::linkModules(
-          *M, std::move(Clone), LM.LinkFlags,
-          [](llvm::Module &M, const llvm::StringSet<> &GVS) {
-          internalizeModule(M, [&GVS](const llvm::GlobalValue &GV) {
-                            return !GV.hasName() ||
-                            (GVS.count(GV.getName()) == 0);
-                            });
-          });
+            *M, std::move(Clone), LM.LinkFlags,
+            [](llvm::Module &M, const llvm::StringSet<> &GVS) {
+              internalizeModule(M, [&GVS](const llvm::GlobalValue &GV) {
+                return !GV.hasName() || (GVS.count(GV.getName()) == 0);
+              });
+            });
       } else
         Err = Linker::linkModules(*M, std::move(Clone), LM.LinkFlags);
 
@@ -286,13 +285,12 @@ bool BackendConsumer::LinkInModules(llvm::Module *M, bool ShouldLinkFiles) {
     else {
       if (LM.Internalize) {
         Err = Linker::linkModules(
-          *M, std::move(LM.Module), LM.LinkFlags,
-          [](llvm::Module &M, const llvm::StringSet<> &GVS) {
-          internalizeModule(M, [&GVS](const llvm::GlobalValue &GV) {
-                            return !GV.hasName() ||
-                            (GVS.count(GV.getName()) == 0);
-                            });
-          });
+            *M, std::move(LM.Module), LM.LinkFlags,
+            [](llvm::Module &M, const llvm::StringSet<> &GVS) {
+              internalizeModule(M, [&GVS](const llvm::GlobalValue &GV) {
+                return !GV.hasName() || (GVS.count(GV.getName()) == 0);
+              });
+            });
       } else
         Err = Linker::linkModules(*M, std::move(LM.Module), LM.LinkFlags);
 

``````````

</details>


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


More information about the cfe-commits mailing list