[flang-commits] [flang] [flang][debug] Always include (kind=X) suffix in debug type names (PR #186255)

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Tue Mar 17 09:44:26 PDT 2026


================
@@ -79,8 +79,16 @@ static mlir::LLVM::DITypeAttr genBasicType(mlir::MLIRContext *context,
       context, llvm::dwarf::DW_TAG_base_type, name, bitSize, decoding);
 }
 
+static mlir::StringAttr getBasicTypeName(mlir::MLIRContext *context,
+                                         llvm::StringRef baseName,
+                                         unsigned bitSize) {
+  std::ostringstream oss;
+  oss << baseName.str() << "(kind=" << (bitSize / 8) << ")";
+  return mlir::StringAttr::get(context, oss.str());
+}
+
 static mlir::LLVM::DITypeAttr genPlaceholderType(mlir::MLIRContext *context) {
-  return genBasicType(context, mlir::StringAttr::get(context, "integer"),
+  return genBasicType(context, getBasicTypeName(context, "integer", 32),
----------------
abidh wrote:

I think 32 is ok as it we are passing `/*bitSize=*/32` as the next parameter. Please also note if this function gets called, it means there is a type in the FIR which we don't handle so type size is immaterial in that case. 

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


More information about the flang-commits mailing list