Skip reflection of resize() when building for the compatibility library.
Change-Id: I2669914b3139756a8cf559ed99b845e77df87df0
diff --git a/slang_rs_context.cpp b/slang_rs_context.cpp
index caa3955..04f5d99 100644
--- a/slang_rs_context.cpp
+++ b/slang_rs_context.cpp
@@ -59,6 +59,7 @@
mLicenseNote(NULL),
mRSPackageName("android.renderscript"),
version(0),
+ mIsCompatLib(false),
mMangleCtx(Ctx.createMangleContext()) {
slangAssert(mGeneratedFileNames && "Must supply GeneratedFileNames");
@@ -303,6 +304,12 @@
mRSPackageName = RSPackageName;
}
+ // If we are not targeting the actual Android Renderscript classes,
+ // we should reflect code that works with the compatibility library.
+ if (mRSPackageName.compare("android.renderscript") != 0) {
+ mIsCompatLib = true;
+ }
+
RSReflection *R = new RSReflection(this, mGeneratedFileNames);
bool ret = R->reflect(OutputPathBase, PackageName, mRSPackageName,
InputFileName, OutputBCFileName);
diff --git a/slang_rs_context.h b/slang_rs_context.h
index 2463ad9..8e616bc 100644
--- a/slang_rs_context.h
+++ b/slang_rs_context.h
@@ -85,6 +85,9 @@
std::string mRSPackageName;
int version;
+
+ bool mIsCompatLib;
+
llvm::OwningPtr<clang::MangleContext> mMangleCtx;
bool processExportVar(const clang::VarDecl *VD);
@@ -228,6 +231,8 @@
return;
}
+ bool isCompatLib() const { return mIsCompatLib; }
+
void addPragma(const std::string &T, const std::string &V) {
mPragmas->push_back(make_pair(T, V));
}
diff --git a/slang_rs_reflection.cpp b/slang_rs_reflection.cpp
index a121728..6ae589e 100644
--- a/slang_rs_reflection.cpp
+++ b/slang_rs_reflection.cpp
@@ -1351,7 +1351,10 @@
genTypeClassComponentSetter(C, ERT);
genTypeClassComponentGetter(C, ERT);
genTypeClassCopyAll(C, ERT);
- genTypeClassResize(C);
+ if (!mRSContext->isCompatLib()) {
+ // Skip the resize method if we are targeting a compatibility library.
+ genTypeClassResize(C);
+ }
C.endClass();