diff options
author | Jason Sams <rjsams@android.com> | 2011-01-19 16:49:17 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-19 16:49:17 -0800 |
commit | 1368436e428e2af1241bf88cb0688f288f96da1c (patch) | |
tree | f183904ced5f75c99097bac91b9f28b4a5d7103c /libs | |
parent | 28f0a53a882a39bc22bc5892250411cadf6c0d5d (diff) | |
parent | fdc54a97ee588bbd6c981a5708050fd97f01baec (diff) | |
download | frameworks_base-1368436e428e2af1241bf88cb0688f288f96da1c.zip frameworks_base-1368436e428e2af1241bf88cb0688f288f96da1c.tar.gz frameworks_base-1368436e428e2af1241bf88cb0688f288f96da1c.tar.bz2 |
Merge "Check and propogate errors from llvm." into honeycomb
Diffstat (limited to 'libs')
-rw-r--r-- | libs/rs/rsScriptC.cpp | 25 | ||||
-rw-r--r-- | libs/rs/rsScriptC.h | 2 |
2 files changed, 16 insertions, 11 deletions
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 9f730bf..1fceb66 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -467,7 +467,7 @@ extern const char rs_runtime_lib_bc[]; extern unsigned rs_runtime_lib_bc_size; #endif -void ScriptCState::runCompiler(Context *rsc, +bool ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir) { @@ -482,7 +482,7 @@ void ScriptCState::runCompiler(Context *rsc, s->mEnviroment.mScriptText, s->mEnviroment.mScriptTextLength, 0) != 0) { LOGE("bcc: FAILS to read bitcode"); - // Handle Fatal Error + return false; } #if 1 @@ -493,14 +493,14 @@ void ScriptCState::runCompiler(Context *rsc, /*"1" means skip buffer here, and let libbcc decide*/, 0) != 0) { LOGE("bcc: FAILS to link bitcode"); - // Handle Fatal Error + return false; } #endif char *cachePath = genCacheFileName(cacheDir, resName, ".oBCC"); if (bccPrepareExecutable(s->mBccScript, cachePath, 0) != 0) { LOGE("bcc: FAILS to prepare executable"); - // Handle Fatal Error + return false; } free(cachePath); @@ -547,7 +547,7 @@ void ScriptCState::runCompiler(Context *rsc, continue; } LOGE("Invalid version pragma value: %s\n", values[i]); - // Handle Fatal Error + return false; } if (!strcmp(keys[i], "stateVertex")) { @@ -559,7 +559,7 @@ void ScriptCState::runCompiler(Context *rsc, continue; } LOGE("Unrecognized value %s passed to stateVertex", values[i]); - // Handle Fatal Error + return false; } if (!strcmp(keys[i], "stateRaster")) { @@ -571,7 +571,7 @@ void ScriptCState::runCompiler(Context *rsc, continue; } LOGE("Unrecognized value %s passed to stateRaster", values[i]); - // Handle Fatal Error + return false; } if (!strcmp(keys[i], "stateFragment")) { @@ -583,7 +583,7 @@ void ScriptCState::runCompiler(Context *rsc, continue; } LOGE("Unrecognized value %s passed to stateFragment", values[i]); - // Handle Fatal Error + return false; } if (!strcmp(keys[i], "stateStore")) { @@ -595,9 +595,10 @@ void ScriptCState::runCompiler(Context *rsc, continue; } LOGE("Unrecognized value %s passed to stateStore", values[i]); - // Handle Fatal Error + return false; } } + return true; } namespace android { @@ -630,7 +631,11 @@ RsScript rsi_ScriptCCreate(Context *rsc, ss->mScript.clear(); s->incUserRef(); - ss->runCompiler(rsc, s.get(), resName, cacheDir); + if (!ss->runCompiler(rsc, s.get(), resName, cacheDir)) { + // Error during compile, destroy s and return null. + s->zeroUserRef(); + return NULL; + } ss->clear(rsc); return s.get(); } diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h index 483481e..612e38a 100644 --- a/libs/rs/rsScriptC.h +++ b/libs/rs/rsScriptC.h @@ -81,7 +81,7 @@ public: void init(Context *rsc); void clear(Context *rsc); - void runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir); + bool runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir); struct SymbolTable_t { const char * mName; |