xref: /llvm-project/flang/test/Transforms/debug-allocatable-1.fir (revision 0432221c8e6a8e5740a982076a6ae85e5ee9909e)
1// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
2
3
4module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
5  func.func private @_QFPff()  {
6    %c1 = arith.constant 1 : index
7    %c0 = arith.constant 0 : index
8    %0 = fir.undefined !fir.dscope
9    %1 = fir.alloca !fir.box<!fir.heap<!fir.array<?x?xi32>>> {bindc_name = "ar2", uniq_name = "_QFFffEar2"}
10    %4 = fircg.ext_declare %1 {uniq_name = "_QFFffEar2"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x?xi32>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xi32>>>>  loc(#loc1)
11    %15 = fir.alloca !fir.box<!fir.heap<f32>> {bindc_name = "sc", uniq_name = "_QFFffEsc"}
12    %18 = fircg.ext_declare %15 {uniq_name = "_QFFffEsc"} : (!fir.ref<!fir.box<!fir.heap<f32>>>) -> !fir.ref<!fir.box<!fir.heap<f32>>> loc(#loc2)
13    return
14  } loc(#loc3)
15}
16
17#loc1 = loc("test.f90":3:3)
18#loc2 = loc("test.f90":4:3)
19#loc3 = loc("test.f90":1:3)
20
21// CHECK-DAG: #[[TY1:.*]] = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "real"{{.*}}>
22// CHECK-DAG: #[[TY2:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}#llvm.di_subrange{{.*}}#llvm.di_subrange{{.*}}allocated = <[DW_OP_push_object_address, DW_OP_deref, DW_OP_lit0, DW_OP_ne]>>
23// CHECK-DAG: #[[TY3:.*]] = #llvm.di_derived_type<tag = DW_TAG_pointer_type{{.*}}baseType = #[[TY1]]{{.*}}>
24
25// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "ar2"{{.*}}type = #[[TY2]]>
26// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "sc"{{.*}}type = #[[TY3]]>
27