blob: 48f686bb33ea3affb058c7240ff03be83f459e02 [file] [log] [blame]
Chad Rosier2875bda2011-11-04 19:28:44 +00001// Check to make sure clang is somewhat picky about -g options.
2// rdar://10383444
3
Manman Rene7830482013-07-03 20:45:07 +00004// RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
5 | FileCheck -check-prefix=G %s
6// RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
7 | FileCheck -check-prefix=G %s
8// RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \
9 | FileCheck -check-prefix=G %s
10// RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
11 | FileCheck -check-prefix=G %s
12// RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
13 | FileCheck -check-prefix=G %s
14// RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
15 | FileCheck -check-prefix=G %s
16
17// RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
18 | FileCheck -check-prefix=G_DARWIN %s
19// RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \
20 | FileCheck -check-prefix=G_DARWIN %s
21// RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \
22 | FileCheck -check-prefix=G_DARWIN %s
23// RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \
24 | FileCheck -check-prefix=G_DARWIN %s
25// RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \
26 | FileCheck -check-prefix=G_DARWIN %s
27// RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \
28 | FileCheck -check-prefix=G_DARWIN %s
29
Manman Renfc0f91c2013-06-19 01:46:49 +000030// RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s
Alexey Samsonov7f326072012-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//
Stephen Hines651f13c2014-04-23 16:59:28 -070036// RUN: %clang -### -c -gmlt %s 2>&1 \
37// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Alexey Samsonovfd00eec2012-05-04 07:39:27 +000038// RUN: %clang -### -c -gline-tables-only %s 2>&1 \
Alexey Samsonov7f326072012-06-21 08:22:39 +000039// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
Stephen Hines651f13c2014-04-23 16:59:28 -070040// RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \
41// RUN: | FileCheck -check-prefix=GLTO_ONLY_DARWIN %s
Manman Rene7830482013-07-03 20:45:07 +000042// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \
Alexey Samsonov7f326072012-06-21 08:22:39 +000043// RUN: | FileCheck -check-prefix=G_ONLY %s
Manman Rene7830482013-07-03 20:45:07 +000044// RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin 2>&1 \
45// RUN: | FileCheck -check-prefix=G_ONLY_DARWIN %s
Alexey Samsonova9cd83b2012-05-29 08:10:34 +000046// RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \
Alexey Samsonov7f326072012-06-21 08:22:39 +000047// RUN: | FileCheck -check-prefix=GLTO_NO %s
48//
Benjamin Kramer967d8332012-08-03 10:35:06 +000049// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \
Stephen Hines651f13c2014-04-23 16:59:28 -070050// RUN: -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
Eric Christophere7d94642013-06-18 00:03:46 +000051// RUN: | FileCheck -check-prefix=GIGNORE %s
Chad Rosier2875bda2011-11-04 19:28:44 +000052//
Eric Christopher0f43a6d2013-09-13 22:37:55 +000053// RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s
54//
Stephen Hines651f13c2014-04-23 16:59:28 -070055// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
56//
57// RUN: %clang -### -fdebug-types-section %s 2>&1 \
58// RUN: | FileCheck -check-prefix=FDTS %s
59//
60// RUN: %clang -### -fdebug-types-section -fno-debug-types-section %s 2>&1 \
61// RUN: | FileCheck -check-prefix=NOFDTS %s
62//
63//
Chad Rosier2875bda2011-11-04 19:28:44 +000064// G: "-cc1"
Manman Rene7830482013-07-03 20:45:07 +000065// G: "-g"
66//
67// G_DARWIN: "-cc1"
68// G_DARWIN: "-gdwarf-2"
Stephen Hines651f13c2014-04-23 16:59:28 -070069//
Manman Renfc0f91c2013-06-19 01:46:49 +000070// G_D2: "-cc1"
71// G_D2: "-gdwarf-2"
Chad Rosier2875bda2011-11-04 19:28:44 +000072//
Alexey Samsonov7f326072012-06-21 08:22:39 +000073// G_NO: "-cc1"
74// G_NO-NOT: "-g"
Chad Rosier670326f2012-02-28 20:49:04 +000075//
Alexey Samsonov7f326072012-06-21 08:22:39 +000076// GLTO_ONLY: "-cc1"
77// GLTO_ONLY-NOT: "-g"
78// GLTO_ONLY: "-gline-tables-only"
79// GLTO_ONLY-NOT: "-g"
Chad Rosier2875bda2011-11-04 19:28:44 +000080//
Stephen Hines651f13c2014-04-23 16:59:28 -070081// GLTO_ONLY_DARWIN: "-cc1"
82// GLTO_ONLY_DARWIN-NOT: "-g"
83// GLTO_ONLY_DARWIN: "-gline-tables-only"
84// GLTO_ONLY_DARWIN: "-gdwarf-2"
85// GLTO_ONLY_DARWIN-NOT: "-g"
86//
Alexey Samsonov7f326072012-06-21 08:22:39 +000087// G_ONLY: "-cc1"
88// G_ONLY-NOT: "-gline-tables-only"
Manman Rene7830482013-07-03 20:45:07 +000089// G_ONLY: "-g"
Alexey Samsonov7f326072012-06-21 08:22:39 +000090// G_ONLY-NOT: "-gline-tables-only"
Chad Rosier2875bda2011-11-04 19:28:44 +000091//
Manman Rene7830482013-07-03 20:45:07 +000092// G_ONLY_DARWIN: "-cc1"
93// G_ONLY_DARWIN-NOT: "-gline-tables-only"
94// G_ONLY_DARWIN: "-gdwarf-2"
95// G_ONLY_DARWIN-NOT: "-gline-tables-only"
96//
Alexey Samsonov7f326072012-06-21 08:22:39 +000097// GLTO_NO: "-cc1"
98// GLTO_NO-NOT: "-gline-tables-only"
Eric Christophere7d94642013-06-18 00:03:46 +000099//
100// GIGNORE-NOT: "argument unused during compilation"
Eric Christopher0f43a6d2013-09-13 22:37:55 +0000101//
102// GOPT: -generate-gnu-dwarf-pub-sections
Stephen Hines651f13c2014-04-23 16:59:28 -0700103//
104// GARANGE: -generate-arange-section
105//
106// FDTS: "-backend-option" "-generate-type-units"
107//
108// NOFDTS-NOT: "-backend-option" "-generate-type-units"