mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 04:26:37 +00:00

When a CharBlock starts with an expanded macro but does not end in this macro expansion, GetProvenanceRange fails to return a ProvenanceRange which may cause error message to be emitted without location or lowering to emit code without source location (which is problematic if this code contains calls to procedures defined in the same file since LLVM will later crash with the error: "inlinable function call in a function with a DISubprogram location must have a debug location" Fix this situation by returning the ProvenanceRange starting at the replaced macro reference.
28 lines
673 B
Fortran
28 lines
673 B
Fortran
! Test that the expanded macros have the location information
|
|
! RUN: %flang_fc1 -mmlir --mlir-print-debuginfo -emit-fir -o - %s | FileCheck %s
|
|
|
|
#define CMD(fname) fname()
|
|
|
|
subroutine foo()
|
|
end subroutine
|
|
|
|
subroutine test()
|
|
! CHECK: fir.call @_QPfoo() fastmath<contract> : () -> () loc(#[[CALL_LOC:.*]])
|
|
call CMD(foo)
|
|
end subroutine
|
|
|
|
#define IVAR i
|
|
|
|
integer function ifoo()
|
|
ifoo = 0
|
|
end function
|
|
|
|
subroutine test2()
|
|
integer :: i
|
|
! CHECK: fir.call @_QPifoo(){{.*}} loc(#[[IFOO_CALL_LOC:.*]])
|
|
IVAR = ifoo()
|
|
end subroutine
|
|
|
|
! CHECK: #[[CALL_LOC]] = loc("{{.*}}macro-debug-file-loc.f90":11:3)
|
|
! CHECK: #[[IFOO_CALL_LOC]] = loc("{{.*}}macro-debug-file-loc.f90":23:3)
|