aboutsummaryrefslogtreecommitdiffstats
path: root/slang_rs_export_func.h
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2011-02-10 11:04:44 -0800
committerShih-wei Liao <sliao@google.com>2011-02-10 11:06:36 -0800
commit3fa286b4c2f110c6be2bbfac9c715bb1ec880338 (patch)
treeb0910d64f2e92a745810afbbf3a3f65ae1e7b4f2 /slang_rs_export_func.h
parent8d5a2f6ab321615bfb3a46f68aff0b643a71caa0 (diff)
downloadandroid_frameworks_compile_slang-3fa286b4c2f110c6be2bbfac9c715bb1ec880338.tar.gz
android_frameworks_compile_slang-3fa286b4c2f110c6be2bbfac9c715bb1ec880338.tar.bz2
android_frameworks_compile_slang-3fa286b4c2f110c6be2bbfac9c715bb1ec880338.zip
Fix b/3427124. Adding the overloadable invokable feature. Reflect that type of invokables to Java.
1. Add __attribute__((overloadable)) support on the rs side for invokables. Requested by the Books team. 2. Add name mangling support and MangleContext. 3. Add the test P_overload. 4. This CL only affects Honeycomb SDK. It doesn't affect Final ROM. 5. This CL should go in at the same time with another CL on external/clang.git (to be done now.) Change-Id: I9e743894a97626d8c27b0dd9c0a51cef1175d2ab
Diffstat (limited to 'slang_rs_export_func.h')
-rw-r--r--slang_rs_export_func.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/slang_rs_export_func.h b/slang_rs_export_func.h
index 3a16c6d..101080a 100644
--- a/slang_rs_export_func.h
+++ b/slang_rs_export_func.h
@@ -43,12 +43,27 @@ class RSExportFunc : public RSExportable {
private:
std::string mName;
+ std::string mMangledName;
+ bool mShouldMangle;
RSExportRecordType *mParamPacketType;
- RSExportFunc(RSContext *Context, const llvm::StringRef &Name)
+ RSExportFunc(RSContext *Context, const llvm::StringRef &Name,
+ const clang::FunctionDecl *FD)
: RSExportable(Context, RSExportable::EX_FUNC),
mName(Name.data(), Name.size()),
+ mMangledName(),
+ mShouldMangle(false),
mParamPacketType(NULL) {
+
+ mShouldMangle = Context->getMangleContext().shouldMangleDeclName(FD);
+
+ if (mShouldMangle) {
+ llvm::SmallString<256> Buffer;
+ Context->getMangleContext().mangleName(FD, Buffer);
+
+ mMangledName = Buffer.str();
+ }
+
return;
}
@@ -69,7 +84,9 @@ class RSExportFunc : public RSExportable {
return mParamPacketType->fields_end();
}
- inline const std::string &getName() const { return mName; }
+ inline const std::string &getName(bool mangle=true) const {
+ return (mShouldMangle && mangle) ? mMangledName : mName;
+ }
inline bool hasParam() const
{ return (mParamPacketType && !mParamPacketType->getFields().empty()); }