slang_rs_export_var.h revision a41ce1d98094da84643995d40d71c529905123fc
1#ifndef _SLANG_COMPILER_RS_EXPORT_VAR_H
2#define _SLANG_COMPILER_RS_EXPORT_VAR_H
3
4#include <string>
5
6#include "llvm/ADT/StringRef.h"
7
8#include "clang/AST/Decl.h"
9#include "clang/AST/Expr.h"
10
11#include "slang_rs_exportable.h"
12
13namespace clang {
14  class APValue;
15}
16
17namespace slang {
18  class RSContext;
19  class RSExportType;
20
21class RSExportVar : public RSExportable {
22  friend class RSContext;
23 private:
24  RSContext *mContext;
25  std::string mName;
26  const RSExportType *mET;
27  bool mIsConst;
28
29  clang::Expr::EvalResult mInit;
30
31  RSExportVar(RSContext *Context,
32              const clang::VarDecl *VD,
33              const RSExportType *ET);
34
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; }
40
41  inline const clang::APValue &getInit() const { return mInit.Val; }
42};  // RSExportVar
43
44}   // namespace slang
45
46#endif  // _SLANG_COMPILER_RS_EXPORT_VAR_H
47