Skip to content

Commit 01eed26

Browse files
committed
[flang][debug] Support mlir::NoneType.
1 parent c07abf7 commit 01eed26

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
@@ -516,6 +516,8 @@ DebugTypeGenerator::convertType(mlir::Type Ty, mlir::LLVM::DIFileAttr fileAttr,
516516
return convertPointerLikeType(elTy, fileAttr, scope, declOp,
517517
/*genAllocated=*/false,
518518
/*genAssociated=*/false);
519+
} else if (mlir::isa<mlir::NoneType>(Ty)) {
520+
return mlir::LLVM::DINullTypeAttr::get(context);
519521
} else if (auto boxTy = mlir::dyn_cast_or_null<fir::BoxType>(Ty)) {
520522
auto elTy = boxTy.getElementType();
521523
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)