[clang] [CIR] Integral types; simple global variables (PR #118743)

David Olsen via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 13:11:07 PST 2024


================
@@ -82,6 +83,14 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd,
   theModule.push_back(funcOp);
 }
 
+void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd,
+                                           bool isTentative) {
+  mlir::Type type = getTypes().convertType(vd->getType());
+  auto varOp = builder.create<cir::GlobalOp>(
+      getLoc(vd->getSourceRange()), vd->getIdentifier()->getName(), type);
----------------
dkolsen-pgi wrote:

Fixed.  The code checks `getIdentifier()`.  If it is null, an error is reported and the declaration is skipped.  This is temporary until the code handles non-identifier names.


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


More information about the cfe-commits mailing list