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 | 0300f3e71294a1fa92ebe8ff2f6bbe013612444b (patch) | |
tree | 047a77bc94841e58557f20821179abfcfea094d1 /lib/Bytecode/Reader/Reader.h | |
parent | fe030d786991293f5956ab4d730b735755272843 (diff) |
Change the ModuleProvider interface to not throw exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.h')
-rw-r--r-- | lib/Bytecode/Reader/Reader.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/Bytecode/Reader/Reader.h b/lib/Bytecode/Reader/Reader.h index ffc251b64e..9cecf52436 100644 --- a/lib/Bytecode/Reader/Reader.h +++ b/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; } |