Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / clang-g-opts.c
blobb1cdf411925aea11f0fb5711799a9c702ba4f470
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
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-freebsd10.0 2>&1 \
11 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
12 // RUN: %clang -### -S %s -g --target=x86_64-unknown-haiku 2>&1 \
13 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
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
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
21 // These should be semantically the same as not having given 'g0' at all,
22 // as the last 'g' option wins.
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-freebsd10.0 2>&1 \
31 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %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
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"
43 // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
44 // CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
46 /// TODO: Special case before R_RISCV_SET_ULEB128 linker support becomes more widely available.
47 // RUN: %clang -### -S %s -g --target=riscv64-linux-gnu 2>&1 | FileCheck --check-prefix=VERSION4 %s
48 // RUN: %clang -### -S %s -g --target=riscv64-unknown-elf 2>&1 | FileCheck --check-prefix=VERSION4 %s
49 // VERSION4: "-dwarf-version=4"