• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Check to make sure clang is somewhat picky about -g options.
2 // rdar://10383444
3 
4 // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
5 // RUN:             | FileCheck -check-prefix=G -check-prefix=G_GDB %s
6 // RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
7 // RUN:             | FileCheck -check-prefix=G %s
8 // RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \
9 // RUN:             | FileCheck -check-prefix=G %s
10 // RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
11 // RUN:             | FileCheck -check-prefix=G -check-prefix=G_GDB %s
12 // RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
13 // RUN:             | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_GDB %s
14 // RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
15 // RUN:             | FileCheck -check-prefix=G %s
16 // RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \
17 // RUN:             | FileCheck -check-prefix=G -check-prefix=G_LLDB %s
18 // RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \
19 // RUN:             | FileCheck -check-prefix=G -check-prefix=G_SCE %s
20 
21 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
22 // RUN:             | FileCheck -check-prefix=G_DARWIN -check-prefix=G_LLDB %s
23 // RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \
24 // RUN:             | FileCheck -check-prefix=G_DARWIN %s
25 // RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \
26 // RUN:             | FileCheck -check-prefix=G_DARWIN %s
27 // RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \
28 // RUN:             | FileCheck -check-prefix=G_DARWIN -check-prefix=G_GDB %s
29 // RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \
30 // RUN:             | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
31 // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \
32 // RUN:             | FileCheck -check-prefix=G_DARWIN %s
33 
34 // RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \
35 // RUN:             | FileCheck -check-prefix=G_GDB %s
36 
37 // On the PS4, -g defaults to -gno-column-info, and we always generate the
38 // arange section.
39 // RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \
40 // RUN:             | FileCheck -check-prefix=NOG_PS4 %s
41 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
42 // RUN:             | FileCheck -check-prefix=G_PS4 %s
43 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
44 // RUN:             | FileCheck -check-prefix=G_SCE %s
45 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
46 // RUN:             | FileCheck -check-prefix=NOCI %s
47 // RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
48 // RUN:             | FileCheck -check-prefix=CI %s
49 
50 // RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s
51 //
52 // RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s
53 // RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
54 // RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
55 // RUN: %clang -### -c -glldb -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
56 // RUN: %clang -### -c -glldb -g1 %s 2>&1 \
57 // RUN:             | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_LLDB %s
58 //
59 // PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info,
60 // then -g turns it back on without affecting tuning.
61 // RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \
62 // RUN:             | FileCheck -check-prefix=G -check-prefix=G_GDB %s
63 //
64 // RUN: %clang -### -c -g1 %s 2>&1 \
65 // RUN:             | FileCheck -check-prefix=GLTO_ONLY %s
66 // RUN: %clang -### -c -gmlt %s 2>&1 \
67 // RUN:             | FileCheck -check-prefix=GLTO_ONLY %s
68 // RUN: %clang -### -c -gline-tables-only %s 2>&1 \
69 // RUN:             | FileCheck -check-prefix=GLTO_ONLY %s
70 // RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \
71 // RUN:             | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
72 // RUN: %clang -### -c -gline-tables-only %s -target i686-pc-openbsd 2>&1 \
73 // RUN:             | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
74 // RUN: %clang -### -c -gline-tables-only %s -target x86_64-pc-freebsd10.0 2>&1 \
75 // RUN:             | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
76 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \
77 // RUN:             | FileCheck -check-prefix=G_ONLY %s
78 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin 2>&1 \
79 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
80 // RUN: %clang -### -c -gline-tables-only -g %s -target i686-pc-openbsd 2>&1 \
81 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
82 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
83 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
84 // RUN: %clang -### -c -gline-tables-only -g %s -target i386-pc-solaris 2>&1 \
85 // RUN:             | FileCheck -check-prefix=G_ONLY_DWARF2 %s
86 // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
87 // RUN:             | FileCheck -check-prefix=GLTO_NO %s
88 //
89 // RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \
90 // RUN:        -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
91 // RUN:        | FileCheck -check-prefix=GIGNORE %s
92 //
93 // RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s
94 //
95 // RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
96 //
97 // RUN: %clang -### -fdebug-types-section %s 2>&1 \
98 // RUN:        | FileCheck -check-prefix=FDTS %s
99 //
100 // RUN: %clang -### -fdebug-types-section -fno-debug-types-section %s 2>&1 \
101 // RUN:        | FileCheck -check-prefix=NOFDTS %s
102 //
103 // RUN: %clang -### -g -gno-column-info %s 2>&1 \
104 // RUN:        | FileCheck -check-prefix=NOCI %s
105 //
106 // RUN: %clang -### -g -target x86_64-unknown-unknown %s 2>&1 \
107 //             | FileCheck -check-prefix=CI %s
108 //
109 // RUN: %clang -### -gmodules %s 2>&1 \
110 // RUN:        | FileCheck -check-prefix=GEXTREFS %s
111 //
112 // G: "-cc1"
113 // G: "-debug-info-kind=limited"
114 //
115 // G_DARWIN: "-cc1"
116 // G_DARWIN: "-dwarf-version=2"
117 //
118 // NOG_PS4: "-cc1"
119 // NOG_PS4-NOT "-dwarf-version=
120 // NOG_PS4: "-generate-arange-section"
121 // NOG_PS4-NOT: "-dwarf-version=
122 //
123 // G_PS4: "-cc1"
124 // G_PS4: "-dwarf-version=
125 // G_PS4: "-generate-arange-section"
126 //
127 // G_D2: "-cc1"
128 // G_D2: "-dwarf-version=2"
129 //
130 // G_NO: "-cc1"
131 // G_NO-NOT: -debug-info-kind=
132 //
133 // GLTO_ONLY: "-cc1"
134 // GLTO_ONLY: "-debug-info-kind=line-tables-only"
135 //
136 // GLTO_ONLY_DWARF2: "-cc1"
137 // GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only"
138 // GLTO_ONLY_DWARF2: "-dwarf-version=2"
139 //
140 // G_ONLY: "-cc1"
141 // G_ONLY: "-debug-info-kind=limited"
142 //
143 // G_GDB:  "-debugger-tuning=gdb"
144 // G_LLDB: "-debugger-tuning=lldb"
145 // G_SCE:  "-debugger-tuning=sce"
146 //
147 // These tests assert that "-gline-tables-only" "-g" uses the latter,
148 // but otherwise not caring about the DebugInfoKind.
149 // G_ONLY_DWARF2: "-cc1"
150 // G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}"
151 // G_ONLY_DWARF2: "-dwarf-version=2"
152 //
153 // This tests asserts that "-gline-tables-only" "-g0" disables debug info.
154 // GLTO_NO: "-cc1"
155 // GLTO_NO-NOT: -debug-info-kind=
156 //
157 // GIGNORE-NOT: "argument unused during compilation"
158 //
159 // GOPT: -generate-gnu-dwarf-pub-sections
160 //
161 // GARANGE: -generate-arange-section
162 //
163 // FDTS: "-backend-option" "-generate-type-units"
164 //
165 // NOFDTS-NOT: "-backend-option" "-generate-type-units"
166 //
167 // CI: "-dwarf-column-info"
168 //
169 // NOCI-NOT: "-dwarf-column-info"
170 //
171 // GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" "-debug-info-kind={{standalone|limited}}"
172 
173 // RUN: not %clang -cc1 -debug-info-kind=watkind 2>&1 | FileCheck -check-prefix=BADSTRING1 %s
174 // BADSTRING1: error: invalid value 'watkind' in '-debug-info-kind=watkind'
175 // RUN: not %clang -cc1 -debugger-tuning=gmodal 2>&1 | FileCheck -check-prefix=BADSTRING2 %s
176 // BADSTRING2: error: invalid value 'gmodal' in '-debugger-tuning=gmodal'
177