blob: 543d53a91d3de780a3189e6c5fa4c8a9a849e830 [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
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 {
zonr6315f762010-10-05 15:35:14 +080012 class APValue;
Shih-wei Liao324c0472010-06-21 13:15:11 -070013}
14
Shih-wei Liao462aefd2010-06-04 15:32:04 -070015namespace slang {
16
zonr6315f762010-10-05 15:35:14 +080017 class RSContext;
18 class RSExportType;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070019
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 Liao9ef2f782010-10-01 12:31:37 -070041}; // RSExportVar
Shih-wei Liao462aefd2010-06-04 15:32:04 -070042
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070043} // namespace slang
Shih-wei Liao462aefd2010-06-04 15:32:04 -070044
zonr6315f762010-10-05 15:35:14 +080045#endif // _SLANG_COMPILER_RS_EXPORT_VAR_H