Recover the ability to 'b CheckFailed' after r231577

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.

llvm-svn: 232268
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-14 16:47:37 +00:00
parent dfb9790a3d
commit ec9d3f779a
2 changed files with 29 additions and 13 deletions

View File

@ -141,13 +141,20 @@ namespace {
} }
} }
// CheckFailed - A check failed, so print out the condition and the message // \brief A check failed, so printout 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. // This provides a nice place to put a breakpoint if you want to see why
template <typename... Ts> // something is not correct.
void CheckFailed(const Twine &Message, const Ts &...Vs) { void CheckFailed(const Twine &Message) { MessagesStr << Message << '\n'; }
MessagesStr << Message << '\n';
WriteValues({Vs...}); // \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...});
} }
}; };
} }

View File

@ -131,15 +131,24 @@ private:
template <typename... Ts> void WriteTs() {} template <typename... Ts> void WriteTs() {}
public: public:
// CheckFailed - A check failed, so print out the condition and the message // \brief A check failed, so printout 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. // This provides a nice place to put a breakpoint if you want to see why
template <typename... Ts> // something is not correct.
void CheckFailed(const Twine &Message, const Ts &... Vs) { void CheckFailed(const Twine &Message) {
OS << Message << '\n'; OS << Message << '\n';
WriteTs(Vs...);
Broken = true; 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 { class Verifier : public InstVisitor<Verifier>, VerifierSupport {