Reflect initializer of an exported variable if any.
(NOTE: record type is unsupported currently)
Change-Id: I26fa50dc38488217420a25bafb07f29f6ab28d28
diff --git a/slang_rs_export_var.hpp b/slang_rs_export_var.hpp
index 1b1cf0a..e8c73a1 100644
--- a/slang_rs_export_var.hpp
+++ b/slang_rs_export_var.hpp
@@ -4,9 +4,14 @@
#include "llvm/ADT/StringRef.h" /* for class llvm::StringRef */
#include "clang/AST/Decl.h" /* for clang::VarDecl */
+#include "clang/AST/Expr.h" /* for clang::Expr */
#include <string>
+namespace clang {
+ class APValue;
+}
+
namespace slang {
using namespace clang;
@@ -21,6 +26,8 @@
std::string mName;
const RSExportType* mET;
+ Expr::EvalResult mInit;
+
RSExportVar(RSContext* Context, const VarDecl* VD, const RSExportType* ET);
public:
@@ -28,6 +35,8 @@
inline const RSExportType* getType() const { return mET; }
inline RSContext* getRSContext() const { return mContext; }
+ inline const APValue& getInit() const { return mInit.Val; }
+
}; /* RSExportVar */