diff options
author | Chris Lattner <sabre@nondot.org> | 2006-07-06 21:35:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-07-06 21:35:01 +0000 |
commit | 3d40daa4744ef1cbaa9a503216c03e82bef7a7e6 (patch) | |
tree | 59c3e1fc01f312d38b94a59937209ee8696de842 /llvm/lib/Bytecode/Reader/Reader.h | |
parent | 0e316b4dbfc20d2aa39d821b9c85fdac008f7614 (diff) | |
download | bcm5719-llvm-3d40daa4744ef1cbaa9a503216c03e82bef7a7e6.tar.gz bcm5719-llvm-3d40daa4744ef1cbaa9a503216c03e82bef7a7e6.zip |
Change the ModuleProvider interface to not throw exceptions.
llvm-svn: 29024
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.h')
-rw-r--r-- | llvm/lib/Bytecode/Reader/Reader.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.h b/llvm/lib/Bytecode/Reader/Reader.h index ffc251b64ef..9cecf52436f 100644 --- a/llvm/lib/Bytecode/Reader/Reader.h +++ b/llvm/lib/Bytecode/Reader/Reader.h @@ -153,18 +153,33 @@ public: /// implementation is identical to the ParseFunction method. /// @see ParseFunction /// @brief Make a specific function materialize. - virtual void materializeFunction(Function *F) { + virtual bool materializeFunction(Function *F, std::string *ErrInfo = 0) { LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.find(F); - if (Fi == LazyFunctionLoadMap.end()) return; - ParseFunction(F); + if (Fi == LazyFunctionLoadMap.end()) return false; + try { + ParseFunction(F); + } catch (std::string &ErrStr) { + if (ErrInfo) *ErrInfo = ErrStr; + return true; + } catch (...) { + return true; + } + return false; } /// This method is abstract in the parent ModuleProvider class. Its /// implementation is identical to ParseAllFunctionBodies. /// @see ParseAllFunctionBodies /// @brief Make the whole module materialize - virtual Module* materializeModule() { - ParseAllFunctionBodies(); + virtual Module* materializeModule(std::string *ErrInfo = 0) { + try { + ParseAllFunctionBodies(); + } catch (std::string &ErrStr) { + if (ErrInfo) *ErrInfo = ErrStr; + return 0; + } catch (...) { + return 0; + } return TheModule; } |