[flang-commits] [flang] [flang][debug] Handle allocatable strings. (PR #95906)

via flang-commits flang-commits at lists.llvm.org
Mon Jun 24 04:31:33 PDT 2024


================
@@ -192,10 +194,8 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertSequenceType(
 
 mlir::LLVM::DITypeAttr DebugTypeGenerator::convertCharacterType(
     fir::CharacterType charTy, mlir::LLVM::DIFileAttr fileAttr,
-    mlir::LLVM::DIScopeAttr scope, mlir::Location loc) {
+    mlir::LLVM::DIScopeAttr scope, mlir::Location loc, bool allocatable) {
----------------
jeanPerier wrote:

I meant more the assumed shape array cases where the length is inside the decsriptor:
```
subroutine test(c)
  character(*) ::  c(:)
  c = "hello"
  print *, c(1)
end subroutine
```

I was wondering if my approach to get length of the string in this case seems right to you?

When you say "create an artificial variable", you mean to create alloca for it, or to use something llvm.dbg.value? I would favor the dbg.value if that works. In any case, yes, the `typeparams ` argument is the one to use for the length here. 

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


More information about the flang-commits mailing list