[flang-commits] [flang] [flang][debug] Handle array types with variable size/bounds. (PR #110686)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Thu Oct 3 05:05:34 PDT 2024


================
@@ -78,6 +78,33 @@ static mlir::LLVM::DITypeAttr genPlaceholderType(mlir::MLIRContext *context) {
                       /*bitSize=*/32, llvm::dwarf::DW_ATE_signed);
 }
 
+// Helper function to create DILocalVariableAttr and DbgValueOp when information
+// about the size or dimension of a variable etc lives in an mlir::Value.
+mlir::LLVM::DILocalVariableAttr DebugTypeGenerator::generateArtificialVariable(
+    mlir::MLIRContext *context, mlir::Value Val,
+    mlir::LLVM::DIFileAttr fileAttr, mlir::LLVM::DIScopeAttr scope,
+    fir::cg::XDeclareOp declOp) {
+  // There can be multiple artificial variable for a single declOp. To help
+  // distinguish then, we pad the name with a counter. This static variable
+  // helps us achieve that.
+  static unsigned varID = 0;
----------------
abidh wrote:

Thanks for your comments. Using operand position is indeed a good suggestion as it makes the output more deterministic. I have updated the PR.

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


More information about the flang-commits mailing list