[clang] [MS] Put dllexported inline global initializers in a comdat (PR #107154)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 16:42:43 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 24b6b82487f15dd9d6cbe8a716dd13a6808a2528 3cb368a8c01f99a7b12ece55e5b2145650d4f89d --extensions cpp -- clang/lib/CodeGen/CGDeclCXX.cpp clang/test/CodeGenCXX/microsoft-abi-template-static-init.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 1ae8a2674d..8dcb5f6100 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -596,9 +596,9 @@ CodeGenModule::EmitCXXGlobalVarDeclInitFunc(const VarDecl *D,
     // optimization. For dynamic, non-hidden symbols, the weak guard variable
     // remains to ensure that other DSOs do not re-initialize the global.
     //
-    // For PE-COFF platforms, there is no guard variable, and COMDAT associativity
-    // is the only way to ensure vauge linkage globals are initialized exactly
-    // once.
+    // For PE-COFF platforms, there is no guard variable, and COMDAT
+    // associativity is the only way to ensure vauge linkage globals are
+    // initialized exactly once.
     //
     // MachO is the only remaining platform with no comdats that doesn't
     // benefit from this optimization. The rest are mainly modeled on ELF

``````````

</details>


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


More information about the cfe-commits mailing list