xref: /minix3/external/bsd/llvm/dist/clang/test/Driver/debug-options.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // Check to make sure clang is somewhat picky about -g options.
2f4a2713aSLionel Sambuc // rdar://10383444
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
5f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G %s
6f4a2713aSLionel Sambuc // RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
7f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G %s
8f4a2713aSLionel Sambuc // RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \
9f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G %s
10f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
11f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G %s
12f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
13f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G %s
14f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
15f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G %s
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
18f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G_DARWIN %s
19f4a2713aSLionel Sambuc // RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \
20f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G_DARWIN %s
21f4a2713aSLionel Sambuc // RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \
22f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G_DARWIN %s
23f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \
24f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G_DARWIN %s
25f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \
26f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G_DARWIN %s
27f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \
28f4a2713aSLionel Sambuc                     | FileCheck -check-prefix=G_DARWIN %s
29f4a2713aSLionel Sambuc 
30f4a2713aSLionel Sambuc // RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s
31f4a2713aSLionel Sambuc //
32f4a2713aSLionel Sambuc // RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s
33f4a2713aSLionel Sambuc // RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
34f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
35f4a2713aSLionel Sambuc //
36*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -g1 %s 2>&1 \
37*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=GLTO_ONLY %s
38*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gmlt %s 2>&1 \
39*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=GLTO_ONLY %s
40f4a2713aSLionel Sambuc // RUN: %clang -### -c -gline-tables-only %s 2>&1 \
41f4a2713aSLionel Sambuc // RUN:             | FileCheck -check-prefix=GLTO_ONLY %s
42*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \
43*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
44*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gline-tables-only %s -target i686-pc-openbsd 2>&1 \
45*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
46*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gline-tables-only %s -target x86_64-pc-freebsd10.0 2>&1 \
47*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
48f4a2713aSLionel Sambuc // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \
49f4a2713aSLionel Sambuc // RUN:             | FileCheck -check-prefix=G_ONLY %s
50f4a2713aSLionel Sambuc // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin 2>&1 \
51*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
52*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gline-tables-only -g %s -target i686-pc-openbsd 2>&1 \
53*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
54*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
55*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
56*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gline-tables-only -g %s -target i386-pc-solaris 2>&1 \
57*0a6a1f1dSLionel Sambuc // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
58f4a2713aSLionel Sambuc // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
59f4a2713aSLionel Sambuc // RUN:             | FileCheck -check-prefix=GLTO_NO %s
60f4a2713aSLionel Sambuc //
61f4a2713aSLionel Sambuc // RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \
62*0a6a1f1dSLionel Sambuc // RUN:        -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
63f4a2713aSLionel Sambuc // RUN:        | FileCheck -check-prefix=GIGNORE %s
64f4a2713aSLionel Sambuc //
65f4a2713aSLionel Sambuc // RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s
66f4a2713aSLionel Sambuc //
67*0a6a1f1dSLionel Sambuc // RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
68*0a6a1f1dSLionel Sambuc //
69*0a6a1f1dSLionel Sambuc // RUN: %clang -### -fdebug-types-section %s 2>&1 \
70*0a6a1f1dSLionel Sambuc // RUN:        | FileCheck -check-prefix=FDTS %s
71*0a6a1f1dSLionel Sambuc //
72*0a6a1f1dSLionel Sambuc // RUN: %clang -### -fdebug-types-section -fno-debug-types-section %s 2>&1 \
73*0a6a1f1dSLionel Sambuc // RUN:        | FileCheck -check-prefix=NOFDTS %s
74*0a6a1f1dSLionel Sambuc //
75*0a6a1f1dSLionel Sambuc // RUN: %clang -### -g -gno-column-info %s 2>&1 \
76*0a6a1f1dSLionel Sambuc // RUN:        | FileCheck -check-prefix=NOCI %s
77*0a6a1f1dSLionel Sambuc //
78*0a6a1f1dSLionel Sambuc // RUN: %clang -### -g %s 2>&1 | FileCheck -check-prefix=CI %s
79*0a6a1f1dSLionel Sambuc //
80f4a2713aSLionel Sambuc // G: "-cc1"
81f4a2713aSLionel Sambuc // G: "-g"
82f4a2713aSLionel Sambuc //
83f4a2713aSLionel Sambuc // G_DARWIN: "-cc1"
84f4a2713aSLionel Sambuc // G_DARWIN: "-gdwarf-2"
85f4a2713aSLionel Sambuc //
86f4a2713aSLionel Sambuc // G_D2: "-cc1"
87f4a2713aSLionel Sambuc // G_D2: "-gdwarf-2"
88f4a2713aSLionel Sambuc //
89f4a2713aSLionel Sambuc // G_NO: "-cc1"
90f4a2713aSLionel Sambuc // G_NO-NOT: "-g"
91f4a2713aSLionel Sambuc //
92f4a2713aSLionel Sambuc // GLTO_ONLY: "-cc1"
93f4a2713aSLionel Sambuc // GLTO_ONLY-NOT: "-g"
94f4a2713aSLionel Sambuc // GLTO_ONLY: "-gline-tables-only"
95f4a2713aSLionel Sambuc // GLTO_ONLY-NOT: "-g"
96f4a2713aSLionel Sambuc //
97*0a6a1f1dSLionel Sambuc // GLTO_ONLY_DWARF2: "-cc1"
98*0a6a1f1dSLionel Sambuc // GLTO_ONLY_DWARF2-NOT: "-g"
99*0a6a1f1dSLionel Sambuc // GLTO_ONLY_DWARF2: "-gline-tables-only"
100*0a6a1f1dSLionel Sambuc // GLTO_ONLY_DWARF2: "-gdwarf-2"
101*0a6a1f1dSLionel Sambuc // GLTO_ONLY_DWARF2-NOT: "-g"
102*0a6a1f1dSLionel Sambuc //
103f4a2713aSLionel Sambuc // G_ONLY: "-cc1"
104f4a2713aSLionel Sambuc // G_ONLY-NOT: "-gline-tables-only"
105f4a2713aSLionel Sambuc // G_ONLY: "-g"
106f4a2713aSLionel Sambuc // G_ONLY-NOT: "-gline-tables-only"
107f4a2713aSLionel Sambuc //
108*0a6a1f1dSLionel Sambuc // G_ONLY_DWARF2: "-cc1"
109*0a6a1f1dSLionel Sambuc // G_ONLY_DWARF2-NOT: "-gline-tables-only"
110*0a6a1f1dSLionel Sambuc // G_ONLY_DWARF2: "-gdwarf-2"
111*0a6a1f1dSLionel Sambuc // G_ONLY_DWARF2-NOT: "-gline-tables-only"
112f4a2713aSLionel Sambuc //
113f4a2713aSLionel Sambuc // GLTO_NO: "-cc1"
114f4a2713aSLionel Sambuc // GLTO_NO-NOT: "-gline-tables-only"
115f4a2713aSLionel Sambuc //
116f4a2713aSLionel Sambuc // GIGNORE-NOT: "argument unused during compilation"
117f4a2713aSLionel Sambuc //
118f4a2713aSLionel Sambuc // GOPT: -generate-gnu-dwarf-pub-sections
119*0a6a1f1dSLionel Sambuc //
120*0a6a1f1dSLionel Sambuc // GARANGE: -generate-arange-section
121*0a6a1f1dSLionel Sambuc //
122*0a6a1f1dSLionel Sambuc // FDTS: "-backend-option" "-generate-type-units"
123*0a6a1f1dSLionel Sambuc //
124*0a6a1f1dSLionel Sambuc // NOFDTS-NOT: "-backend-option" "-generate-type-units"
125*0a6a1f1dSLionel Sambuc //
126*0a6a1f1dSLionel Sambuc // CI: "-dwarf-column-info"
127*0a6a1f1dSLionel Sambuc //
128*0a6a1f1dSLionel Sambuc // NOCI-NOT: "-dwarf-column-info"
129