diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-02-01 05:09:35 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-02-01 05:09:35 +0000 |
| commit | 78f1087b01e33d5da77febd8cf7bd3f4d4f96cb1 (patch) | |
| tree | 4f85646266ebfed3baf152327c088874c50b87d3 /llvm/tools/analyze | |
| parent | ba57d74608ac6c905667295e156f3aa1419e8575 (diff) | |
| download | bcm5719-llvm-78f1087b01e33d5da77febd8cf7bd3f4d4f96cb1.tar.gz bcm5719-llvm-78f1087b01e33d5da77febd8cf7bd3f4d4f96cb1.zip | |
Catch the parse exception if bad input is provided. Much better than an abort
llvm-svn: 1631
Diffstat (limited to 'llvm/tools/analyze')
| -rw-r--r-- | llvm/tools/analyze/analyze.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/tools/analyze/analyze.cpp b/llvm/tools/analyze/analyze.cpp index 3bc2ee9e22e..112bfcc04b4 100644 --- a/llvm/tools/analyze/analyze.cpp +++ b/llvm/tools/analyze/analyze.cpp @@ -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; } |

