[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Jul 6 11:02:41 PDT 2006



Changes in directory llvm/lib/Bytecode/Reader:

Analyzer.cpp updated: 1.21 -> 1.22
---
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:  (+15 -25)

 Analyzer.cpp |   40 +++++++++++++++-------------------------
 1 files changed, 15 insertions(+), 25 deletions(-)


Index: llvm/lib/Bytecode/Reader/Analyzer.cpp
diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.21 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.22
--- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.21	Mon Dec 26 08:23:22 2005
+++ llvm/lib/Bytecode/Reader/Analyzer.cpp	Thu Jul  6 13:02:27 2006
@@ -117,12 +117,10 @@
     bca.functionDensity = double(bca.BlockSizes[BytecodeFormat::FunctionBlockID]) /
       double(bca.numFunctions);
 
-    if ( bca.progressiveVerify ) {
-      try {
-        verifyModule(*M, ThrowExceptionAction);
-      } catch ( std::string& msg ) {
+    if (bca.progressiveVerify) {
+      std::string msg;
+      if (verifyModule(*M, ReturnStatusAction, &msg))
         bca.VerifyInfo += "Verify at Finish: " + msg + "\n";
-      }
     }
   }
 
@@ -135,12 +133,10 @@
   virtual void handleModuleEnd(const std::string& id) {
     if (os)
       *os << "  } End Module " << id << "\n";
-    if ( bca.progressiveVerify ) {
-      try {
-        verifyModule(*M, ThrowExceptionAction);
-      } catch ( std::string& msg ) {
+    if (bca.progressiveVerify) {
+      std::string msg;
+      if (verifyModule(*M, ReturnStatusAction, &msg))
         bca.VerifyInfo += "Verify at EndModule: " + msg + "\n";
-      }
     }
   }
 
@@ -232,12 +228,10 @@
   virtual void handleModuleGlobalsEnd() {
     if (os)
       *os << "    } END BLOCK: ModuleGlobalInfo\n";
-    if ( bca.progressiveVerify ) {
-      try {
-        verifyModule(*M, ThrowExceptionAction);
-      } catch ( std::string& msg ) {
+    if (bca.progressiveVerify) {
+      std::string msg;
+      if (verifyModule(*M, ReturnStatusAction, &msg))
         bca.VerifyInfo += "Verify at EndModuleGlobalInfo: " + msg + "\n";
-      }
     }
   }
 
@@ -346,12 +340,10 @@
     currFunc->density = double(currFunc->byteSize) /
       double(currFunc->numInstructions);
 
-    if ( bca.progressiveVerify ) {
-      try {
-        verifyModule(*M, ThrowExceptionAction);
-      } catch ( std::string& msg ) {
+    if (bca.progressiveVerify) {
+      std::string msg;
+      if (verifyModule(*M, ReturnStatusAction, &msg))
         bca.VerifyInfo += "Verify at EndFunction: " + msg + "\n";
-      }
     }
   }
 
@@ -522,12 +514,10 @@
     if (os)
       *os << "    } END BLOCK: GlobalConstants\n";
 
-    if ( bca.progressiveVerify ) {
-      try {
-        verifyModule(*M, ThrowExceptionAction);
-      } catch ( std::string& msg ) {
+    if (bca.progressiveVerify) {
+      std::string msg;
+      if (verifyModule(*M, ReturnStatusAction, &msg))
         bca.VerifyInfo += "Verify at EndGlobalConstants: " + msg + "\n";
-      }
     }
   }
 






More information about the llvm-commits mailing list