[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jul 6 11:01:36 PDT 2006
Changes in directory llvm/lib/VMCore:
Verifier.cpp updated: 1.157 -> 1.158
---
Log message:
Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway.
---
Diffs of the changes: (+7 -8)
Verifier.cpp | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.157 llvm/lib/VMCore/Verifier.cpp:1.158
--- llvm/lib/VMCore/Verifier.cpp:1.157 Wed Jun 28 16:38:54 2006
+++ llvm/lib/VMCore/Verifier.cpp Thu Jul 6 13:01:23 2006
@@ -152,18 +152,13 @@
/// this condition, do so.
///
void abortIfBroken() {
- if (Broken)
- {
+ if (Broken) {
msgs << "Broken module found, ";
- switch (action)
- {
+ switch (action) {
case AbortProcessAction:
msgs << "compilation aborted!\n";
std::cerr << msgs.str();
abort();
- case ThrowExceptionAction:
- msgs << "verification terminated.\n";
- throw msgs.str();
case PrintMessageAction:
msgs << "verification continues.\n";
std::cerr << msgs.str();
@@ -799,11 +794,15 @@
/// verifyModule - Check a module for errors, printing messages on stderr.
/// Return true if the module is corrupt.
///
-bool llvm::verifyModule(const Module &M, VerifierFailureAction action) {
+bool llvm::verifyModule(const Module &M, VerifierFailureAction action,
+ std::string *ErrorInfo) {
PassManager PM;
Verifier *V = new Verifier(action);
PM.add(V);
PM.run((Module&)M);
+
+ if (ErrorInfo && V->Broken)
+ *ErrorInfo = V->msgs.str();
return V->Broken;
}
More information about the llvm-commits
mailing list