zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame^] | 1 | #ifndef _SLANG_COMPILER_RS_EXPORT_ELEMENT_H |
| 2 | #define _SLANG_COMPILER_RS_EXPORT_ELEMENT_H |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | #include "llvm/ADT/StringMap.h" |
| 7 | #include "llvm/ADT/StringRef.h" |
| 8 | |
| 9 | #include "clang/Lex/Token.h" |
| 10 | |
| 11 | #include "slang_rs_export_type.h" |
| 12 | |
| 13 | namespace clang { |
| 14 | class Type; |
| 15 | class DeclaratorDecl; |
| 16 | } // namespace clang |
| 17 | |
| 18 | namespace slang { |
| 19 | |
| 20 | class RSContext; |
| 21 | class RSExportType; |
| 22 | |
| 23 | class RSExportElement { |
| 24 | // This is a utility class for handling the RS_ELEMENT_ADD* marker |
| 25 | RSExportElement() { return; } |
| 26 | |
| 27 | typedef struct { |
| 28 | RSExportPrimitiveType::DataKind kind; |
| 29 | RSExportPrimitiveType::DataType type; |
| 30 | bool normalized; |
| 31 | int vsize; |
| 32 | } ElementInfo; |
| 33 | |
| 34 | typedef llvm::StringMap<const ElementInfo*> ElementInfoMapTy; |
| 35 | |
| 36 | private: |
| 37 | // Macro name <-> ElementInfo |
| 38 | static ElementInfoMapTy ElementInfoMap; |
| 39 | |
| 40 | static bool Initialized; |
| 41 | |
| 42 | static RSExportType *Create(RSContext *Context, |
| 43 | const clang::Type *T, |
| 44 | const ElementInfo *EI); |
| 45 | |
| 46 | static const ElementInfo *GetElementInfo(const llvm::StringRef &Name); |
| 47 | public: |
| 48 | static void Init(); |
| 49 | |
| 50 | static RSExportType *CreateFromDecl(RSContext *Context, |
| 51 | const clang::DeclaratorDecl *DD); |
| 52 | }; |
| 53 | |
| 54 | } // namespace slang |
| 55 | |
| 56 | #endif // _SLANG_COMPILER_RS_EXPORT_ELEMENT_H |