blob: 20a23e274828fd57a32230af76e7e5487814f05e [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
Manman Ren825e8e412013-07-03 20:45:07 +00004// RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +00005// RUN: | FileCheck -check-prefix=G %s
Manman Ren825e8e412013-07-03 20:45:07 +00006// RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +00007// RUN: | FileCheck -check-prefix=G %s
Manman Ren825e8e412013-07-03 20:45:07 +00008// RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +00009// RUN: | FileCheck -check-prefix=G %s
Manman Ren825e8e412013-07-03 20:45:07 +000010// RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000011// RUN: | FileCheck -check-prefix=G %s
Manman Ren825e8e412013-07-03 20:45:07 +000012// RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
Douglas Katzman9a2ef282015-09-30 15:55:59 +000013// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Manman Ren825e8e412013-07-03 20:45:07 +000014// RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000015// RUN: | FileCheck -check-prefix=G %s
Manman Ren825e8e412013-07-03 20:45:07 +000016
17// RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000018// RUN: | FileCheck -check-prefix=G_DARWIN %s
Manman Ren825e8e412013-07-03 20:45:07 +000019// RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000020// RUN: | FileCheck -check-prefix=G_DARWIN %s
Manman Ren825e8e412013-07-03 20:45:07 +000021// RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000022// RUN: | FileCheck -check-prefix=G_DARWIN %s
Manman Ren825e8e412013-07-03 20:45:07 +000023// RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000024// RUN: | FileCheck -check-prefix=G_DARWIN %s
Manman Ren825e8e412013-07-03 20:45:07 +000025// RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \
Douglas Katzman9a2ef282015-09-30 15:55:59 +000026// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
Manman Ren825e8e412013-07-03 20:45:07 +000027// RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \
Filipe Cabecinhascc2f70b2015-07-16 05:22:17 +000028// RUN: | FileCheck -check-prefix=G_DARWIN %s
Manman Ren825e8e412013-07-03 20:45:07 +000029
Filipe Cabecinhasc888e192015-10-14 12:25:43 +000030// On the PS4, -g defaults to -gno-column-info, and we always generate the
31// arange section.
32// RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \
33// RUN: | FileCheck -check-prefix=G_PS4 %s
34// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
35// RUN: | FileCheck -check-prefix=G_PS4 %s
36// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
37// RUN: | FileCheck -check-prefix=NOCI %s
38// RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
39// RUN: | FileCheck -check-prefix=CI %s
40
Manman Ren9691f7f2013-06-19 01:46:49 +000041// RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000042//
43// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s
44// RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
45// RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
46//
Hal Finkel4add5dc2014-10-21 19:20:21 +000047// RUN: %clang -### -c -g1 %s 2>&1 \
48// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
David Blaikie29559b12014-03-11 21:05:26 +000049// RUN: %clang -### -c -gmlt %s 2>&1 \
50// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Alexey Samsonov74a38682012-05-04 07:39:27 +000051// RUN: %clang -### -c -gline-tables-only %s 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000052// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Manman Ren17bdb0f2013-11-20 20:22:14 +000053// RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \
Brad Smith378e7f9b2014-06-13 03:35:37 +000054// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
55// RUN: %clang -### -c -gline-tables-only %s -target i686-pc-openbsd 2>&1 \
56// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
57// RUN: %clang -### -c -gline-tables-only %s -target x86_64-pc-freebsd10.0 2>&1 \
58// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
Manman Ren825e8e412013-07-03 20:45:07 +000059// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000060// RUN: | FileCheck -check-prefix=G_ONLY %s
Manman Ren825e8e412013-07-03 20:45:07 +000061// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin 2>&1 \
Brad Smith378e7f9b2014-06-13 03:35:37 +000062// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
63// RUN: %clang -### -c -gline-tables-only -g %s -target i686-pc-openbsd 2>&1 \
64// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
65// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
66// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
Alexander Eremin670c6272014-10-16 05:55:24 +000067// RUN: %clang -### -c -gline-tables-only -g %s -target i386-pc-solaris 2>&1 \
68// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
Alexey Samsonovdda3a7f2012-05-29 08:10:34 +000069// RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000070// RUN: | FileCheck -check-prefix=GLTO_NO %s
71//
Benjamin Kramer7555b542012-08-03 10:35:06 +000072// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \
David Blaikied74be702014-01-18 02:02:06 +000073// RUN: -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
Eric Christopher2062ec62013-06-18 00:03:46 +000074// RUN: | FileCheck -check-prefix=GIGNORE %s
Chad Rosierc2bf3382011-11-04 19:28:44 +000075//
Eric Christopher138c32b2013-09-13 22:37:55 +000076// RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s
77//
Eric Christopher0d403d22014-02-14 01:27:03 +000078// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
79//
David Blaikied74be702014-01-18 02:02:06 +000080// RUN: %clang -### -fdebug-types-section %s 2>&1 \
81// RUN: | FileCheck -check-prefix=FDTS %s
82//
David Blaikief36d9ba2014-01-27 18:52:43 +000083// RUN: %clang -### -fdebug-types-section -fno-debug-types-section %s 2>&1 \
84// RUN: | FileCheck -check-prefix=NOFDTS %s
85//
Diego Novillo94b276d2014-07-10 23:29:28 +000086// RUN: %clang -### -g -gno-column-info %s 2>&1 \
87// RUN: | FileCheck -check-prefix=NOCI %s
88//
Filipe Cabecinhasc888e192015-10-14 12:25:43 +000089// RUN: %clang -### -g -target x86_64-unknown-unknown %s 2>&1 \
90// | FileCheck -check-prefix=CI %s
David Blaikief36d9ba2014-01-27 18:52:43 +000091//
Adrian Prantl6b21ab22015-08-27 19:46:20 +000092// RUN: %clang -### -gmodules %s 2>&1 \
93// RUN: | FileCheck -check-prefix=GEXTREFS %s
94//
Chad Rosierc2bf3382011-11-04 19:28:44 +000095// G: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000096// G: "-debug-info-kind=limited"
Manman Ren825e8e412013-07-03 20:45:07 +000097//
98// G_DARWIN: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000099// G_DARWIN: "-dwarf-version=2"
Eric Christopher0d403d22014-02-14 01:27:03 +0000100//
Filipe Cabecinhasc888e192015-10-14 12:25:43 +0000101// G_PS4: "-cc1"
102// G_PS4: "-generate-arange-section"
103//
Manman Ren9691f7f2013-06-19 01:46:49 +0000104// G_D2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000105// G_D2: "-dwarf-version=2"
Chad Rosierc2bf3382011-11-04 19:28:44 +0000106//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000107// G_NO: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000108// G_NO-NOT: -debug-info-kind=
Chad Rosier2ad368f2012-02-28 20:49:04 +0000109//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000110// GLTO_ONLY: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000111// GLTO_ONLY: "-debug-info-kind=line-tables-only"
Chad Rosierc2bf3382011-11-04 19:28:44 +0000112//
Brad Smith378e7f9b2014-06-13 03:35:37 +0000113// GLTO_ONLY_DWARF2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000114// GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only"
115// GLTO_ONLY_DWARF2: "-dwarf-version=2"
Adrian Prantl549c5142014-02-17 17:40:52 +0000116//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000117// G_ONLY: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000118// G_ONLY: "-debug-info-kind=limited"
Chad Rosierc2bf3382011-11-04 19:28:44 +0000119//
Douglas Katzman3459ce22015-10-08 04:24:12 +0000120// These tests assert that "-gline-tables-only" "-g" uses the latter,
121// but otherwise not caring about the DebugInfoKind.
Brad Smith378e7f9b2014-06-13 03:35:37 +0000122// G_ONLY_DWARF2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000123// G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}"
124// G_ONLY_DWARF2: "-dwarf-version=2"
Adrian Prantl549c5142014-02-17 17:40:52 +0000125//
Douglas Katzman3459ce22015-10-08 04:24:12 +0000126// This tests asserts that "-gline-tables-only" "-g0" disables debug info.
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000127// GLTO_NO: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000128// GLTO_NO-NOT: -debug-info-kind=
Eric Christopher2062ec62013-06-18 00:03:46 +0000129//
130// GIGNORE-NOT: "argument unused during compilation"
Eric Christopher138c32b2013-09-13 22:37:55 +0000131//
132// GOPT: -generate-gnu-dwarf-pub-sections
David Blaikied74be702014-01-18 02:02:06 +0000133//
Eric Christopher0d403d22014-02-14 01:27:03 +0000134// GARANGE: -generate-arange-section
135//
David Blaikied74be702014-01-18 02:02:06 +0000136// FDTS: "-backend-option" "-generate-type-units"
David Blaikief36d9ba2014-01-27 18:52:43 +0000137//
138// NOFDTS-NOT: "-backend-option" "-generate-type-units"
Diego Novillo94b276d2014-07-10 23:29:28 +0000139//
140// CI: "-dwarf-column-info"
141//
142// NOCI-NOT: "-dwarf-column-info"
Adrian Prantl6b21ab22015-08-27 19:46:20 +0000143//
Douglas Katzman6d6a9422015-10-08 05:02:24 +0000144// GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" "-debug-info-kind={{standalone|limited}}"