Catch the parse exception if bad input is provided. Much better than an abort

llvm-svn: 1631
This commit is contained in:
Chris Lattner 2002-02-01 05:09:35 +00:00
parent ba57d74608
commit 78f1087b01
1 changed files with 8 additions and 3 deletions

View File

@ -259,9 +259,14 @@ struct {
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, " llvm analysis printer tool\n");
CurrentModule = ParseBytecodeFile(InputFilename);
if (!CurrentModule && !(CurrentModule = ParseAssemblyFile(InputFilename))) {
std::cerr << "Input file didn't read correctly.\n";
try {
CurrentModule = ParseBytecodeFile(InputFilename);
if (!CurrentModule && !(CurrentModule = ParseAssemblyFile(InputFilename))){
std::cerr << "Input file didn't read correctly.\n";
return 1;
}
} catch (const ParseException &E) {
cerr << E.getMessage() << endl;
return 1;
}