aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-14 19:15:56 +0000
committerChris Lattner <sabre@nondot.org>2006-05-14 19:15:56 +0000
commit53bd1b9de74247acae27328cef95bd3888f6cd4d (patch)
treef19cde99cee4201c8c1272e86504be25a2e38dcf
parentf877e60616bca076b61a11d34b085607153e06a9 (diff)
print a nice error if bugpoint gets an error reading inputs. Bug identified
by coverity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28298 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/bugpoint/BugDriver.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index bd558db665..6660813211 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -94,24 +94,29 @@ bool BugDriver::addSources(const std::vector<std::string> &Filenames) {
assert(Program == 0 && "Cannot call addSources multiple times!");
assert(!Filenames.empty() && "Must specify at least on input filename!");
- // Load the first input file...
- Program = ParseInputFile(Filenames[0]);
- if (Program == 0) return true;
- if (!run_as_child)
- std::cout << "Read input file : '" << Filenames[0] << "'\n";
-
- for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
- std::auto_ptr<Module> M(ParseInputFile(Filenames[i]));
- if (M.get() == 0) return true;
-
+ try {
+ // Load the first input file.
+ Program = ParseInputFile(Filenames[0]);
+ if (Program == 0) return true;
if (!run_as_child)
- std::cout << "Linking in input file: '" << Filenames[i] << "'\n";
- std::string ErrorMessage;
- if (Linker::LinkModules(Program, M.get(), &ErrorMessage)) {
- std::cerr << ToolName << ": error linking in '" << Filenames[i] << "': "
- << ErrorMessage << '\n';
- return true;
+ std::cout << "Read input file : '" << Filenames[0] << "'\n";
+
+ for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
+ std::auto_ptr<Module> M(ParseInputFile(Filenames[i]));
+ if (M.get() == 0) return true;
+
+ if (!run_as_child)
+ std::cout << "Linking in input file: '" << Filenames[i] << "'\n";
+ std::string ErrorMessage;
+ if (Linker::LinkModules(Program, M.get(), &ErrorMessage)) {
+ std::cerr << ToolName << ": error linking in '" << Filenames[i] << "': "
+ << ErrorMessage << '\n';
+ return true;
+ }
}
+ } catch (const std::string &Error) {
+ std::cerr << ToolName << ": error reading input '" << Error << "'\n";
+ return true;
}
if (!run_as_child)