[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 21 11:37:02 PST 2003


Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.70 -> 1.71

---
Log message:

Fix some problems with assertions printing


---
Diffs of the changes:  (+19 -7)

Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.70 llvm/lib/VMCore/Verifier.cpp:1.71
--- llvm/lib/VMCore/Verifier.cpp:1.70	Fri Nov 21 11:06:29 2003
+++ llvm/lib/VMCore/Verifier.cpp	Fri Nov 21 11:35:51 2003
@@ -155,18 +155,30 @@
     void visitUserOp2(Instruction &I) { visitUserOp1(I); }
     void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI);
 
+
+    void WriteValue(const Value *V) {
+      if (!V) return;
+      if (isa<Instruction>(V))
+        std::cerr << *V;
+      else {
+        WriteAsOperand (std::cerr, V, true, true, Mod);
+        std::cerr << "\n";
+      }
+    }
+
+
     // CheckFailed - A check failed, so print out the condition and the message
     // that failed.  This provides a nice place to put a breakpoint if you want
     // to see why something is not correct.
     //
-    inline void CheckFailed(const std::string &Message,
-                            const Value *V1 = 0, const Value *V2 = 0,
-                            const Value *V3 = 0, const Value *V4 = 0) {
+    void CheckFailed(const std::string &Message,
+                     const Value *V1 = 0, const Value *V2 = 0,
+                     const Value *V3 = 0, const Value *V4 = 0) {
       std::cerr << Message << "\n";
-      if (V1) { WriteAsOperand (std::cerr, V1, true, true, Mod); std::cerr << "\n"; }
-      if (V2) { WriteAsOperand (std::cerr, V2, true, true, Mod); std::cerr << "\n"; }
-      if (V3) { WriteAsOperand (std::cerr, V3, true, true, Mod); std::cerr << "\n"; }
-      if (V4) { WriteAsOperand (std::cerr, V4, true, true, Mod); std::cerr << "\n"; }
+      WriteValue(V1);
+      WriteValue(V2);
+      WriteValue(V3);
+      WriteValue(V4);
       Broken = true;
     }
   };





More information about the llvm-commits mailing list