[Mlir-commits] [mlir] [mlir] Allow setting of Dwarf version information. (PR #158692)

Tobias Gysi llvmlistbot at llvm.org
Mon Sep 15 10:44:29 PDT 2025


================
@@ -53,6 +54,13 @@ void DebugTranslation::addModuleFlagsIfNotPresent() {
     if (!llvmModule.getModuleFlag(kCodeViewKey))
       llvmModule.addModuleFlag(llvm::Module::Warning, kCodeViewKey, 1);
   }
+  if (auto attr = module->getAttrOfType<IntegerAttr>(
+          LLVM::LLVMDialect::getDwarfVersionAttrName())) {
+    int32_t attrValue = attr.getInt();
+    assert((attrValue >= 2 && attrValue <= 5) && "Unsupported DWARF version");
----------------
gysit wrote:

Any chance can emit an error diagnostics and return failure here (ideally including a small test)? A warning may also be appropriate if the information can be dropped safely. 

An assert seems a bit hard since an input IR change may trigger the assert.

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


More information about the Mlir-commits mailing list