[llvm] r231577 - Make the assertion macros in Verifier and Linter truly variadic.
Benjamin Kramer
benny.kra at gmail.com
Sat Mar 14 03:34:06 PDT 2015
> On 14.03.2015, at 04:14, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>
>
>> On 2015 Mar 7, at 13:15, Benjamin Kramer <benny.kra at googlemail.com> wrote:
>>
>> Author: d0k
>> Date: Sat Mar 7 15:15:40 2015
>> New Revision: 231577
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=231577&view=rev
>> Log:
>> Make the assertion macros in Verifier and Linter truly variadic.
>>
>
> Nice cleanup!
>
>> NFC.
>
> Actually... (see below)
>
>>
>> Modified:
>> llvm/trunk/lib/Analysis/Lint.cpp
>> llvm/trunk/lib/IR/Verifier.cpp
>>
>> Modified: llvm/trunk/lib/Analysis/Lint.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Lint.cpp?rev=231577&r1=231576&r2=231577&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Analysis/Lint.cpp (original)
>> +++ llvm/trunk/lib/Analysis/Lint.cpp Sat Mar 7 15:15:40 2015
>> @@ -129,27 +129,26 @@ namespace {
>> }
>> void print(raw_ostream &O, const Module *M) const override {}
>>
>> - void WriteValue(const Value *V) {
>> - if (!V) return;
>> - if (isa<Instruction>(V)) {
>> - MessagesStr << *V << '\n';
>> - } else {
>> - V->printAsOperand(MessagesStr, true, Mod);
>> - MessagesStr << '\n';
>> + void WriteValues(ArrayRef<const Value *> Vs) {
>> + for (const Value *V : Vs) {
>> + if (!V)
>> + continue;
>> + if (isa<Instruction>(V)) {
>> + MessagesStr << *V << '\n';
>> + } else {
>> + V->printAsOperand(MessagesStr, true, Mod);
>> + MessagesStr << '\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.
>
> This is no longer true. I was playing with a similar patch myself
> while I was on holiday -- strange timing -- and I noticed that
> `b CheckFailed` no longer works (at least, not in `lldb`). The
> problem is that you need to specify `CheckFailed<...>` as the
> breakpoint target.
>
> My workaround was to add a `CheckFailedMsg()` function:
>
> void CheckFailedMsg(const Twine &Message) {
> MessagesStr << Message.str() << "\n";
> }
>
> and have `CheckFailed()` call it. Then `CheckFailedMsg()` serves
> as a nice target for a breakpoint.
>
> Any other ideas?
That would be one possibility. My usual hackaround for issues like this is to place a breakpoint on the first line in the templated function instead of using the name. LLDB also supports regex breakpoints, but I never tried that.
- Ben
More information about the llvm-commits
mailing list