================
@@ -1044,6 +1057,24 @@ StringRef CIRGenModule::getMangledName(GlobalDecl gd) {
   return mangledDeclNames[canonicalGd] = result.first->first();
 }
 
+void CIRGenModule::emitTentativeDefinition(const VarDecl *d) {
+  assert(!d->getInit() && "Cannot emit definite definitions here!");
+
+  StringRef mangledName = getMangledName(d);
+  mlir::Operation *gv = getGlobalValue(mangledName);
+
+  // If we already have a definition, not declaration, with the same mangled
+  // name, emitting of declaration is not required (and would actually 
overwrite
+  // the emitted definition).
+  if (gv && !cast<cir::GlobalOp>(gv).isDeclaration())
----------------
xlauko wrote:

```suggestion
  if (gv && !mlir::cast<cir::GlobalOp>(gv).isDeclaration())
```

https://github.com/llvm/llvm-project/pull/141700
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to