Improve exeception handling around bcreader invocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14674
91177308-0d34-0410-b5e6-
96231b3b80d8
} catch (...) {
std::cerr << "Error creating the interpreter!\n";
}
+ } catch (std::string& errmsg) {
+ std::cerr << "Error reading the bytecode file: " << errmsg << "\n";
} catch (...) {
std::cerr << "Error reading the bytecode file!\n";
}
// Make sure we read in the function if it exists in this Module
try {
MP->materializeFunction(F);
+ } catch ( std::string& errmsg ) {
+ std::cerr << "Error parsing bytecode file: " << errmsg << "\n";
+ abort();
} catch (...) {
std::cerr << "Error parsing bytecode file!\n";
abort();
void FunctionPassManager::add(FunctionPass *P) { PM->add(P); }
void FunctionPassManager::add(ImmutablePass *IP) { PM->add(IP); }
bool FunctionPassManager::run(Function &F) {
- MP->materializeFunction(&F);
+ try {
+ MP->materializeFunction(&F);
+ } catch (std::string& errstr) {
+ std::cerr << "Error reading bytecode file: " << errstr << "\n";
+ abort();
+ } catch (...) {
+ std::cerr << "Error reading bytecode file:\n";
+ abort();
+ }
return PM->run(F);
}