blob: def4571610fe0737e75e43316d409ebcbfac7ffd [file] [log] [blame]
zonr6315f762010-10-05 15:35:14 +08001#ifndef _SLANG_COMPILER_RS_EXPORT_VAR_H
2#define _SLANG_COMPILER_RS_EXPORT_VAR_H
Shih-wei Liao462aefd2010-06-04 15:32:04 -07003
Zonr Changa41ce1d2010-10-06 02:23:12 +08004#include <string>
5
Shih-wei Liao9ef2f782010-10-01 12:31:37 -07006#include "llvm/ADT/StringRef.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -07007
Shih-wei Liao9ef2f782010-10-01 12:31:37 -07008#include "clang/AST/Decl.h"
9#include "clang/AST/Expr.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -070010
Zonr Changa41ce1d2010-10-06 02:23:12 +080011#include "slang_rs_exportable.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -070012
Shih-wei Liao324c0472010-06-21 13:15:11 -070013namespace clang {
zonr6315f762010-10-05 15:35:14 +080014 class APValue;
Shih-wei Liao324c0472010-06-21 13:15:11 -070015}
16
Shih-wei Liao462aefd2010-06-04 15:32:04 -070017namespace slang {
zonr6315f762010-10-05 15:35:14 +080018 class RSContext;
19 class RSExportType;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070020
Zonr Changa41ce1d2010-10-06 02:23:12 +080021class RSExportVar : public RSExportable {
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070022 friend class RSContext;
23 private:
24 RSContext *mContext;
25 std::string mName;
26 const RSExportType *mET;
27 bool mIsConst;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070028
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070029 clang::Expr::EvalResult mInit;
Shih-wei Liao324c0472010-06-21 13:15:11 -070030
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070031 RSExportVar(RSContext *Context,
32 const clang::VarDecl *VD,
33 const RSExportType *ET);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070034
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070035 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 Liao462aefd2010-06-04 15:32:04 -070040
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070041 inline const clang::APValue &getInit() const { return mInit.Val; }
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070042}; // RSExportVar
Shih-wei Liao462aefd2010-06-04 15:32:04 -070043
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070044} // namespace slang
Shih-wei Liao462aefd2010-06-04 15:32:04 -070045
zonr6315f762010-10-05 15:35:14 +080046#endif // _SLANG_COMPILER_RS_EXPORT_VAR_H