Skip to content

Commit 3e6b1a9

Browse files
committed
added test
1 parent a0946b8 commit 3e6b1a9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

clang/test/CodeGen/dwarf-version.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@
5151
// RUN: not %clang -target powerpc64-ibm-aix-xcoff -gdwarf-5 -S -emit-llvm -o - %s 2>&1| \
5252
// RUN: FileCheck %s --check-prefix=UNSUPPORTED-VER5
5353

54+
// Check what version of dwarf is used to emit debug info when compiling ir with clang.
55+
// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s \
56+
// RUN: | %clang -target x86_64-linux-gnu -gdwarf-4 -x ir -c -o - - \
57+
// RUN: | llvm-dwarfdump -v - \
58+
// RUN: | FileCheck %s --check-prefix=SINGLE-4
59+
// RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s \
60+
// RUN: | %clang -target x86_64-linux-gnu -g -x ir -c -o - - \
61+
// RUN: | llvm-dwarfdump -v - \
62+
// RUN: | FileCheck %s --check-prefix=SINGLE-5
63+
5464
int main (void) {
5565
return 0;
5666
}
@@ -67,3 +77,11 @@ int main (void) {
6777
// CODEVIEW: !{i32 2, !"CodeView", i32 1}
6878
// NOCODEVIEW-NOT: !"CodeView"
6979
// NODWARF-NOT: !"Dwarf Version"
80+
81+
// SINGLE-4: .debug_info contents:
82+
// SINGLE-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004, abbr_offset
83+
// SINGLE-4: 0x0000000b: DW_TAG_compile_unit
84+
85+
// SINGLE-5: .debug_info contents:
86+
// SINGLE-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005, unit_type = DW_UT_compile, abbr_offset
87+
// SINGLE-5: 0x0000000c: DW_TAG_compile_unit

0 commit comments

Comments
 (0)