[flang-commits] [flang] [mlir] [flang] Add debug information for module variables. (PR #91582)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Thu May 9 04:42:02 PDT 2024
================
@@ -1030,10 +1030,15 @@ LogicalResult ModuleTranslation::convertGlobals() {
llvm::DIGlobalVariable *diGlobalVar = diGlobalExpr->getVariable();
var->addDebugInfo(diGlobalExpr);
+ // For fortran, the scope hierarchy can be
+ // variable -> module -> compile unit
+ llvm::DIScope *scope = diGlobalVar->getScope();
+ if (llvm::DIModule *mod = dyn_cast_if_present<llvm::DIModule>(scope))
+ scope = mod->getScope();
+
----------------
kiranchandramohan wrote:
Changes to MLIR should go in as a separate patch. And a test is required for the MLIR changes in I guess `mlir/test/Target/LLVMIR/llvmir-debug.mlir`.
https://github.com/llvm/llvm-project/pull/91582
More information about the flang-commits
mailing list