Changes to get some meaningful feedback from the bytecode reader. At some point this stuff should all be exception driven, but for now it is not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-10-24 01:15:12 +00:00
parent 88dedc1544
commit d6b65255fe
5 changed files with 81 additions and 34 deletions

View File

@ -33,26 +33,30 @@ int main(int argc, char **argv) {
assert(InputFilenames.size() > 0 && "OneOrMore is not working");
// TODO: TEST argv[0]
string ErrorMessage;
if (Verbose) cerr << "Loading '" << InputFilenames[0] << "'\n";
std::auto_ptr<Module> Composite(ParseBytecodeFile(InputFilenames[0]));
std::auto_ptr<Module> Composite(ParseBytecodeFile(InputFilenames[0],
&ErrorMessage));
if (Composite.get() == 0) {
cerr << "Error opening bytecode file: '" << InputFilenames[0] << "'\n";
cerr << "Error opening bytecode file: '" << InputFilenames[0] << "'";
if (ErrorMessage.size()) cerr << ": " << ErrorMessage;
cerr << endl;
return 1;
}
for (unsigned i = 1; i < InputFilenames.size(); ++i) {
if (Verbose) cerr << "Loading '" << InputFilenames[i] << "'\n";
auto_ptr<Module> M(ParseBytecodeFile(InputFilenames[i]));
auto_ptr<Module> M(ParseBytecodeFile(InputFilenames[i], &ErrorMessage));
if (M.get() == 0) {
cerr << "Error opening bytecode file: '" << InputFilenames[i] << "'\n";
cerr << "Error opening bytecode file: '" << InputFilenames[i] << "'";
if (ErrorMessage.size()) cerr << ": " << ErrorMessage;
cerr << endl;
return 1;
}
if (Verbose) cerr << "Linking in '" << InputFilenames[i] << "'\n";
string ErrorMessage;
if (LinkModules(Composite.get(), M.get(), &ErrorMessage)) {
cerr << "Error linking in '" << InputFilenames[i] << "': "
<< ErrorMessage << endl;