aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-06 18:02:27 +0000
committerChris Lattner <sabre@nondot.org>2006-07-06 18:02:27 +0000
commit05ac92ca7d448ff9270cdeecd182653477708517 (patch)
tree98ab4d6907cc940ec14f4510ecde36ffd6e43887 /tools
parent1d662a6afcbf8afb809e7f40093d2e9e0a888fdc (diff)
Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29017 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-as/llvm-as.cpp16
-rw-r--r--tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp15
-rw-r--r--tools/llvm2cpp/llvm2cpp.cpp18
3 files changed, 19 insertions, 30 deletions
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index 1dbcd1d1b8..9547ad13e2 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -63,14 +63,14 @@ int main(int argc, char **argv) {
return 1;
}
- try {
- if (!DisableVerify)
- verifyModule(*M.get(), ThrowExceptionAction);
- } catch (const std::string &Err) {
- std::cerr << argv[0]
- << ": assembly parsed, but does not verify as correct!\n";
- std::cerr << Err;
- return 1;
+ if (!DisableVerify) {
+ std::string Err;
+ if (verifyModule(*M.get(), ReturnStatusAction, &Err)) {
+ std::cerr << argv[0]
+ << ": assembly parsed, but does not verify as correct!\n";
+ std::cerr << Err;
+ return 1;
+ }
}
if (DumpAsm) std::cerr << "Here's the assembly:\n" << *M.get();
diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
index 39131cfb3c..2ac78344c6 100644
--- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -73,23 +73,10 @@ main(int argc, char **argv) {
if ( M && Verify ) {
std::string verificationMsg;
- try {
- verifyModule( *M, ThrowExceptionAction );
- } catch (std::string& errmsg ) {
- verificationMsg = errmsg;
- }
- if ( verificationMsg.length() > 0 )
+ if (verifyModule(*M, ReturnStatusAction, &verificationMsg))
std::cerr << "Final Verification Message: " << verificationMsg << "\n";
}
-
- // If there was an error, print it and stop.
- if ( ErrorMessage.size() ) {
- std::cerr << argv[0] << ": " << ErrorMessage << "\n";
- return 1;
- }
-
-
if (Out != &std::cout) {
((std::ofstream*)Out)->close();
delete Out;
diff --git a/tools/llvm2cpp/llvm2cpp.cpp b/tools/llvm2cpp/llvm2cpp.cpp
index 9035e71c07..7e322dbef8 100644
--- a/tools/llvm2cpp/llvm2cpp.cpp
+++ b/tools/llvm2cpp/llvm2cpp.cpp
@@ -59,14 +59,16 @@ int main(int argc, char **argv) {
return 1;
}
- try {
- if (!DisableVerify)
- verifyModule(*M.get(), ThrowExceptionAction);
- } catch (const std::string &Err) {
- std::cerr << argv[0]
- << ": assembly parsed, but does not verify as correct!\n";
- std::cerr << Err;
- return 1;
+ // FIXME: llvm2cpp should read .bc files and thus not run the verifier
+ // explicitly!
+ if (!DisableVerify) {
+ std::string Err;
+ if (verifyModule(*M.get(), ReturnStatusAction, &Err)) {
+ std::cerr << argv[0]
+ << ": assembly parsed, but does not verify as correct!\n";
+ std::cerr << Err;
+ return 1;
+ }
}
if (OutputFilename != "") { // Specified an output filename?