Skip to content

Commit 85af192

Browse files
authored
[flang][debug] Support mlir::NoneType. (#113550)
1 parent d87964d commit 85af192

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

flang/lib/Optimizer/Transforms/DebugTypeGenerator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
581581
/*genAssociated=*/false);
582582
} else if (auto vecTy = mlir::dyn_cast_or_null<fir::VectorType>(Ty)) {
583583
return convertVectorType(vecTy, fileAttr, scope, declOp);
584+
} else if (mlir::isa<mlir::NoneType>(Ty)) {
585+
return mlir::LLVM::DINullTypeAttr::get(context);
584586
} else if (auto boxTy = mlir::dyn_cast_or_null<fir::BoxType>(Ty)) {
585587
auto elTy = boxTy.getElementType();
586588
if (auto seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(elTy))
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
2+
3+
module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
4+
func.func private @_FortranAAssign(i8) -> none loc(#loc1)
5+
func.func private @foo() -> !fir.ref<none> loc(#loc2)
6+
}
7+
#loc1 = loc("test.f90":5:1)
8+
#loc2 = loc("test.f90":15:1)
9+
10+
// CHECK: #[[INT8_TY:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "integer", sizeInBits = 8, encoding = DW_ATE_signed>
11+
// CHECK: #[[NONE_TY:.*]] = #llvm.di_null_type
12+
// CHECK: #[[REFNONE_TY:.*]] = #llvm.di_derived_type<tag = DW_TAG_pointer_type, name = "", baseType = #di_null_type{{.*}}>
13+
// CHECK: #llvm.di_subroutine_type<{{.*}}types = #[[NONE_TY]], #[[INT8_TY]]>
14+
// CHECK: #llvm.di_subroutine_type<{{.*}}types = #[[REFNONE_TY]]>

0 commit comments

Comments
 (0)