blob: dfd0da079df5d3ec427e4eb223e7b465668fa50b [file] [log] [blame]
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +00001//===--- ParsePragma.cpp - Language specific pragma parsing ---------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the language specific #pragma handlers.
11//
12//===----------------------------------------------------------------------===//
13
14#include "ParsePragma.h"
Chris Lattner500d3292009-01-29 05:15:15 +000015#include "clang/Parse/ParseDiagnostic.h"
Ted Kremenek4726d032009-03-23 22:28:25 +000016#include "clang/Parse/Parser.h"
John McCall19510852010-08-20 18:27:03 +000017#include "clang/Lex/Preprocessor.h"
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +000018using namespace clang;
19
Argyrios Kyrtzidisb918d0f2011-01-17 18:58:44 +000020/// \brief Handle the annotation token produced for #pragma unused(...)
21///
22/// Each annot_pragma_unused is followed by the argument token so e.g.
23/// "#pragma unused(x,y)" becomes:
24/// annot_pragma_unused 'x' annot_pragma_unused 'y'
25void Parser::HandlePragmaUnused() {
26 assert(Tok.is(tok::annot_pragma_unused));
27 SourceLocation UnusedLoc = ConsumeToken();
28 Actions.ActOnPragmaUnused(Tok, getCurScope(), UnusedLoc);
29 ConsumeToken(); // The argument token.
30}
Eli Friedmanaa8b0d12010-08-05 06:57:20 +000031
32// #pragma GCC visibility comes in two variants:
33// 'push' '(' [visibility] ')'
34// 'pop'
Douglas Gregor80c60f72010-09-09 22:45:38 +000035void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
36 PragmaIntroducerKind Introducer,
37 Token &VisTok) {
Eli Friedmanaa8b0d12010-08-05 06:57:20 +000038 SourceLocation VisLoc = VisTok.getLocation();
39
40 Token Tok;
41 PP.Lex(Tok);
42
43 const IdentifierInfo *PushPop = Tok.getIdentifierInfo();
44
45 bool IsPush;
46 const IdentifierInfo *VisType;
47 if (PushPop && PushPop->isStr("pop")) {
48 IsPush = false;
49 VisType = 0;
50 } else if (PushPop && PushPop->isStr("push")) {
51 IsPush = true;
52 PP.Lex(Tok);
53 if (Tok.isNot(tok::l_paren)) {
54 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)
55 << "visibility";
56 return;
57 }
58 PP.Lex(Tok);
59 VisType = Tok.getIdentifierInfo();
60 if (!VisType) {
61 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
62 << "visibility";
63 return;
64 }
65 PP.Lex(Tok);
66 if (Tok.isNot(tok::r_paren)) {
67 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_rparen)
68 << "visibility";
69 return;
70 }
71 } else {
72 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
73 << "visibility";
74 return;
75 }
76 PP.Lex(Tok);
77 if (Tok.isNot(tok::eom)) {
78 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
79 << "visibility";
80 return;
81 }
82
83 Actions.ActOnPragmaVisibility(IsPush, VisType, VisLoc);
84}
85
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +000086// #pragma pack(...) comes in the following delicious flavors:
87// pack '(' [integer] ')'
88// pack '(' 'show' ')'
89// pack '(' ('push' | 'pop') [',' identifier] [, integer] ')'
Douglas Gregor80c60f72010-09-09 22:45:38 +000090void PragmaPackHandler::HandlePragma(Preprocessor &PP,
91 PragmaIntroducerKind Introducer,
92 Token &PackTok) {
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +000093 SourceLocation PackLoc = PackTok.getLocation();
94
95 Token Tok;
96 PP.Lex(Tok);
97 if (Tok.isNot(tok::l_paren)) {
Ted Kremenek4726d032009-03-23 22:28:25 +000098 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen) << "pack";
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +000099 return;
100 }
101
John McCallf312b1e2010-08-26 23:41:50 +0000102 Sema::PragmaPackKind Kind = Sema::PPK_Default;
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000103 IdentifierInfo *Name = 0;
John McCall60d7b3a2010-08-24 06:29:42 +0000104 ExprResult Alignment;
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000105 SourceLocation LParenLoc = Tok.getLocation();
Mike Stump1eb44332009-09-09 15:08:12 +0000106 PP.Lex(Tok);
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000107 if (Tok.is(tok::numeric_constant)) {
108 Alignment = Actions.ActOnNumericConstant(Tok);
Sebastian Redl0e9eabc2008-12-09 13:15:23 +0000109 if (Alignment.isInvalid())
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000110 return;
111
112 PP.Lex(Tok);
113 } else if (Tok.is(tok::identifier)) {
114 const IdentifierInfo *II = Tok.getIdentifierInfo();
Chris Lattner08631c52008-11-23 21:45:46 +0000115 if (II->isStr("show")) {
John McCallf312b1e2010-08-26 23:41:50 +0000116 Kind = Sema::PPK_Show;
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000117 PP.Lex(Tok);
118 } else {
Chris Lattner08631c52008-11-23 21:45:46 +0000119 if (II->isStr("push")) {
John McCallf312b1e2010-08-26 23:41:50 +0000120 Kind = Sema::PPK_Push;
Chris Lattner08631c52008-11-23 21:45:46 +0000121 } else if (II->isStr("pop")) {
John McCallf312b1e2010-08-26 23:41:50 +0000122 Kind = Sema::PPK_Pop;
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000123 } else {
124 PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_invalid_action);
125 return;
Mike Stump1eb44332009-09-09 15:08:12 +0000126 }
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000127 PP.Lex(Tok);
Mike Stump1eb44332009-09-09 15:08:12 +0000128
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000129 if (Tok.is(tok::comma)) {
130 PP.Lex(Tok);
Mike Stump1eb44332009-09-09 15:08:12 +0000131
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000132 if (Tok.is(tok::numeric_constant)) {
133 Alignment = Actions.ActOnNumericConstant(Tok);
Sebastian Redl0e9eabc2008-12-09 13:15:23 +0000134 if (Alignment.isInvalid())
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000135 return;
136
137 PP.Lex(Tok);
138 } else if (Tok.is(tok::identifier)) {
139 Name = Tok.getIdentifierInfo();
140 PP.Lex(Tok);
Mike Stump1eb44332009-09-09 15:08:12 +0000141
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000142 if (Tok.is(tok::comma)) {
143 PP.Lex(Tok);
Mike Stump1eb44332009-09-09 15:08:12 +0000144
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000145 if (Tok.isNot(tok::numeric_constant)) {
Chris Lattner08631c52008-11-23 21:45:46 +0000146 PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_malformed);
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000147 return;
148 }
Mike Stump1eb44332009-09-09 15:08:12 +0000149
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000150 Alignment = Actions.ActOnNumericConstant(Tok);
Sebastian Redl0e9eabc2008-12-09 13:15:23 +0000151 if (Alignment.isInvalid())
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000152 return;
153
154 PP.Lex(Tok);
155 }
156 } else {
Chris Lattner08631c52008-11-23 21:45:46 +0000157 PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_malformed);
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000158 return;
159 }
160 }
161 }
Sebastian Redl0e9eabc2008-12-09 13:15:23 +0000162 }
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000163
164 if (Tok.isNot(tok::r_paren)) {
Ted Kremenek4726d032009-03-23 22:28:25 +0000165 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_rparen) << "pack";
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000166 return;
167 }
168
Daniel Dunbar861800c2010-05-26 23:29:06 +0000169 SourceLocation RParenLoc = Tok.getLocation();
Eli Friedman99914792009-06-05 00:49:58 +0000170 PP.Lex(Tok);
171 if (Tok.isNot(tok::eom)) {
172 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << "pack";
173 return;
174 }
175
Sebastian Redleffa8d12008-12-10 00:02:53 +0000176 Actions.ActOnPragmaPack(Kind, Name, Alignment.release(), PackLoc,
Daniel Dunbarfcdd8fe2008-10-04 19:21:03 +0000177 LParenLoc, RParenLoc);
178}
179
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000180// #pragma 'align' '=' {'native','natural','mac68k','power','reset'}
181// #pragma 'options 'align' '=' {'native','natural','mac68k','power','reset'}
John McCallf312b1e2010-08-26 23:41:50 +0000182static void ParseAlignPragma(Sema &Actions, Preprocessor &PP, Token &FirstTok,
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000183 bool IsOptions) {
Daniel Dunbar861800c2010-05-26 23:29:06 +0000184 Token Tok;
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000185
186 if (IsOptions) {
187 PP.Lex(Tok);
188 if (Tok.isNot(tok::identifier) ||
189 !Tok.getIdentifierInfo()->isStr("align")) {
190 PP.Diag(Tok.getLocation(), diag::warn_pragma_options_expected_align);
191 return;
192 }
Daniel Dunbar861800c2010-05-26 23:29:06 +0000193 }
Daniel Dunbar638e7cf2010-05-27 18:42:09 +0000194
Daniel Dunbar861800c2010-05-26 23:29:06 +0000195 PP.Lex(Tok);
196 if (Tok.isNot(tok::equal)) {
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000197 PP.Diag(Tok.getLocation(), diag::warn_pragma_align_expected_equal)
198 << IsOptions;
Daniel Dunbar861800c2010-05-26 23:29:06 +0000199 return;
200 }
201
202 PP.Lex(Tok);
203 if (Tok.isNot(tok::identifier)) {
204 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000205 << (IsOptions ? "options" : "align");
Daniel Dunbar861800c2010-05-26 23:29:06 +0000206 return;
207 }
208
John McCallf312b1e2010-08-26 23:41:50 +0000209 Sema::PragmaOptionsAlignKind Kind = Sema::POAK_Natural;
Daniel Dunbar861800c2010-05-26 23:29:06 +0000210 const IdentifierInfo *II = Tok.getIdentifierInfo();
Daniel Dunbar638e7cf2010-05-27 18:42:09 +0000211 if (II->isStr("native"))
John McCallf312b1e2010-08-26 23:41:50 +0000212 Kind = Sema::POAK_Native;
Daniel Dunbar638e7cf2010-05-27 18:42:09 +0000213 else if (II->isStr("natural"))
John McCallf312b1e2010-08-26 23:41:50 +0000214 Kind = Sema::POAK_Natural;
Daniel Dunbar6f739142010-05-27 18:42:17 +0000215 else if (II->isStr("packed"))
John McCallf312b1e2010-08-26 23:41:50 +0000216 Kind = Sema::POAK_Packed;
Daniel Dunbar861800c2010-05-26 23:29:06 +0000217 else if (II->isStr("power"))
John McCallf312b1e2010-08-26 23:41:50 +0000218 Kind = Sema::POAK_Power;
Daniel Dunbar861800c2010-05-26 23:29:06 +0000219 else if (II->isStr("mac68k"))
John McCallf312b1e2010-08-26 23:41:50 +0000220 Kind = Sema::POAK_Mac68k;
Daniel Dunbar861800c2010-05-26 23:29:06 +0000221 else if (II->isStr("reset"))
John McCallf312b1e2010-08-26 23:41:50 +0000222 Kind = Sema::POAK_Reset;
Daniel Dunbar861800c2010-05-26 23:29:06 +0000223 else {
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000224 PP.Diag(Tok.getLocation(), diag::warn_pragma_align_invalid_option)
225 << IsOptions;
Daniel Dunbar861800c2010-05-26 23:29:06 +0000226 return;
227 }
228
229 SourceLocation KindLoc = Tok.getLocation();
230 PP.Lex(Tok);
231 if (Tok.isNot(tok::eom)) {
232 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000233 << (IsOptions ? "options" : "align");
Daniel Dunbar861800c2010-05-26 23:29:06 +0000234 return;
235 }
236
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000237 Actions.ActOnPragmaOptionsAlign(Kind, FirstTok.getLocation(), KindLoc);
238}
239
Douglas Gregor80c60f72010-09-09 22:45:38 +0000240void PragmaAlignHandler::HandlePragma(Preprocessor &PP,
241 PragmaIntroducerKind Introducer,
242 Token &AlignTok) {
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000243 ParseAlignPragma(Actions, PP, AlignTok, /*IsOptions=*/false);
244}
245
Douglas Gregor80c60f72010-09-09 22:45:38 +0000246void PragmaOptionsHandler::HandlePragma(Preprocessor &PP,
247 PragmaIntroducerKind Introducer,
248 Token &OptionsTok) {
Daniel Dunbarcbb98ed2010-07-31 19:17:07 +0000249 ParseAlignPragma(Actions, PP, OptionsTok, /*IsOptions=*/true);
Daniel Dunbar861800c2010-05-26 23:29:06 +0000250}
251
Ted Kremenek4726d032009-03-23 22:28:25 +0000252// #pragma unused(identifier)
Douglas Gregor80c60f72010-09-09 22:45:38 +0000253void PragmaUnusedHandler::HandlePragma(Preprocessor &PP,
254 PragmaIntroducerKind Introducer,
255 Token &UnusedTok) {
Ted Kremenek4726d032009-03-23 22:28:25 +0000256 // FIXME: Should we be expanding macros here? My guess is no.
257 SourceLocation UnusedLoc = UnusedTok.getLocation();
Mike Stump1eb44332009-09-09 15:08:12 +0000258
Ted Kremenek4726d032009-03-23 22:28:25 +0000259 // Lex the left '('.
260 Token Tok;
261 PP.Lex(Tok);
262 if (Tok.isNot(tok::l_paren)) {
263 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen) << "unused";
264 return;
265 }
266 SourceLocation LParenLoc = Tok.getLocation();
Mike Stump1eb44332009-09-09 15:08:12 +0000267
Ted Kremenek4726d032009-03-23 22:28:25 +0000268 // Lex the declaration reference(s).
Ted Kremenek7a02a372009-08-03 23:24:57 +0000269 llvm::SmallVector<Token, 5> Identifiers;
Ted Kremenek4726d032009-03-23 22:28:25 +0000270 SourceLocation RParenLoc;
271 bool LexID = true;
Mike Stump1eb44332009-09-09 15:08:12 +0000272
Ted Kremenek4726d032009-03-23 22:28:25 +0000273 while (true) {
274 PP.Lex(Tok);
Mike Stump1eb44332009-09-09 15:08:12 +0000275
Ted Kremenek4726d032009-03-23 22:28:25 +0000276 if (LexID) {
Mike Stump1eb44332009-09-09 15:08:12 +0000277 if (Tok.is(tok::identifier)) {
Ted Kremenek7a02a372009-08-03 23:24:57 +0000278 Identifiers.push_back(Tok);
Ted Kremenek4726d032009-03-23 22:28:25 +0000279 LexID = false;
280 continue;
281 }
282
Ted Kremenek7a02a372009-08-03 23:24:57 +0000283 // Illegal token!
Ted Kremenek4726d032009-03-23 22:28:25 +0000284 PP.Diag(Tok.getLocation(), diag::warn_pragma_unused_expected_var);
285 return;
286 }
Mike Stump1eb44332009-09-09 15:08:12 +0000287
Ted Kremenek4726d032009-03-23 22:28:25 +0000288 // We are execting a ')' or a ','.
289 if (Tok.is(tok::comma)) {
290 LexID = true;
291 continue;
292 }
Mike Stump1eb44332009-09-09 15:08:12 +0000293
Ted Kremenek4726d032009-03-23 22:28:25 +0000294 if (Tok.is(tok::r_paren)) {
295 RParenLoc = Tok.getLocation();
296 break;
297 }
Mike Stump1eb44332009-09-09 15:08:12 +0000298
Ted Kremenek7a02a372009-08-03 23:24:57 +0000299 // Illegal token!
Ted Kremenek4726d032009-03-23 22:28:25 +0000300 PP.Diag(Tok.getLocation(), diag::warn_pragma_unused_expected_punc);
301 return;
302 }
Eli Friedman99914792009-06-05 00:49:58 +0000303
304 PP.Lex(Tok);
305 if (Tok.isNot(tok::eom)) {
306 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) <<
307 "unused";
308 return;
309 }
310
Ted Kremenek4726d032009-03-23 22:28:25 +0000311 // Verify that we have a location for the right parenthesis.
312 assert(RParenLoc.isValid() && "Valid '#pragma unused' must have ')'");
Ted Kremenek7a02a372009-08-03 23:24:57 +0000313 assert(!Identifiers.empty() && "Valid '#pragma unused' must have arguments");
Ted Kremenek4726d032009-03-23 22:28:25 +0000314
Argyrios Kyrtzidisb918d0f2011-01-17 18:58:44 +0000315 // For each identifier token, insert into the token stream a
316 // annot_pragma_unused token followed by the identifier token.
317 // This allows us to cache a "#pragma unused" that occurs inside an inline
318 // C++ member function.
319
320 Token *Toks = new Token[2*Identifiers.size()];
321 for (unsigned i=0; i != Identifiers.size(); i++) {
322 Token &pragmaUnusedTok = Toks[2*i], &idTok = Toks[2*i+1];
323 pragmaUnusedTok.startToken();
324 pragmaUnusedTok.setKind(tok::annot_pragma_unused);
325 pragmaUnusedTok.setLocation(UnusedLoc);
326 idTok = Identifiers[i];
327 }
328 PP.EnterTokenStream(Toks, 2*Identifiers.size(), /*DisableMacroExpansion=*/true, /*OwnsTokens=*/true);
Ted Kremenek4726d032009-03-23 22:28:25 +0000329}
Eli Friedman99914792009-06-05 00:49:58 +0000330
331// #pragma weak identifier
332// #pragma weak identifier '=' identifier
Douglas Gregor80c60f72010-09-09 22:45:38 +0000333void PragmaWeakHandler::HandlePragma(Preprocessor &PP,
334 PragmaIntroducerKind Introducer,
335 Token &WeakTok) {
Eli Friedman99914792009-06-05 00:49:58 +0000336 // FIXME: Should we be expanding macros here? My guess is no.
337 SourceLocation WeakLoc = WeakTok.getLocation();
338
339 Token Tok;
340 PP.Lex(Tok);
341 if (Tok.isNot(tok::identifier)) {
342 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier) << "weak";
343 return;
344 }
345
346 IdentifierInfo *WeakName = Tok.getIdentifierInfo(), *AliasName = 0;
347 SourceLocation WeakNameLoc = Tok.getLocation(), AliasNameLoc;
348
349 PP.Lex(Tok);
350 if (Tok.is(tok::equal)) {
351 PP.Lex(Tok);
352 if (Tok.isNot(tok::identifier)) {
Mike Stump1eb44332009-09-09 15:08:12 +0000353 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier)
Eli Friedman99914792009-06-05 00:49:58 +0000354 << "weak";
355 return;
356 }
357 AliasName = Tok.getIdentifierInfo();
358 AliasNameLoc = Tok.getLocation();
359 PP.Lex(Tok);
360 }
361
362 if (Tok.isNot(tok::eom)) {
363 PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << "weak";
364 return;
365 }
366
367 if (AliasName) {
368 Actions.ActOnPragmaWeakAlias(WeakName, AliasName, WeakLoc, WeakNameLoc,
369 AliasNameLoc);
370 } else {
371 Actions.ActOnPragmaWeakID(WeakName, WeakLoc, WeakNameLoc);
372 }
373}
Peter Collingbourne321b8172011-02-14 01:42:35 +0000374
375void
376PragmaFPContractHandler::HandlePragma(Preprocessor &PP,
377 PragmaIntroducerKind Introducer,
378 Token &Tok) {
379 tok::OnOffSwitch OOS;
380 if (PP.LexOnOffSwitch(OOS))
381 return;
382
383 Actions.ActOnPragmaFPContract(OOS);
384}
Peter Collingbournef315fa82011-02-14 01:42:53 +0000385
386void
387PragmaOpenCLExtensionHandler::HandlePragma(Preprocessor &PP,
388 PragmaIntroducerKind Introducer,
389 Token &Tok) {
390 PP.Lex(Tok);
391 if (Tok.isNot(tok::identifier)) {
392 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_identifier) <<
393 "OPENCL";
394 return;
395 }
396 IdentifierInfo *ename = Tok.getIdentifierInfo();
397 SourceLocation NameLoc = Tok.getLocation();
398
399 PP.Lex(Tok);
400 if (Tok.isNot(tok::colon)) {
401 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_colon) << ename;
402 return;
403 }
404
405 PP.Lex(Tok);
406 if (Tok.isNot(tok::identifier)) {
407 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_enable_disable);
408 return;
409 }
410 IdentifierInfo *op = Tok.getIdentifierInfo();
411
412 unsigned state;
413 if (op->isStr("enable")) {
414 state = 1;
415 } else if (op->isStr("disable")) {
416 state = 0;
417 } else {
418 PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_enable_disable);
419 return;
420 }
421
422 OpenCLOptions &f = Actions.getOpenCLOptions();
423 if (ename->isStr("all")) {
424#define OPENCLEXT(nm) f.nm = state;
425#include "clang/Basic/OpenCLExtensions.def"
426 }
427#define OPENCLEXT(nm) else if (ename->isStr(#nm)) { f.nm = state; }
428#include "clang/Basic/OpenCLExtensions.def"
429 else {
430 PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << ename;
431 return;
432 }
433}
434