aboutsummaryrefslogtreecommitdiffstats
path: root/slang_rs_context.cpp
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2010-11-17 17:28:59 -0800
committerStephen Hines <srhines@google.com>2010-11-17 19:25:15 -0800
commit3fbe68a4ec20fec25f8a40191437bbc02d00f591 (patch)
tree54e6dd1649f57478609bbadc0dc1e296c1510a3a /slang_rs_context.cpp
parent650c02be6719a961027c86d6b9a142014eb889db (diff)
downloadandroid_frameworks_compile_slang-3fbe68a4ec20fec25f8a40191437bbc02d00f591.tar.gz
android_frameworks_compile_slang-3fbe68a4ec20fec25f8a40191437bbc02d00f591.tar.bz2
android_frameworks_compile_slang-3fbe68a4ec20fec25f8a40191437bbc02d00f591.zip
Turn on support for exporting non-static funcs.
Bug: 2932253 Change-Id: Ice5422b4a3d78f8c2973e1af6c8abea30fa74bb6
Diffstat (limited to 'slang_rs_context.cpp')
-rw-r--r--slang_rs_context.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/slang_rs_context.cpp b/slang_rs_context.cpp
index cd4c8af..9edf383 100644
--- a/slang_rs_context.cpp
+++ b/slang_rs_context.cpp
@@ -51,7 +51,7 @@ RSContext::RSContext(clang::Preprocessor &PP,
mTargetData(NULL),
mLLVMContext(llvm::getGlobalContext()),
mExportAllNonStaticVars(true),
- mExportAllNonStaticFuncs(false),
+ mExportAllNonStaticFuncs(true),
mLicenseNote(NULL) {
// For #pragma rs export_var
PP.AddPragmaHandler(
@@ -105,11 +105,18 @@ bool RSContext::processExportVar(const clang::VarDecl *VD) {
return true;
}
+static bool isSpecialRSFunc(const llvm::StringRef& Name) {
+ static llvm::StringRef FuncInit("init");
+ static llvm::StringRef FuncRoot("root");
+ return Name.equals(FuncInit) || Name.equals(FuncRoot);
+}
+
bool RSContext::processExportFunc(const clang::FunctionDecl *FD) {
assert(!FD->getName().empty() && "Function name should not be empty");
- if (!FD->isThisDeclarationADefinition())
- return false;
+ if (!FD->isThisDeclarationADefinition()) {
+ return true;
+ }
if (FD->getStorageClass() != clang::SC_None) {
fprintf(stderr, "RSContext::processExportFunc : cannot export extern or "
@@ -117,6 +124,11 @@ bool RSContext::processExportFunc(const clang::FunctionDecl *FD) {
return false;
}
+ // Do not reflect specialized RS functions like init/root.
+ if (isSpecialRSFunc(FD->getName())) {
+ return true;
+ }
+
RSExportFunc *EF = RSExportFunc::Create(this, FD);
if (EF == NULL)
return false;