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/ReaderWrappers.cpp | |
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/ReaderWrappers.cpp')
-rw-r--r-- | lib/Bytecode/Reader/ReaderWrappers.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/Bytecode/Reader/ReaderWrappers.cpp b/lib/Bytecode/Reader/ReaderWrappers.cpp index 956d1ede69..b9e7cd29aa 100644 --- a/lib/Bytecode/Reader/ReaderWrappers.cpp +++ b/lib/Bytecode/Reader/ReaderWrappers.cpp @@ -170,7 +170,8 @@ static ModuleProvider* CheckVarargs(ModuleProvider* MP) { // If we get to this point, we know that we have an old-style module. // Materialize the whole thing to perform the rewriting. - MP->materializeModule(); + if (MP->materializeModule() == 0) + return 0; if(Function* F = M->getNamedFunction("llvm.va_start")) { assert(F->arg_size() == 0 && "Obsolete va_start takes 0 argument!"); @@ -376,22 +377,18 @@ static void getSymbols(Module*M, std::vector<std::string>& symbols) { // Get just the externally visible defined symbols from the bytecode bool llvm::GetBytecodeSymbols(const sys::Path& fName, std::vector<std::string>& symbols) { - try { - std::auto_ptr<ModuleProvider> AMP( - getBytecodeModuleProvider(fName.toString())); + std::auto_ptr<ModuleProvider> AMP( + getBytecodeModuleProvider(fName.toString())); - // Get the module from the provider - Module* M = AMP->materializeModule(); + // Get the module from the provider + Module* M = AMP->materializeModule(); + if (M == 0) return false; - // Get the symbols - getSymbols(M, symbols); + // Get the symbols + getSymbols(M, symbols); - // Done with the module - return true; - - } catch (...) { - return false; - } + // Done with the module + return true; } ModuleProvider* @@ -406,6 +403,7 @@ llvm::GetBytecodeSymbols(const unsigned char*Buffer, unsigned Length, // Get the module from the provider Module* M = MP->materializeModule(); + if (M == 0) return 0; // Get the symbols getSymbols(M, symbols); |