xref: /llvm-project/flang/test/Lower/macro-debug-file-loc.f90 (revision c87e94b0303cef11d24c5a3cf14bec570d850362)
1! Test that the expanded macros have the location information
2! RUN: %flang_fc1 -mmlir --mlir-print-debuginfo -emit-fir -o - %s | FileCheck %s
3
4#define CMD(fname) fname()
5
6subroutine foo()
7end subroutine
8
9subroutine test()
10  ! CHECK: fir.call @_QPfoo() fastmath<contract> : () -> () loc(#[[CALL_LOC:.*]])
11  call CMD(foo)
12end subroutine
13
14#define IVAR i
15
16integer function ifoo()
17  ifoo = 0
18end function
19
20subroutine test2()
21  integer :: i
22  ! CHECK: fir.call @_QPifoo(){{.*}} loc(#[[IFOO_CALL_LOC:.*]])
23  IVAR = ifoo()
24end subroutine
25
26! CHECK: #[[CALL_LOC]] = loc("{{.*}}macro-debug-file-loc.f90":11:3)
27! CHECK: #[[IFOO_CALL_LOC]] = loc("{{.*}}macro-debug-file-loc.f90":23:3)
28