zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 1 | #ifndef _SLANG_COMPILER_RS_EXPORT_VAR_H |
2 | #define _SLANG_COMPILER_RS_EXPORT_VAR_H | ||||
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 3 | |
Zonr Chang | a41ce1d | 2010-10-06 02:23:12 +0800 | [diff] [blame^] | 4 | #include <string> |
5 | |||||
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 6 | #include "llvm/ADT/StringRef.h" |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 7 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 8 | #include "clang/AST/Decl.h" |
9 | #include "clang/AST/Expr.h" | ||||
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 10 | |
Zonr Chang | a41ce1d | 2010-10-06 02:23:12 +0800 | [diff] [blame^] | 11 | #include "slang_rs_exportable.h" |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 12 | |
Shih-wei Liao | 324c047 | 2010-06-21 13:15:11 -0700 | [diff] [blame] | 13 | namespace clang { |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 14 | class APValue; |
Shih-wei Liao | 324c047 | 2010-06-21 13:15:11 -0700 | [diff] [blame] | 15 | } |
16 | |||||
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 17 | namespace slang { |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 18 | class RSContext; |
19 | class RSExportType; | ||||
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 20 | |
Zonr Chang | a41ce1d | 2010-10-06 02:23:12 +0800 | [diff] [blame^] | 21 | class RSExportVar : public RSExportable { |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 22 | friend class RSContext; |
23 | private: | ||||
24 | RSContext *mContext; | ||||
25 | std::string mName; | ||||
26 | const RSExportType *mET; | ||||
27 | bool mIsConst; | ||||
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 28 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 29 | clang::Expr::EvalResult mInit; |
Shih-wei Liao | 324c047 | 2010-06-21 13:15:11 -0700 | [diff] [blame] | 30 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 31 | RSExportVar(RSContext *Context, |
32 | const clang::VarDecl *VD, | ||||
33 | const RSExportType *ET); | ||||
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 34 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 35 | public: |
36 | inline const std::string &getName() const { return mName; } | ||||
37 | inline const RSExportType *getType() const { return mET; } | ||||
38 | inline RSContext *getRSContext() const { return mContext; } | ||||
39 | inline bool isConst() const { return mIsConst; } | ||||
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 40 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 41 | inline const clang::APValue &getInit() const { return mInit.Val; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 42 | }; // RSExportVar |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 43 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 44 | } // namespace slang |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 45 | |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 46 | #endif // _SLANG_COMPILER_RS_EXPORT_VAR_H |