Recover the ability to 'b CheckFailed' after r231577
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 14 Mar 2015 16:47:37 +0000 (16:47 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 14 Mar 2015 16:47:37 +0000 (16:47 +0000)
Given that the stated purpose of `CheckFailed()` is to provide a nice
spot for a breakpoint, it'd be nice not to have to use a regex to break
on it.  Recover the ability to simply use `b CheckFailed` by
specializing the message-only version, and by changing the variadic
version to call into the message-only version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232268 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/Lint.cpp
lib/IR/Verifier.cpp

index 887688737b0b26fbdeab872319ee3d872bb366d1..9260eb2c007e2761710c2691194408244e3fa335 100644 (file)
@@ -141,13 +141,20 @@ namespace {
       }
     }
 
-    // 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.
-    template <typename... Ts>
-    void CheckFailed(const Twine &Message, const Ts &...Vs) {
-      MessagesStr << Message << '\n';
-      WriteValues({Vs...});
+    // \brief A check failed, so printout out the condition and the message.
+    //
+    // This provides a nice place to put a breakpoint if you want to see why
+    // something is not correct.
+    void CheckFailed(const Twine &Message) { MessagesStr << Message << '\n'; }
+
+    // \brief A check failed (with values to print).
+    //
+    // This calls the Message-only version so that the above is easier to set a
+    // breakpoint on.
+    template <typename T1, typename... Ts>
+    void CheckFailed(const Twine &Message, const T1 &V1, const Ts &...Vs) {
+      CheckFailed(Message);
+      WriteValues({V1, Vs...});
     }
   };
 }
index 9e77c32ee4b76af225ae695469a18f70a8c7d45e..85251551f997f4aa46a03ca60214c941463e289e 100644 (file)
@@ -131,15 +131,24 @@ private:
   template <typename... Ts> void WriteTs() {}
 
 public:
-  // 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.
-  template <typename... Ts>
-  void CheckFailed(const Twine &Message, const Ts &... Vs) {
+  // \brief A check failed, so printout out the condition and the message.
+  //
+  // This provides a nice place to put a breakpoint if you want to see why
+  // something is not correct.
+  void CheckFailed(const Twine &Message) {
     OS << Message << '\n';
-    WriteTs(Vs...);
     Broken = true;
   }
+
+  // \brief A check failed (with values to print).
+  //
+  // This calls the Message-only version so that the above is easier to set a
+  // breakpoint on.
+  template <typename T1, typename... Ts>
+  void CheckFailed(const Twine &Message, const T1 &V1, const Ts &... Vs) {
+    CheckFailed(Message);
+    WriteTs(V1, Vs...);
+  }
 };
 
 class Verifier : public InstVisitor<Verifier>, VerifierSupport {