xref: /llvm-project/clang/test/Driver/clang-g-opts.c (revision 63d53ee3b07e3b13e176eb60d8c02dea365c5ddb)
1 // RUN: %clang -### -S %s        2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s
2 // RUN: %clang -### -S %s -g -target x86_64-linux-gnu 2>&1 \
3 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G %s
4 
5 // Assert that the toolchains which should default to a lower Dwarf version do so.
6 // RUN: %clang -### -S %s -g -target x86_64-apple-darwin8 2>&1 \
7 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
8 // RUN: %clang -### -S %s -g -target i686-pc-openbsd 2>&1 \
9 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
10 // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd 2>&1 \
11 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
12 // RUN: %clang -### -S %s -g --target=x86_64-unknown-haiku 2>&1 \
13 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
14 
15 // 'g0' is the default. Just basic correctness check that it does nothing
16 // RUN: %clang -### -S %s -g0    2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s
17 
18 // And check that the last of -g or -g0 wins.
19 // RUN: %clang -### -S %s -g -g0 2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s
20 
21 // These should be semantically the same as not having given 'g0' at all,
22 // as the last 'g' option wins.
23 //
24 // RUN: %clang -### -S %s -g0 -g -target x86_64-linux-gnu 2>&1 \
25 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G %s
26 // RUN: %clang -### -S %s -g0 -g -target x86_64-apple-darwin8 2>&1 \
27 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-STANDALONE %s
28 // RUN: %clang -### -S %s -g0 -g -target i686-pc-openbsd 2>&1 \
29 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
30 // RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd 2>&1 \
31 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
32 // RUN: %clang -### -S %s -g0 -g --target=x86_64-unknown-haiku 2>&1 \
33 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
34 // RUN: %clang -### -S %s -g0 -g --target=i386-pc-solaris 2>&1 \
35 // RUN:             | FileCheck --check-prefix=CHECK-WITH-G %s
36 
37 // CHECK-WITHOUT-G-NOT: -debug-info-kind
38 // CHECK-WITH-G: "-debug-info-kind=constructor"
39 // CHECK-WITH-G: "-dwarf-version=5"
40 // CHECK-WITH-G-DWARF4: "-dwarf-version=4"
41 // CHECK-WITH-G-DWARF2: "-dwarf-version=2"
42 
43 // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
44 // CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
45