[clang] [CIR] Add support for global linkage and visibility (PR #141973)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Thu May 29 23:46:59 PDT 2025


================
@@ -1075,6 +1089,135 @@ void CIRGenModule::emitTentativeDefinition(const VarDecl *d) {
   emitGlobalVarDefinition(d);
 }
 
+static bool shouldAssumeDSOLocal(const CIRGenModule &cgm,
+                                 cir::CIRGlobalValueInterface gv) {
+  if (gv.hasLocalLinkage())
+    return true;
+
+  if (!gv.hasDefaultVisibility() && !gv.hasExternalWeakLinkage())
+    return true;
+
+  // DLLImport explicitly marks the GV as external.
+  // so it shouldn't be dso_local
+  // But we don't have the info set now
+  assert(!cir::MissingFeatures::opGlobalDLLImportExport());
+
+  const llvm::Triple &tt = cgm.getTriple();
+  const auto &cgOpts = cgm.getCodeGenOpts();
----------------
bcardosolopes wrote:

Probably not use `auto` here.

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


More information about the cfe-commits mailing list