[flang-commits] [flang] [flang] Lowering support for -gdwarf-N flag. (PR #159137)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Tue Sep 16 11:29:33 PDT 2025


================
@@ -0,0 +1,24 @@
+! 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-DEBUG-KIND %s
----------------
tarunprabhu wrote:

It looks like both `CHECK-WITHOUT-VERSION` and `CHECK-WITHOUT-DEBUG-KIND` check for the absence of "Dwarf version" in the output. We can probably just use `CHECK-WITHOUT-VERSION` here to eliminate redundant check prefixes.

```suggestion
! RUN:         | FileCheck --check-prefix=CHECK-WITHOUT-VERSION %s
```

https://github.com/llvm/llvm-project/pull/159137


More information about the flang-commits mailing list