blob: b9f4fea6e5b583297f6f9d0b3b34ca4ff9fdc915 [file] [log] [blame]
Chad Rosierc2bf3382011-11-04 19:28:44 +00001// Check to make sure clang is somewhat picky about -g options.
2// rdar://10383444
3
Adrian Prantl3e23c042016-10-17 20:14:23 +00004// Linux.
Manman Ren825e8e412013-07-03 20:45:07 +00005// RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
Paul Robinson0334a042015-12-19 19:41:48 +00006// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
Manman Ren825e8e412013-07-03 20:45:07 +00007// RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +00008// RUN: | FileCheck -check-prefix=G %s
Manman Ren825e8e412013-07-03 20:45:07 +00009// RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000010// RUN: | FileCheck -check-prefix=G %s
Manman Ren825e8e412013-07-03 20:45:07 +000011// RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
Paul Robinson0334a042015-12-19 19:41:48 +000012// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
Manman Ren825e8e412013-07-03 20:45:07 +000013// RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
Paul Robinson0334a042015-12-19 19:41:48 +000014// RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_GDB %s
Manman Ren825e8e412013-07-03 20:45:07 +000015// RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000016// RUN: | FileCheck -check-prefix=G %s
Paul Robinson0334a042015-12-19 19:41:48 +000017// RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \
18// RUN: | FileCheck -check-prefix=G -check-prefix=G_LLDB %s
19// RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \
Manman Ren825e8e412013-07-03 20:45:07 +000020
Adrian Prantl3e23c042016-10-17 20:14:23 +000021// Darwin.
22// RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
Manman Ren825e8e412013-07-03 20:45:07 +000023// RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000024// RUN: | FileCheck -check-prefix=G_STANDALONE \
25// RUN: -check-prefix=G_DWARF2 \
26// RUN: -check-prefix=G_LLDB %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000027// RUN: %clang -### -c -g %s -target x86_64-apple-darwin16 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000028// RUN: | FileCheck -check-prefix=G_STANDALONE \
29// RUN: -check-prefix=G_DWARF4 \
30// RUN: -check-prefix=G_LLDB %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000031// RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin16 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000032// RUN: | FileCheck -check-prefix=G_STANDALONE \
33// RUN: -check-prefix=G_DWARF4 %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000034// RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin16 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000035// RUN: | FileCheck -check-prefix=G_STANDALONE \
36// RUN: -check-prefix=G_DWARF4 %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000037// RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin16 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000038// RUN: | FileCheck -check-prefix=G_STANDALONE \
39// RUN: -check-prefix=G_DWARF4 \
40// RUN: -check-prefix=G_GDB %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000041// RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin16 2>&1 \
Adrian Prantl432d3d22016-09-09 21:10:35 +000042// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000043// RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin16 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000044// RUN: | FileCheck -check-prefix=G_STANDALONE \
45// RUN: -check-prefix=G_DWARF4 %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000046// RUN: %clang -### -c -g %s -target x86_64-apple-macosx10.11 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000047// RUN: | FileCheck -check-prefix=G_STANDALONE \
48// RUN: -check-prefix=G_DWARF4 %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000049// RUN: %clang -### -c -g %s -target x86_64-apple-macosx10.10 2>&1 \
50// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
51// RUN: %clang -### -c -g %s -target armv7-apple-ios9.0 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000052// RUN: | FileCheck -check-prefix=G_STANDALONE \
53// RUN: -check-prefix=G_DWARF4 %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000054// RUN: %clang -### -c -g %s -target armv7-apple-ios8.0 2>&1 \
55// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
56// RUN: %clang -### -c -g %s -target armv7k-apple-watchos 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000057// RUN: | FileCheck -check-prefix=G_STANDALONE \
58// RUN: -check-prefix=G_DWARF4 %s
Adrian Prantld50d56c2016-10-17 19:36:18 +000059// RUN: %clang -### -c -g %s -target arm64-apple-tvos9.0 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +000060// RUN: | FileCheck -check-prefix=G_STANDALONE \
61// RUN: -check-prefix=G_DWARF4 %s
Manman Ren825e8e412013-07-03 20:45:07 +000062
Adrian Prantl3e23c042016-10-17 20:14:23 +000063// FreeBSD.
Paul Robinson0334a042015-12-19 19:41:48 +000064// RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \
Dimitry Andric72132002016-01-07 22:09:47 +000065// RUN: | FileCheck -check-prefix=G_GDB %s
Paul Robinson0334a042015-12-19 19:41:48 +000066
Reid Kleckner7b7b1142018-11-14 22:59:27 +000067// Windows.
68// RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \
69// RUN: | FileCheck -check-prefix=G_GDB %s
70// RUN: %clang -### -c -g %s -target x86_64-windows-msvc 2>&1 \
71// RUN: | FileCheck -check-prefix=G_NOTUNING %s
72// RUN: %clang_cl -### -c -Z7 -target x86_64-windows-msvc -- %s 2>&1 \
73// RUN: | FileCheck -check-prefix=G_NOTUNING %s
74
Filipe Cabecinhasc888e192015-10-14 12:25:43 +000075// On the PS4, -g defaults to -gno-column-info, and we always generate the
76// arange section.
77// RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \
Filipe Cabecinhas2432ff52015-10-14 14:45:36 +000078// RUN: | FileCheck -check-prefix=NOG_PS4 %s
Filipe Cabecinhasc888e192015-10-14 12:25:43 +000079// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
80// RUN: | FileCheck -check-prefix=G_PS4 %s
81// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
Paul Robinson0334a042015-12-19 19:41:48 +000082// RUN: | FileCheck -check-prefix=G_SCE %s
83// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
Filipe Cabecinhasc888e192015-10-14 12:25:43 +000084// RUN: | FileCheck -check-prefix=NOCI %s
85// RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
86// RUN: | FileCheck -check-prefix=CI %s
Paul Robinsona8280812017-09-29 21:25:07 +000087// RUN: %clang -### -c %s -gsce -target x86_64-unknown-linux 2>&1 \
88// RUN: | FileCheck -check-prefix=NOCI %s
Filipe Cabecinhasc888e192015-10-14 12:25:43 +000089
Adrian Prantl3e23c042016-10-17 20:14:23 +000090// RUN: %clang -### -c -gdwarf-2 %s 2>&1 \
91// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000092//
Serge Pavlovb43573b2017-05-24 14:57:17 +000093// RUN: not %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_ERR %s
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000094// RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
95// RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
Paul Robinson0334a042015-12-19 19:41:48 +000096// RUN: %clang -### -c -glldb -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
97// RUN: %clang -### -c -glldb -g1 %s 2>&1 \
98// RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_LLDB %s
99//
100// PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info,
101// then -g turns it back on without affecting tuning.
102// RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \
103// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000104//
Hal Finkel4add5dc2014-10-21 19:20:21 +0000105// RUN: %clang -### -c -g1 %s 2>&1 \
106// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
David Blaikie29559b12014-03-11 21:05:26 +0000107// RUN: %clang -### -c -gmlt %s 2>&1 \
108// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Alexey Samsonov74a38682012-05-04 07:39:27 +0000109// RUN: %clang -### -c -gline-tables-only %s 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000110// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Manman Ren17bdb0f2013-11-20 20:22:14 +0000111// RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \
Adrian Prantl432d3d22016-09-09 21:10:35 +0000112// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Brad Smith378e7f9b2014-06-13 03:35:37 +0000113// RUN: %clang -### -c -gline-tables-only %s -target i686-pc-openbsd 2>&1 \
114// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
115// RUN: %clang -### -c -gline-tables-only %s -target x86_64-pc-freebsd10.0 2>&1 \
116// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
Manman Ren825e8e412013-07-03 20:45:07 +0000117// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000118// RUN: | FileCheck -check-prefix=G_ONLY %s
Adrian Prantld50d56c2016-10-17 19:36:18 +0000119// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin16 2>&1 \
Adrian Prantl3e23c042016-10-17 20:14:23 +0000120// RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s
Brad Smith378e7f9b2014-06-13 03:35:37 +0000121// RUN: %clang -### -c -gline-tables-only -g %s -target i686-pc-openbsd 2>&1 \
122// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
123// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
124// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
Alexander Eremin670c6272014-10-16 05:55:24 +0000125// RUN: %clang -### -c -gline-tables-only -g %s -target i386-pc-solaris 2>&1 \
126// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
Alexey Samsonovdda3a7f2012-05-29 08:10:34 +0000127// RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000128// RUN: | FileCheck -check-prefix=GLTO_NO %s
129//
Alexey Bataev80e1b5e2018-08-31 13:56:14 +0000130// RUN: %clang -### -c -gline-directives-only %s -target x86_64-apple-darwin 2>&1 \
131// RUN: | FileCheck -check-prefix=GLIO_ONLY %s
132// RUN: %clang -### -c -gline-directives-only %s -target i686-pc-openbsd 2>&1 \
133// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s
134// RUN: %clang -### -c -gline-directives-only %s -target x86_64-pc-freebsd10.0 2>&1 \
135// RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s
136// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-linux-gnu 2>&1 \
137// RUN: | FileCheck -check-prefix=G_ONLY %s
138// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-apple-darwin16 2>&1 \
139// RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s
140// RUN: %clang -### -c -gline-directives-only -g %s -target i686-pc-openbsd 2>&1 \
141// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
142// RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
143// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
144// RUN: %clang -### -c -gline-directives-only -g %s -target i386-pc-solaris 2>&1 \
145// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
146// RUN: %clang -### -c -gline-directives-only -g0 %s 2>&1 \
147// RUN: | FileCheck -check-prefix=GLIO_NO %s
148//
Eric Christopherca325172017-03-29 23:34:20 +0000149// RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 \
150// | FileCheck -check-prefix=GRECORD %s
151// RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 \
152// | FileCheck -check-prefix=GNO_RECORD %s
153// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches %s 2>&1 \
154// | FileCheck -check-prefix=GNO_RECORD %s/
155// RUN: %clang -### -c -grecord-gcc-switches -o - %s 2>&1 \
156// | FileCheck -check-prefix=GRECORD_O %s
157// RUN: %clang -### -c -O3 -ffunction-sections -grecord-gcc-switches %s 2>&1 \
158// | FileCheck -check-prefix=GRECORD_OPT %s
159//
160// RUN: %clang -### -c -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
Eric Christopher2062ec62013-06-18 00:03:46 +0000161// RUN: | FileCheck -check-prefix=GIGNORE %s
Chad Rosierc2bf3382011-11-04 19:28:44 +0000162//
David Blaikie65864522018-08-20 20:14:08 +0000163// RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GPUB %s
Pavel Labathc1e0c342018-09-06 17:01:45 +0000164// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
David Blaikie65864522018-08-20 20:14:08 +0000165// RUN: %clang -### -c -ggnu-pubnames -gno-gnu-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
166// RUN: %clang -### -c -ggnu-pubnames -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
167//
168// RUN: %clang -### -c -gpubnames %s 2>&1 | FileCheck -check-prefix=PUB %s
Pavel Labathc1e0c342018-09-06 17:01:45 +0000169// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
David Blaikie65864522018-08-20 20:14:08 +0000170// RUN: %clang -### -c -gpubnames -gno-gnu-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
171// RUN: %clang -### -c -gpubnames -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
172//
173// RUN: %clang -### -c -gsplit-dwarf %s 2>&1 | FileCheck -check-prefix=GPUB %s
174// RUN: %clang -### -c -gsplit-dwarf -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
Eric Christopher138c32b2013-09-13 22:37:55 +0000175//
David Blaikie27692de2018-11-13 20:08:13 +0000176// RUN: %clang -### -c -fdebug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=RNGBSE %s
177// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s
178// RUN: %clang -### -c -fdebug-ranges-base-address -fno-debug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s
179//
Pavel Labathc1e0c342018-09-06 17:01:45 +0000180// RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=GPUB %s
181// RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
182//
Eric Christopher0d403d22014-02-14 01:27:03 +0000183// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
184//
Jonas Devlieghere488bd012018-07-23 17:50:15 +0000185// RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \
David Blaikied74be702014-01-18 02:02:06 +0000186// RUN: | FileCheck -check-prefix=FDTS %s
187//
Jonas Devlieghere488bd012018-07-23 17:50:15 +0000188// RUN: %clang -### -fdebug-types-section -fno-debug-types-section -target x86_64-unknown-linux %s 2>&1 \
David Blaikief36d9ba2014-01-27 18:52:43 +0000189// RUN: | FileCheck -check-prefix=NOFDTS %s
190//
Jonas Devlieghere488bd012018-07-23 17:50:15 +0000191// RUN: %clang -### -fdebug-types-section -target x86_64-apple-darwin %s 2>&1 \
192// RUN: | FileCheck -check-prefix=FDTSE %s
193//
194// RUN: %clang -### -fdebug-types-section -fno-debug-types-section -target x86_64-apple-darwin %s 2>&1 \
195// RUN: | FileCheck -check-prefix=NOFDTSE %s
196//
Diego Novillo94b276d2014-07-10 23:29:28 +0000197// RUN: %clang -### -g -gno-column-info %s 2>&1 \
198// RUN: | FileCheck -check-prefix=NOCI %s
199//
Filipe Cabecinhasc888e192015-10-14 12:25:43 +0000200// RUN: %clang -### -g -target x86_64-unknown-unknown %s 2>&1 \
201// | FileCheck -check-prefix=CI %s
David Blaikief36d9ba2014-01-27 18:52:43 +0000202//
Adrian Prantl6b21ab22015-08-27 19:46:20 +0000203// RUN: %clang -### -gmodules %s 2>&1 \
204// RUN: | FileCheck -check-prefix=GEXTREFS %s
205//
Adrian Prantle941fc12016-10-10 21:56:20 +0000206// RUN: %clang -### -gmodules -g %s 2>&1 \
207// RUN: | FileCheck -check-prefix=GEXTREFS %s
208//
209// RUN: %clang -### -gline-tables-only -gmodules %s 2>&1 \
210// RUN: | FileCheck -check-prefix=GEXTREFS %s
211//
212// RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \
213// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
214//
Reid Kleckner7b7b1142018-11-14 22:59:27 +0000215// RUN: %clang -### -target %itanium_abi_triple -gmodules -gline-directives-only %s 2>&1 \
Alexey Bataev80e1b5e2018-08-31 13:56:14 +0000216// RUN: | FileCheck -check-prefix=GLIO_ONLY %s
217//
Chad Rosierc2bf3382011-11-04 19:28:44 +0000218// G: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000219// G: "-debug-info-kind=limited"
Manman Ren825e8e412013-07-03 20:45:07 +0000220//
Filipe Cabecinhas2432ff52015-10-14 14:45:36 +0000221// NOG_PS4: "-cc1"
222// NOG_PS4-NOT "-dwarf-version=
223// NOG_PS4: "-generate-arange-section"
224// NOG_PS4-NOT: "-dwarf-version=
225//
Filipe Cabecinhasc888e192015-10-14 12:25:43 +0000226// G_PS4: "-cc1"
Filipe Cabecinhas2432ff52015-10-14 14:45:36 +0000227// G_PS4: "-dwarf-version=
Filipe Cabecinhasc888e192015-10-14 12:25:43 +0000228// G_PS4: "-generate-arange-section"
229//
Serge Pavlovb43573b2017-05-24 14:57:17 +0000230// G_ERR: error: unknown argument:
231//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000232// G_NO: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000233// G_NO-NOT: -debug-info-kind=
Chad Rosier2ad368f2012-02-28 20:49:04 +0000234//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000235// GLTO_ONLY: "-cc1"
Adrian Prantle941fc12016-10-10 21:56:20 +0000236// GLTO_ONLY-NOT: "-dwarf-ext-refs"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000237// GLTO_ONLY: "-debug-info-kind=line-tables-only"
Adrian Prantle941fc12016-10-10 21:56:20 +0000238// GLTO_ONLY-NOT: "-dwarf-ext-refs"
Chad Rosierc2bf3382011-11-04 19:28:44 +0000239//
Brad Smith378e7f9b2014-06-13 03:35:37 +0000240// GLTO_ONLY_DWARF2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000241// GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only"
242// GLTO_ONLY_DWARF2: "-dwarf-version=2"
Adrian Prantl549c5142014-02-17 17:40:52 +0000243//
Alexey Bataev80e1b5e2018-08-31 13:56:14 +0000244// GLIO_ONLY: "-cc1"
245// GLIO_ONLY-NOT: "-dwarf-ext-refs"
246// GLIO_ONLY: "-debug-info-kind=line-directives-only"
247// GLIO_ONLY-NOT: "-dwarf-ext-refs"
248//
249// GLIO_ONLY_DWARF2: "-cc1"
250// GLIO_ONLY_DWARF2: "-debug-info-kind=line-directives-only"
251// GLIO_ONLY_DWARF2: "-dwarf-version=2"
252//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000253// G_ONLY: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000254// G_ONLY: "-debug-info-kind=limited"
Chad Rosierc2bf3382011-11-04 19:28:44 +0000255//
Douglas Katzman3459ce22015-10-08 04:24:12 +0000256// These tests assert that "-gline-tables-only" "-g" uses the latter,
257// but otherwise not caring about the DebugInfoKind.
Brad Smith378e7f9b2014-06-13 03:35:37 +0000258// G_ONLY_DWARF2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000259// G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}"
260// G_ONLY_DWARF2: "-dwarf-version=2"
Adrian Prantl549c5142014-02-17 17:40:52 +0000261//
Adrian Prantl3e23c042016-10-17 20:14:23 +0000262// G_STANDALONE: "-cc1"
263// G_STANDALONE: "-debug-info-kind=standalone"
264// G_DWARF4: "-dwarf-version=4"
Adrian Prantl432d3d22016-09-09 21:10:35 +0000265//
Adrian Prantld50d56c2016-10-17 19:36:18 +0000266// G_GDB: "-debugger-tuning=gdb"
267// G_LLDB: "-debugger-tuning=lldb"
268// G_SCE: "-debugger-tuning=sce"
269//
Reid Kleckner7b7b1142018-11-14 22:59:27 +0000270// G_NOTUNING: "-cc1"
271// G_NOTUNING-NOT: "-debugger-tuning="
272//
Douglas Katzman3459ce22015-10-08 04:24:12 +0000273// This tests asserts that "-gline-tables-only" "-g0" disables debug info.
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000274// GLTO_NO: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000275// GLTO_NO-NOT: -debug-info-kind=
Eric Christopher2062ec62013-06-18 00:03:46 +0000276//
Alexey Bataev80e1b5e2018-08-31 13:56:14 +0000277// This tests asserts that "-gline-directives-only" "-g0" disables debug info.
278// GLIO_NO: "-cc1"
279// GLIO_NO-NOT: -debug-info-kind=
280//
Eric Christopherca325172017-03-29 23:34:20 +0000281// GRECORD: "-dwarf-debug-flags"
282// GRECORD: -### -c -grecord-gcc-switches
283//
284// GNO_RECORD-NOT: "-dwarf-debug-flags"
285// GNO_RECORD-NOT: -### -c -grecord-gcc-switches
286//
287// GRECORD_O: "-dwarf-debug-flags"
288// GRECORD_O: -### -c -grecord-gcc-switches -o -
289//
290// GRECORD_OPT: -### -c -O3 -ffunction-sections -grecord-gcc-switches
291//
Eric Christopher2062ec62013-06-18 00:03:46 +0000292// GIGNORE-NOT: "argument unused during compilation"
Eric Christopher138c32b2013-09-13 22:37:55 +0000293//
David Blaikie65864522018-08-20 20:14:08 +0000294// GPUB: -ggnu-pubnames
295// NOPUB-NOT: -ggnu-pubnames
296// NOPUB-NOT: -gpubnames
297//
298// PUB: -gpubnames
David Blaikied74be702014-01-18 02:02:06 +0000299//
David Blaikie27692de2018-11-13 20:08:13 +0000300// RNGBSE: -fdebug-ranges-base-address
301// NORNGBSE-NOT: -fdebug-ranges-base-address
302//
Eric Christopher0d403d22014-02-14 01:27:03 +0000303// GARANGE: -generate-arange-section
304//
Eli Friedman01d349b2018-04-12 22:21:36 +0000305// FDTS: "-mllvm" "-generate-type-units"
Jonas Devlieghere488bd012018-07-23 17:50:15 +0000306// FDTSE: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin'
David Blaikief36d9ba2014-01-27 18:52:43 +0000307//
Eli Friedman01d349b2018-04-12 22:21:36 +0000308// NOFDTS-NOT: "-mllvm" "-generate-type-units"
Jonas Devlieghere488bd012018-07-23 17:50:15 +0000309// NOFDTSE-NOT: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin'
Diego Novillo94b276d2014-07-10 23:29:28 +0000310//
311// CI: "-dwarf-column-info"
312//
313// NOCI-NOT: "-dwarf-column-info"
Adrian Prantl6b21ab22015-08-27 19:46:20 +0000314//
Reid Kleckner7b7b1142018-11-14 22:59:27 +0000315// GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj"
316// GEXTREFS: "-debug-info-kind={{standalone|limited}}"
Douglas Katzmana2ef81f2016-01-06 01:37:57 +0000317
318// RUN: not %clang -cc1 -debug-info-kind=watkind 2>&1 | FileCheck -check-prefix=BADSTRING1 %s
319// BADSTRING1: error: invalid value 'watkind' in '-debug-info-kind=watkind'
320// RUN: not %clang -cc1 -debugger-tuning=gmodal 2>&1 | FileCheck -check-prefix=BADSTRING2 %s
321// BADSTRING2: error: invalid value 'gmodal' in '-debugger-tuning=gmodal'
Amjad Aboud546bc112017-02-09 22:07:24 +0000322
323// RUN: %clang -### -fdebug-macro %s 2>&1 | FileCheck -check-prefix=MACRO %s
324// RUN: %clang -### -fno-debug-macro %s 2>&1 | FileCheck -check-prefix=NOMACRO %s
325// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=NOMACRO %s
326// MACRO: "-debug-info-macro"
327// NOMACRO-NOT: "-debug-info-macro"
Scott Lindera2fbcef2018-02-26 17:32:31 +0000328//
329// RUN: %clang -### -gdwarf-5 -gembed-source %s 2>&1 | FileCheck -check-prefix=GEMBED_5 %s
330// RUN: %clang -### -gdwarf-2 -gembed-source %s 2>&1 | FileCheck -check-prefix=GEMBED_2 %s
331// RUN: %clang -### -gdwarf-5 -gno-embed-source %s 2>&1 | FileCheck -check-prefix=NOGEMBED_5 %s
332// RUN: %clang -### -gdwarf-2 -gno-embed-source %s 2>&1 | FileCheck -check-prefix=NOGEMBED_2 %s
333//
334// GEMBED_5: "-gembed-source"
335// GEMBED_2: error: invalid argument '-gembed-source' only allowed with '-gdwarf-5'
336// NOGEMBED_5-NOT: "-gembed-source"
337// NOGEMBED_2-NOT: error: invalid argument '-gembed-source' only allowed with '-gdwarf-5'