r200381 - Fix crash on unmatched #endif's.

Alp Toker alp at nuanti.com
Wed Jan 29 09:38:39 PST 2014


On 29/01/2014 17:23, David Blaikie wrote:
>
>
>
> On Wed, Jan 29, 2014 at 9:13 AM, Alp Toker <alp at nuanti.com 
> <mailto: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>
>         <mailto: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)

It's great that you're looking. If only more people made the effort

Alp.


-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list