llvm-project/flang/test/Integration/debug-dwarf-flags.f90
Abid Qadeer 453e4102bd
[flang] Lowering support for -gdwarf-N flag. (#159137)
This PR builds on the https://github.com/llvm/llvm-project/pull/158314
and adds the lowering support for `-gdwarf-N` flag. The changes to pass
the information to `AddDebugInfo` pass are mostly mechanical. The
`AddDebugInfo` pass adds `ModuleFlagsOp` in the module which gets
translated to correct llvm metadata during mlir->llvmir translation.

There is minor correction where the version is set to 0 in case no
-debug-version flag is provided. Previously it was set to 2 in this case
due to misreading of clang code.
2025-09-17 18:16:36 +01:00

24 lines
1.2 KiB
Fortran

! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone -dwarf-version=5 %s \
! RUN: -o - | FileCheck --check-prefix=CHECK-DWARF5 %s
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=line-tables-only -dwarf-version=5 \
! RUN: %s -o - | FileCheck --check-prefix=CHECK-DWARF5 %s
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone -dwarf-version=4 %s \
! RUN: -o - | FileCheck --check-prefix=CHECK-DWARF4 %s
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone -dwarf-version=3 %s \
! RUN: -o - | FileCheck --check-prefix=CHECK-DWARF3 %s
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone -dwarf-version=2 %s \
! RUN: -o - | FileCheck --check-prefix=CHECK-DWARF2 %s
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o -\
! RUN: | FileCheck --check-prefix=CHECK-WITHOUT-VERSION %s
! RUN: %flang_fc1 -emit-llvm -dwarf-version=5 %s -o - \
! RUN: | FileCheck --check-prefix=CHECK-WITHOUT-VERSION %s
program test
end program test
! CHECK-DWARF5: !{i32 7, !"Dwarf Version", i32 5}
! CHECK-DWARF4: !{i32 7, !"Dwarf Version", i32 4}
! CHECK-DWARF3: !{i32 7, !"Dwarf Version", i32 3}
! CHECK-DWARF2: !{i32 7, !"Dwarf Version", i32 2}
! CHECK-WITHOUT-VERSION-NOT: "Dwarf Version"