[flang-commits] [flang] [flang][debug] Add debug type support for procedure pointers (PR #166764)

via flang-commits flang-commits at lists.llvm.org
Thu Nov 6 08:28:11 PST 2025


================
@@ -718,6 +718,30 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
     return convertRecordType(recTy, fileAttr, scope, declOp);
   } else if (auto tupleTy = mlir::dyn_cast_if_present<mlir::TupleType>(Ty)) {
     return convertTupleType(tupleTy, fileAttr, scope, declOp);
+  } else if (mlir::isa<mlir::FunctionType>(Ty)) {
+    // Handle function types - these represent procedure pointers after the
----------------
jeanPerier wrote:

Yes it is not because as far as lowering is concerned, it is not a variable/entity. But I imagine debug info needs to map the name. I agree this is out of the scope of your PR.

With your change, at least the debug type for the procedure with debug argument should be correct now.

```
subroutine foo(bar)
  external :: bar
end subroutine
```

was:

```
!4 = distinct !DISubprogram(name: "foo", linkageName: "foo_", scope: !1, file: !1, line: 1, type: !5, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0)
!5 = !DISubroutineType(cc: DW_CC_normal, types: !6)
!6 = !{null, !7}
!7 = !DIBasicType(name: "integer", size: 32, encoding: DW_ATE_signed)
```

and I think your patch is fixing `!7`

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


More information about the flang-commits mailing list