kcc did :-). On Mon, Jan 19, 2015 at 7:16 PM, Nico Weber <[email protected]> wrote:
> Nice! Did you run a fuzzer to find all these? > > On Mon, Jan 19, 2015 at 3:49 AM, Daniel Jasper <[email protected]> wrote: > >> Author: djasper >> Date: Mon Jan 19 05:49:32 2015 >> New Revision: 226454 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=226454&view=rev >> Log: >> clang-format: Fix crasher on weird comments. >> >> Crashing input: >> /\ >> / comment >> >> Modified: >> cfe/trunk/lib/Format/TokenAnnotator.cpp >> cfe/trunk/unittests/Format/FormatTest.cpp >> >> Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=226454&r1=226453&r2=226454&view=diff >> >> ============================================================================== >> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) >> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Jan 19 05:49:32 2015 >> @@ -838,10 +838,8 @@ private: >> (!Current.Previous || >> Current.Previous->isNot(tok::l_square))) { >> Current.Type = TT_BinaryOperator; >> } else if (Current.is(tok::comment)) { >> - if (Current.TokenText.startswith("//")) >> - Current.Type = TT_LineComment; >> - else >> - Current.Type = TT_BlockComment; >> + Current.Type = >> + Current.TokenText.startswith("/*") ? TT_BlockComment : >> TT_LineComment; >> } else if (Current.is(tok::r_paren)) { >> if (rParenEndsCast(Current)) >> Current.Type = TT_CastRParen; >> >> Modified: cfe/trunk/unittests/Format/FormatTest.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=226454&r1=226453&r2=226454&view=diff >> >> ============================================================================== >> --- cfe/trunk/unittests/Format/FormatTest.cpp (original) >> +++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Jan 19 05:49:32 2015 >> @@ -1035,6 +1035,9 @@ TEST_F(FormatTest, UnderstandsSingleLine >> " // spanning two lines\n" >> " x + 3) {\n" >> "}")); >> + >> + verifyNoCrash("/\\\n/"); >> + verifyNoCrash("/\\\n* */"); >> } >> >> TEST_F(FormatTest, KeepsParameterWithTrailingCommentsOnTheirOwnLine) { >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
