Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 1 | #ifndef _SLANG_COMILER_RS_PRAGMA_HANDLER_HPP |
| 2 | # define _SLANG_COMILER_RS_PRAGMA_HANDLER_HPP |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | #include "clang/Lex/Pragma.h" /* for class PragmaHandler */ |
| 7 | |
| 8 | namespace clang { |
| 9 | |
| 10 | class Token; |
| 11 | class IdentifierInfo; |
| 12 | class Preprocessor; |
| 13 | |
| 14 | } /* namespace clang */ |
| 15 | |
| 16 | namespace slang { |
| 17 | |
| 18 | using namespace clang; |
| 19 | |
| 20 | class RSContext; |
| 21 | |
| 22 | class RSPragmaHandler : public PragmaHandler { |
| 23 | protected: |
| 24 | RSContext* mContext; |
| 25 | |
| 26 | RSPragmaHandler(const IdentifierInfo* name, RSContext* Context) : PragmaHandler(name), mContext(Context) { return; } |
| 27 | |
| 28 | RSContext* getContext() const { return this->mContext; } |
| 29 | |
| 30 | virtual void handleItem(const std::string& Item) { return; } |
| 31 | |
| 32 | /* Handle pragma like #pragma rs [name] ([item #1],[item #2],...,[item #i]) */ |
| 33 | void handleItemListPragma(Preprocessor& PP, Token& FirstToken); |
| 34 | |
Victor Hsieh | c6718b3 | 2010-06-23 09:29:44 +0800 | [diff] [blame] | 35 | /* Handle pragma like #pragma rs [name] */ |
| 36 | void handleNonParamPragma(Preprocessor& PP, Token& FirstToken); |
| 37 | |
Victor Hsieh | d8a0d18 | 2010-07-07 19:22:33 +0800 | [diff] [blame] | 38 | /* Handle pragma like #pragma rs [name] ("string literal") */ |
| 39 | void handleOptionalStringLiateralParamPragma(Preprocessor& PP, Token& FirstToken); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 40 | public: |
| 41 | static RSPragmaHandler* CreatePragmaExportVarHandler(RSContext* Context); |
Victor Hsieh | c6718b3 | 2010-06-23 09:29:44 +0800 | [diff] [blame] | 42 | static RSPragmaHandler* CreatePragmaExportVarAllHandler(RSContext* Context); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 43 | static RSPragmaHandler* CreatePragmaExportFuncHandler(RSContext* Context); |
Victor Hsieh | c6718b3 | 2010-06-23 09:29:44 +0800 | [diff] [blame] | 44 | static RSPragmaHandler* CreatePragmaExportFuncAllHandler(RSContext* Context); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 45 | static RSPragmaHandler* CreatePragmaExportTypeHandler(RSContext* Context); |
Shih-wei Liao | 537446c | 2010-06-11 16:05:55 -0700 | [diff] [blame] | 46 | static RSPragmaHandler* CreatePragmaJavaPackageNameHandler(RSContext* Context); |
Victor Hsieh | d8a0d18 | 2010-07-07 19:22:33 +0800 | [diff] [blame] | 47 | static RSPragmaHandler* CreatePragmaReflectLicenseHandler(RSContext* Context); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 48 | |
| 49 | virtual void HandlePragma(Preprocessor& PP, Token& FirstToken) = 0; |
| 50 | }; |
| 51 | |
| 52 | } /* namespace slang */ |
| 53 | |
| 54 | #endif /* _SLANG_COMILER_RS_PRAGMA_HANDLER_HPP */ |