[clang] [CIR] Upstream global variable linkage types (PR #129072)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 09:35:48 PST 2025


================
@@ -176,6 +177,18 @@ void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd,
       }
       varOp.setInitialValueAttr(initializer);
     }
+
+    // Set CIR's linkage type as appropriate.
+    cir::GlobalLinkageKind linkage =
+        getCIRLinkageVarDefinition(vd, /*IsConstant=*/false);
+
+    // Set CIR linkage and DLL storage class.
+    varOp.setLinkage(linkage);
+
+    if (linkage == cir::GlobalLinkageKind::CommonLinkage) {
----------------
andykaylor wrote:

No need for curly braces here. They're omitted for single-line scopes in LLVM's coding style.

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


More information about the cfe-commits mailing list