Daniel Dunbar | fcdd8fe | 2008-10-04 19:21:03 +0000 | [diff] [blame] | 1 | //===---- ParserPragmas.h - Language specific pragmas -----------*- C++ -*-===// |
| 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 defines #pragma handlers for language specific pragmas. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_CLANG_PARSE_PARSEPRAGMA_H |
| 15 | #define LLVM_CLANG_PARSE_PARSEPRAGMA_H |
| 16 | |
| 17 | #include "clang/Lex/Pragma.h" |
| 18 | |
| 19 | namespace clang { |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 20 | class Sema; |
Ted Kremenek | 4726d03 | 2009-03-23 22:28:25 +0000 | [diff] [blame] | 21 | class Parser; |
Daniel Dunbar | fcdd8fe | 2008-10-04 19:21:03 +0000 | [diff] [blame] | 22 | |
Daniel Dunbar | cbb98ed | 2010-07-31 19:17:07 +0000 | [diff] [blame] | 23 | class PragmaAlignHandler : public PragmaHandler { |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 24 | Sema &Actions; |
Daniel Dunbar | cbb98ed | 2010-07-31 19:17:07 +0000 | [diff] [blame] | 25 | public: |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 26 | explicit PragmaAlignHandler(Sema &A) : PragmaHandler("align"), Actions(A) {} |
Daniel Dunbar | cbb98ed | 2010-07-31 19:17:07 +0000 | [diff] [blame] | 27 | |
Douglas Gregor | 80c60f7 | 2010-09-09 22:45:38 +0000 | [diff] [blame] | 28 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 29 | Token &FirstToken); |
Daniel Dunbar | cbb98ed | 2010-07-31 19:17:07 +0000 | [diff] [blame] | 30 | }; |
| 31 | |
Eli Friedman | aa8b0d1 | 2010-08-05 06:57:20 +0000 | [diff] [blame] | 32 | class PragmaGCCVisibilityHandler : public PragmaHandler { |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 33 | Sema &Actions; |
Eli Friedman | aa8b0d1 | 2010-08-05 06:57:20 +0000 | [diff] [blame] | 34 | public: |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 35 | explicit PragmaGCCVisibilityHandler(Sema &A) : PragmaHandler("visibility"), |
| 36 | Actions(A) {} |
Eli Friedman | aa8b0d1 | 2010-08-05 06:57:20 +0000 | [diff] [blame] | 37 | |
Douglas Gregor | 80c60f7 | 2010-09-09 22:45:38 +0000 | [diff] [blame] | 38 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 39 | Token &FirstToken); |
Eli Friedman | aa8b0d1 | 2010-08-05 06:57:20 +0000 | [diff] [blame] | 40 | }; |
| 41 | |
Daniel Dunbar | 861800c | 2010-05-26 23:29:06 +0000 | [diff] [blame] | 42 | class PragmaOptionsHandler : public PragmaHandler { |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 43 | Sema &Actions; |
Daniel Dunbar | 861800c | 2010-05-26 23:29:06 +0000 | [diff] [blame] | 44 | public: |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 45 | explicit PragmaOptionsHandler(Sema &A) : PragmaHandler("options"), |
| 46 | Actions(A) {} |
Daniel Dunbar | 861800c | 2010-05-26 23:29:06 +0000 | [diff] [blame] | 47 | |
Douglas Gregor | 80c60f7 | 2010-09-09 22:45:38 +0000 | [diff] [blame] | 48 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 49 | Token &FirstToken); |
Daniel Dunbar | 861800c | 2010-05-26 23:29:06 +0000 | [diff] [blame] | 50 | }; |
| 51 | |
Daniel Dunbar | fcdd8fe | 2008-10-04 19:21:03 +0000 | [diff] [blame] | 52 | class PragmaPackHandler : public PragmaHandler { |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 53 | Sema &Actions; |
Daniel Dunbar | fcdd8fe | 2008-10-04 19:21:03 +0000 | [diff] [blame] | 54 | public: |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 55 | explicit PragmaPackHandler(Sema &A) : PragmaHandler("pack"), |
| 56 | Actions(A) {} |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 57 | |
Douglas Gregor | 80c60f7 | 2010-09-09 22:45:38 +0000 | [diff] [blame] | 58 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 59 | Token &FirstToken); |
Daniel Dunbar | fcdd8fe | 2008-10-04 19:21:03 +0000 | [diff] [blame] | 60 | }; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 61 | |
Ted Kremenek | 4726d03 | 2009-03-23 22:28:25 +0000 | [diff] [blame] | 62 | class PragmaUnusedHandler : public PragmaHandler { |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 63 | Sema &Actions; |
Ted Kremenek | 4726d03 | 2009-03-23 22:28:25 +0000 | [diff] [blame] | 64 | Parser &parser; |
| 65 | public: |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 66 | PragmaUnusedHandler(Sema &A, Parser& p) |
Argyrios Kyrtzidis | 9b36c3f | 2010-07-13 09:07:17 +0000 | [diff] [blame] | 67 | : PragmaHandler("unused"), Actions(A), parser(p) {} |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 68 | |
Douglas Gregor | 80c60f7 | 2010-09-09 22:45:38 +0000 | [diff] [blame] | 69 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 70 | Token &FirstToken); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 71 | }; |
Daniel Dunbar | fcdd8fe | 2008-10-04 19:21:03 +0000 | [diff] [blame] | 72 | |
Eli Friedman | 9991479 | 2009-06-05 00:49:58 +0000 | [diff] [blame] | 73 | class PragmaWeakHandler : public PragmaHandler { |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 74 | Sema &Actions; |
Eli Friedman | 9991479 | 2009-06-05 00:49:58 +0000 | [diff] [blame] | 75 | public: |
John McCall | f312b1e | 2010-08-26 23:41:50 +0000 | [diff] [blame] | 76 | explicit PragmaWeakHandler(Sema &A) |
Argyrios Kyrtzidis | 9b36c3f | 2010-07-13 09:07:17 +0000 | [diff] [blame] | 77 | : PragmaHandler("weak"), Actions(A) {} |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 78 | |
Douglas Gregor | 80c60f7 | 2010-09-09 22:45:38 +0000 | [diff] [blame] | 79 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 80 | Token &FirstToken); |
Eli Friedman | 9991479 | 2009-06-05 00:49:58 +0000 | [diff] [blame] | 81 | }; |
| 82 | |
Peter Collingbourne | f315fa8 | 2011-02-14 01:42:53 +0000 | [diff] [blame] | 83 | class PragmaOpenCLExtensionHandler : public PragmaHandler { |
| 84 | Sema &Actions; |
| 85 | Parser &parser; |
| 86 | public: |
| 87 | PragmaOpenCLExtensionHandler(Sema &S, Parser& p) : |
| 88 | PragmaHandler("EXTENSION"), Actions(S), parser(p) {} |
| 89 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 90 | Token &FirstToken); |
| 91 | }; |
| 92 | |
| 93 | |
Peter Collingbourne | 321b817 | 2011-02-14 01:42:35 +0000 | [diff] [blame] | 94 | class PragmaFPContractHandler : public PragmaHandler { |
| 95 | Sema &Actions; |
| 96 | Parser &parser; |
| 97 | public: |
| 98 | PragmaFPContractHandler(Sema &S, Parser& p) : |
| 99 | PragmaHandler("FP_CONTRACT"), Actions(S), parser(p) {} |
| 100 | virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, |
| 101 | Token &FirstToken); |
| 102 | }; |
| 103 | |
| 104 | |
Daniel Dunbar | fcdd8fe | 2008-10-04 19:21:03 +0000 | [diff] [blame] | 105 | } // end namespace clang |
| 106 | |
| 107 | #endif |