From: Daniel Jasper Date: Wed, 27 May 2015 04:55:47 +0000 (+0000) Subject: clang-format: Fix false positive in function annotation detection. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b3ecccc19a25eab45f5354112aa0e22f06036b7;p=clang clang-format: Fix false positive in function annotation detection. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238285 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 8229471071..98f5709b90 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -925,7 +925,7 @@ private: Current.Type = TT_CastRParen; if (Current.MatchingParen && Current.Next && !Current.Next->isBinaryOperator() && - !Current.Next->isOneOf(tok::semi, tok::colon)) + !Current.Next->isOneOf(tok::semi, tok::colon, tok::l_brace)) if (FormatToken *BeforeParen = Current.MatchingParen->Previous) if (BeforeParen->is(tok::identifier) && BeforeParen->TokenText == BeforeParen->TokenText.upper() && diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index ca50be98fe..1c100c3b9b 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -4064,6 +4064,8 @@ TEST_F(FormatTest, FunctionAnnotations) { // Not function annotations. verifyFormat("ASSERT(\"aaaaa\") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" " << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); + verifyFormat("TEST_F(ThisIsATestFixtureeeeeeeeeeeee,\n" + " ThisIsATestWithAReallyReallyReallyReallyLongName) {}"); } TEST_F(FormatTest, BreaksDesireably) {