r200381 - Fix crash on unmatched #endif's.

David Blaikie dblaikie at gmail.com
Wed Jan 29 09:23:40 PST 2014


On Wed, Jan 29, 2014 at 9:13 AM, Alp Toker <alp at nuanti.com> wrote:

>
> On 29/01/2014 16:47, David Blaikie wrote:
>
>>
>>
>>
>> On Wed, Jan 29, 2014 at 12:49 AM, Manuel Klimek <klimek at google.com<mailto:
>> klimek at google.com>> wrote:
>>
>>     Author: klimek
>>     Date: Wed Jan 29 02:49:02 2014
>>     New Revision: 200381
>>
>>     URL: http://llvm.org/viewvc/llvm-project?rev=200381&view=rev
>>     Log:
>>     Fix crash on unmatched #endif's.
>>
>>     The following snippet would crash:
>>       #endif
>>       #if A
>>
>>
>> Any reason this wasn't contributed as a test case?
>>
>>
>>     ============================================================
>> ==================
>>     --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
>>     +++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jan 29 02:49:02
>> 2014
>>     @@ -2427,6 +2427,11 @@ TEST_F(FormatTest, LayoutStatementsAroun
>>                     "#endif");
>>      }
>>
>>     +TEST_F(FormatTest, GraciouslyHandleIncorrectPreprocessorConditions)
>> {
>>     +  verifyFormat("#endif\n"
>>     +               "#if B");
>>     +}
>>     +
>>
>>
> Like this?


Yep, exactly that. Clearly too early in the morning - thanks guys.

(if I had to guess I'd say it was a combination of "oh, someone mentioned a
test case in the commit message, this is often associated with that test
case not actually being committed" and my not noticing a unittest change in
my simple brain-fuzzy-matcher that searches for the more common lit tests)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140129/de37fe42/attachment.html>


More information about the cfe-commits mailing list