blob: 437e9fcb500b050bb08e831ee62c210894758052 [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
Manman Ren9691f7f2013-06-19 01:46:49 +000030// RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000031//
32// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s
33// RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
34// RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s
35//
Hal Finkel4add5dc2014-10-21 19:20:21 +000036// RUN: %clang -### -c -g1 %s 2>&1 \
37// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
David Blaikie29559b12014-03-11 21:05:26 +000038// RUN: %clang -### -c -gmlt %s 2>&1 \
39// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Alexey Samsonov74a38682012-05-04 07:39:27 +000040// RUN: %clang -### -c -gline-tables-only %s 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000041// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Manman Ren17bdb0f2013-11-20 20:22:14 +000042// RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \
Brad Smith378e7f9b2014-06-13 03:35:37 +000043// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
44// RUN: %clang -### -c -gline-tables-only %s -target i686-pc-openbsd 2>&1 \
45// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
46// RUN: %clang -### -c -gline-tables-only %s -target x86_64-pc-freebsd10.0 2>&1 \
47// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
Manman Ren825e8e412013-07-03 20:45:07 +000048// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000049// RUN: | FileCheck -check-prefix=G_ONLY %s
Manman Ren825e8e412013-07-03 20:45:07 +000050// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin 2>&1 \
Brad Smith378e7f9b2014-06-13 03:35:37 +000051// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
52// RUN: %clang -### -c -gline-tables-only -g %s -target i686-pc-openbsd 2>&1 \
53// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
54// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-pc-freebsd10.0 2>&1 \
55// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
Alexander Eremin670c6272014-10-16 05:55:24 +000056// RUN: %clang -### -c -gline-tables-only -g %s -target i386-pc-solaris 2>&1 \
57// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
Alexey Samsonovdda3a7f2012-05-29 08:10:34 +000058// RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000059// RUN: | FileCheck -check-prefix=GLTO_NO %s
60//
Benjamin Kramer7555b542012-08-03 10:35:06 +000061// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \
David Blaikied74be702014-01-18 02:02:06 +000062// RUN: -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
Eric Christopher2062ec62013-06-18 00:03:46 +000063// RUN: | FileCheck -check-prefix=GIGNORE %s
Chad Rosierc2bf3382011-11-04 19:28:44 +000064//
Eric Christopher138c32b2013-09-13 22:37:55 +000065// RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s
66//
Eric Christopher0d403d22014-02-14 01:27:03 +000067// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
68//
David Blaikied74be702014-01-18 02:02:06 +000069// RUN: %clang -### -fdebug-types-section %s 2>&1 \
70// RUN: | FileCheck -check-prefix=FDTS %s
71//
David Blaikief36d9ba2014-01-27 18:52:43 +000072// RUN: %clang -### -fdebug-types-section -fno-debug-types-section %s 2>&1 \
73// RUN: | FileCheck -check-prefix=NOFDTS %s
74//
Diego Novillo94b276d2014-07-10 23:29:28 +000075// RUN: %clang -### -g -gno-column-info %s 2>&1 \
76// RUN: | FileCheck -check-prefix=NOCI %s
77//
78// RUN: %clang -### -g %s 2>&1 | FileCheck -check-prefix=CI %s
David Blaikief36d9ba2014-01-27 18:52:43 +000079//
Adrian Prantl6b21ab22015-08-27 19:46:20 +000080// RUN: %clang -### -gmodules %s 2>&1 \
81// RUN: | FileCheck -check-prefix=GEXTREFS %s
82//
Chad Rosierc2bf3382011-11-04 19:28:44 +000083// G: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000084// G: "-debug-info-kind=limited"
Manman Ren825e8e412013-07-03 20:45:07 +000085//
86// G_DARWIN: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000087// G_DARWIN: "-dwarf-version=2"
Eric Christopher0d403d22014-02-14 01:27:03 +000088//
Manman Ren9691f7f2013-06-19 01:46:49 +000089// G_D2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000090// G_D2: "-dwarf-version=2"
Chad Rosierc2bf3382011-11-04 19:28:44 +000091//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000092// G_NO: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000093// G_NO-NOT: -debug-info-kind=
Chad Rosier2ad368f2012-02-28 20:49:04 +000094//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +000095// GLTO_ONLY: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000096// GLTO_ONLY: "-debug-info-kind=line-tables-only"
Chad Rosierc2bf3382011-11-04 19:28:44 +000097//
Brad Smith378e7f9b2014-06-13 03:35:37 +000098// GLTO_ONLY_DWARF2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +000099// GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only"
100// GLTO_ONLY_DWARF2: "-dwarf-version=2"
Adrian Prantl549c5142014-02-17 17:40:52 +0000101//
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000102// G_ONLY: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000103// G_ONLY: "-debug-info-kind=limited"
Chad Rosierc2bf3382011-11-04 19:28:44 +0000104//
Douglas Katzman3459ce22015-10-08 04:24:12 +0000105// These tests assert that "-gline-tables-only" "-g" uses the latter,
106// but otherwise not caring about the DebugInfoKind.
Brad Smith378e7f9b2014-06-13 03:35:37 +0000107// G_ONLY_DWARF2: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000108// G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}"
109// G_ONLY_DWARF2: "-dwarf-version=2"
Adrian Prantl549c5142014-02-17 17:40:52 +0000110//
Douglas Katzman3459ce22015-10-08 04:24:12 +0000111// This tests asserts that "-gline-tables-only" "-g0" disables debug info.
Alexey Samsonovf50a9ff2012-06-21 08:22:39 +0000112// GLTO_NO: "-cc1"
Douglas Katzman3459ce22015-10-08 04:24:12 +0000113// GLTO_NO-NOT: -debug-info-kind=
Eric Christopher2062ec62013-06-18 00:03:46 +0000114//
115// GIGNORE-NOT: "argument unused during compilation"
Eric Christopher138c32b2013-09-13 22:37:55 +0000116//
117// GOPT: -generate-gnu-dwarf-pub-sections
David Blaikied74be702014-01-18 02:02:06 +0000118//
Eric Christopher0d403d22014-02-14 01:27:03 +0000119// GARANGE: -generate-arange-section
120//
David Blaikied74be702014-01-18 02:02:06 +0000121// FDTS: "-backend-option" "-generate-type-units"
David Blaikief36d9ba2014-01-27 18:52:43 +0000122//
123// NOFDTS-NOT: "-backend-option" "-generate-type-units"
Diego Novillo94b276d2014-07-10 23:29:28 +0000124//
125// CI: "-dwarf-column-info"
126//
127// NOCI-NOT: "-dwarf-column-info"
Adrian Prantl6b21ab22015-08-27 19:46:20 +0000128//
Douglas Katzman6d6a9422015-10-08 05:02:24 +0000129// GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" "-debug-info-kind={{standalone|limited}}"