[flang-commits] [flang] [flang][debug] Add support for common blocks. (PR #112398)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Tue Jan 28 04:23:32 PST 2025


================
@@ -2994,11 +2994,10 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
     llvm::SmallVector<mlir::Attribute> dbgExprs;
 
     if (auto fusedLoc = mlir::dyn_cast<mlir::FusedLoc>(global.getLoc())) {
-      if (auto gvAttr =
-              mlir::dyn_cast_or_null<mlir::LLVM::DIGlobalVariableAttr>(
-                  fusedLoc.getMetadata())) {
-        dbgExprs.push_back(mlir::LLVM::DIGlobalVariableExpressionAttr::get(
-            global.getContext(), gvAttr, mlir::LLVM::DIExpressionAttr()));
+      if (auto gvExprAttr = mlir::dyn_cast_if_present<mlir::ArrayAttr>(
+              fusedLoc.getMetadata())) {
+        for (auto attr : gvExprAttr.getAsRange<mlir::Attribute>())
----------------
abidh wrote:

Although only `DIGlobalVariableExpressionAttr` are added in ArrayAttr at the moment but I guess it is better to have this check to be safe. I will add it before merge. Please also see my comments [here](https://github.com/llvm/llvm-project/pull/111981#discussion_r1796985855) on why this interface is relatively less type strict.

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


More information about the flang-commits mailing list