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

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Jun 18 08:17:26 PDT 2024


================
@@ -205,16 +205,38 @@ mlir::LLVM::DITypeAttr DebugTypeGenerator::convertCharacterType(
   if (charTy.getFKind() != 1)
     encoding = llvm::dwarf::DW_ATE_UCS;
 
+  uint64_t sizeInBits = 0;
+  mlir::LLVM::DIExpressionAttr lenExpr = nullptr;
+  mlir::LLVM::DIExpressionAttr locExpr = nullptr;
+
+  if (allocatable) {
+    llvm::SmallVector<mlir::LLVM::DIExpressionElemAttr> ops;
+    auto addOp = [&](unsigned opc, llvm::ArrayRef<uint64_t> vals) {
+      ops.push_back(mlir::LLVM::DIExpressionElemAttr::get(context, opc, vals));
----------------
tblah wrote:

ultra nit: this might be very slightly faster, feel free to ignore if you feel this harms readability
```suggestion
      ops.emplace_back(context, opc, vals);
```

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


More information about the flang-commits mailing list