Clang Project

clang_source_code/test/Driver/clang-g-opts.c
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-freebsd10.0 2>&1 \
11// RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
12
13// 'g0' is the default. Just sanity-test that it does nothing
14// RUN: %clang -### -S %s -g0    2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s
15
16// And check that the last of -g or -g0 wins.
17// RUN: %clang -### -S %s -g -g0 2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s
18
19// These should be semantically the same as not having given 'g0' at all,
20// as the last 'g' option wins.
21//
22// RUN: %clang -### -S %s -g0 -g -target x86_64-linux-gnu 2>&1 \
23// RUN:             | FileCheck --check-prefix=CHECK-WITH-G %s
24// RUN: %clang -### -S %s -g0 -g -target x86_64-apple-darwin8 2>&1 \
25// RUN:             | FileCheck --check-prefix=CHECK-WITH-G-STANDALONE %s
26// RUN: %clang -### -S %s -g0 -g -target i686-pc-openbsd 2>&1 \
27// RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
28// RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd10.0 2>&1 \
29// RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
30// RUN: %clang -### -S %s -g0 -g -target i386-pc-solaris 2>&1 \
31// RUN:             | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
32
33// CHECK-WITHOUT-G-NOT: -debug-info-kind
34// CHECK-WITH-G: "-debug-info-kind=limited"
35// CHECK-WITH-G: "-dwarf-version=4"
36// CHECK-WITH-G-DWARF2: "-dwarf-version=2"
37
38// CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
39// CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
40