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 { 20 class Sema; 21 class Parser; 22 23 class PragmaAlignHandler : public PragmaHandler { 24 Sema &Actions; 25 public: PragmaAlignHandler(Sema & A)26 explicit PragmaAlignHandler(Sema &A) : PragmaHandler("align"), Actions(A) {} 27 28 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 29 Token &FirstToken); 30 }; 31 32 class PragmaGCCVisibilityHandler : public PragmaHandler { 33 Sema &Actions; 34 public: PragmaGCCVisibilityHandler(Sema & A)35 explicit PragmaGCCVisibilityHandler(Sema &A) : PragmaHandler("visibility"), 36 Actions(A) {} 37 38 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 39 Token &FirstToken); 40 }; 41 42 class PragmaOptionsHandler : public PragmaHandler { 43 Sema &Actions; 44 public: PragmaOptionsHandler(Sema & A)45 explicit PragmaOptionsHandler(Sema &A) : PragmaHandler("options"), 46 Actions(A) {} 47 48 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 49 Token &FirstToken); 50 }; 51 52 class PragmaPackHandler : public PragmaHandler { 53 Sema &Actions; 54 public: PragmaPackHandler(Sema & A)55 explicit PragmaPackHandler(Sema &A) : PragmaHandler("pack"), 56 Actions(A) {} 57 58 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 59 Token &FirstToken); 60 }; 61 62 class PragmaMSStructHandler : public PragmaHandler { 63 Sema &Actions; 64 public: PragmaMSStructHandler(Sema & A)65 explicit PragmaMSStructHandler(Sema &A) : PragmaHandler("ms_struct"), 66 Actions(A) {} 67 68 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 69 Token &FirstToken); 70 }; 71 72 class PragmaUnusedHandler : public PragmaHandler { 73 Sema &Actions; 74 Parser &parser; 75 public: PragmaUnusedHandler(Sema & A,Parser & p)76 PragmaUnusedHandler(Sema &A, Parser& p) 77 : PragmaHandler("unused"), Actions(A), parser(p) {} 78 79 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 80 Token &FirstToken); 81 }; 82 83 class PragmaWeakHandler : public PragmaHandler { 84 Sema &Actions; 85 public: PragmaWeakHandler(Sema & A)86 explicit PragmaWeakHandler(Sema &A) 87 : PragmaHandler("weak"), Actions(A) {} 88 89 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 90 Token &FirstToken); 91 }; 92 93 class PragmaRedefineExtnameHandler : public PragmaHandler { 94 Sema &Actions; 95 public: PragmaRedefineExtnameHandler(Sema & A)96 explicit PragmaRedefineExtnameHandler(Sema &A) 97 : PragmaHandler("redefine_extname"), Actions(A) {} 98 99 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 100 Token &FirstToken); 101 }; 102 103 class PragmaOpenCLExtensionHandler : public PragmaHandler { 104 Sema &Actions; 105 Parser &parser; 106 public: PragmaOpenCLExtensionHandler(Sema & S,Parser & p)107 PragmaOpenCLExtensionHandler(Sema &S, Parser& p) : 108 PragmaHandler("EXTENSION"), Actions(S), parser(p) {} 109 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 110 Token &FirstToken); 111 }; 112 113 114 class PragmaFPContractHandler : public PragmaHandler { 115 Sema &Actions; 116 Parser &parser; 117 public: PragmaFPContractHandler(Sema & S,Parser & p)118 PragmaFPContractHandler(Sema &S, Parser& p) : 119 PragmaHandler("FP_CONTRACT"), Actions(S), parser(p) {} 120 virtual void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer, 121 Token &FirstToken); 122 }; 123 124 125 } // end namespace clang 126 127 #endif 128