[cfe-commits] r167360 - in /cfe/trunk: lib/Frontend/TextDiagnostic.cpp test/Misc/wrong-encoding2.c

Eli Friedman eli.friedman at gmail.com
Sat Nov 3 22:10:38 PDT 2012


Oh, okay; still, it better to check that the diagnostic is printed in
the way you expect.

-Eli

On Sat, Nov 3, 2012 at 4:54 PM, Seth Cantrell <seth.cantrell at gmail.com> wrote:
> In this case the crash is in the text diagnostics output of the source (while it's trying to truncate the line to fit in the requested message-length) and so -verify prevents it from occurring.
>
>
> On Nov 3, 2012, at 5:56 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>
>> On Sat, Nov 3, 2012 at 2:21 PM, Seth Cantrell <seth.cantrell at gmail.com> wrote:
>>> Author: socantre
>>> Date: Sat Nov  3 16:21:14 2012
>>> New Revision: 167360
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=167360&view=rev
>>> Log:
>>> fix bug in SourceColumnMap::startOfPreviousColumn
>>>
>>> Added:
>>>    cfe/trunk/test/Misc/wrong-encoding2.c
>>> Modified:
>>>    cfe/trunk/lib/Frontend/TextDiagnostic.cpp
>>>
>>> Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=167360&r1=167359&r2=167360&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
>>> +++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Sat Nov  3 16:21:14 2012
>>> @@ -298,7 +298,7 @@
>>>   /// \brief Map from a byte index to the previous byte which starts a column.
>>>   int startOfPreviousColumn(int N) const {
>>>     assert(0 < N && N < static_cast<int>(m_columnToByte.size()));
>>> -    while (byteToColumn(N--) == -1) {}
>>> +    while (byteToColumn(--N) == -1) {}
>>>     return N;
>>>   }
>>>
>>>
>>> Added: cfe/trunk/test/Misc/wrong-encoding2.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/wrong-encoding2.c?rev=167360&view=auto
>>> ==============================================================================
>>> --- cfe/trunk/test/Misc/wrong-encoding2.c (added)
>>> +++ cfe/trunk/test/Misc/wrong-encoding2.c Sat Nov  3 16:21:14 2012
>>> @@ -0,0 +1,8 @@
>>> +// RUN: %clang_cc1 -fsyntax-only -fmessage-length 100 %s 2>&1 | FileCheck -strict-whitespace %s
>>> +// REQUIRES: asserts
>>> +
>>> +int main() {
>>> +    "É#x#p )6Ò )ѽŠ$ûž>U êhÑüÃö|Ÿ থϻg ŸY|` ?ò;   ;Æ¿V jÇ\\ ù€‡ûݪW9úÐ ¢:ÌŠO EøÛ  y?SKªy¦¹‡Øài&n";
>>> +}
>>> +
>>> +// CHECK-NOT:Assertion
>>
>> If you want to check that an -fsyntax-only testcase doesn't crash,
>> it's more straightforward and robust to use -verify instead of
>> checking for the text of an assertion.
>>
>> -Eli
>




More information about the cfe-commits mailing list