Fix reflection of setters for unsigned primitive types.
BUG=6764163
We now generate set_*() functions for unsigned types by creating a single
element FieldPacker and stuffing it with the larger Dalvik type. Reusing
FieldPacker in this way allows us to validate that the input is non-negative
and within the appropriate range (i.e. not really using more bits than the
unsigned C type should).
This change also fixes a subtle race where the Dalvik and script side can
disagree about a variable's value. All set_*() methods need to be synchronized,
and we must do the Dalvik update after validating the input data.
Change-Id: I7b2371206848ebbf0b0752779cb6c98cec1ab5f6
diff --git a/slang_rs_export_var.h b/slang_rs_export_var.h
index 221551f..5957153 100644
--- a/slang_rs_export_var.h
+++ b/slang_rs_export_var.h
@@ -27,10 +27,6 @@
#include "slang_assert.h"
#include "slang_rs_exportable.h"
-namespace clang {
- class APValue;
-}
-
namespace slang {
class RSContext;
class RSExportType;
@@ -41,6 +37,7 @@
std::string mName;
const RSExportType *mET;
bool mIsConst;
+ bool mIsUnsigned;
clang::Expr::EvalResult mInit;
@@ -56,6 +53,7 @@
inline const std::string &getName() const { return mName; }
inline const RSExportType *getType() const { return mET; }
inline bool isConst() const { return mIsConst; }
+ inline bool isUnsigned() const { return mIsUnsigned; }
inline const clang::APValue &getInit() const { return mInit.Val; }