blob: e9b22906b95934a4989081f91628fe8f43b065f9 [file] [log] [blame]
Shih-wei Liao462aefd2010-06-04 15:32:04 -07001#ifndef _SLANG_COMPILER_RS_EXPORT_VAR_HPP
2# define _SLANG_COMPILER_RS_EXPORT_VAR_HPP
3
Shih-wei Liao9ef2f782010-10-01 12:31:37 -07004#include "llvm/ADT/StringRef.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -07005
Shih-wei Liao9ef2f782010-10-01 12:31:37 -07006#include "clang/AST/Decl.h"
7#include "clang/AST/Expr.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -07008
9#include <string>
10
Shih-wei Liao324c0472010-06-21 13:15:11 -070011namespace clang {
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070012class APValue;
Shih-wei Liao324c0472010-06-21 13:15:11 -070013}
14
Shih-wei Liao462aefd2010-06-04 15:32:04 -070015namespace slang {
16
Shih-wei Liao462aefd2010-06-04 15:32:04 -070017class RSContext;
18class RSExportType;
19
20class RSExportVar {
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070021 friend class RSContext;
22 private:
23 RSContext *mContext;
24 std::string mName;
25 const RSExportType *mET;
26 bool mIsConst;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070027
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070028 clang::Expr::EvalResult mInit;
Shih-wei Liao324c0472010-06-21 13:15:11 -070029
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070030 RSExportVar(RSContext *Context,
31 const clang::VarDecl *VD,
32 const RSExportType *ET);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070033
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070034 public:
35 inline const std::string &getName() const { return mName; }
36 inline const RSExportType *getType() const { return mET; }
37 inline RSContext *getRSContext() const { return mContext; }
38 inline bool isConst() const { return mIsConst; }
Shih-wei Liao462aefd2010-06-04 15:32:04 -070039
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070040 inline const clang::APValue &getInit() const { return mInit.Val; }
Shih-wei Liao324c0472010-06-21 13:15:11 -070041
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070042}; // RSExportVar
Shih-wei Liao462aefd2010-06-04 15:32:04 -070043
44
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070045} // namespace slang
Shih-wei Liao462aefd2010-06-04 15:32:04 -070046
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070047#endif // _SLANG_COMPILER_RS_EXPORT_VAR_HPP