[flang-commits] [flang] [mlir] [flang] Add debug information for module variables. (PR #91582)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Thu May 9 08:09:51 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();
+
----------------
abidh wrote:

Thanks for letting me know. I have now opened #91604 with this change and a testcase. I will remove this bit from this PR.

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


More information about the flang-commits mailing list