r251284 - clang-format: Fix false positive in cast detection.
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 26 21:42:25 PDT 2015
On Mon, Oct 26, 2015 at 9:21 PM, Daniel Jasper <djasper at google.com> wrote:
> I mixed up before and after. Other than that, I don't see a typo.
>
It looks like the test case "+ verifyFormat("std::function< void(int, int)
> fct;", Spaces);" ensures no spaces between the parameters and the () in
the function type ("void(int, int)") but the commit message says "void(
int, int )" -> "void( int, int)", neither of which is what the test case
tests, right?
>
> On Mon, Oct 26, 2015 at 5:44 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>>
>>
>> On Mon, Oct 26, 2015 at 5:08 AM, Daniel Jasper via cfe-commits <
>> cfe-commits at lists.llvm.org> wrote:
>>
>>> Author: djasper
>>> Date: Mon Oct 26 07:08:47 2015
>>> New Revision: 251284
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=251284&view=rev
>>> Log:
>>> clang-format: Fix false positive in cast detection.
>>>
>>> Before (with spaces in parentheses):
>>> void inFunction() { std::function<void( int, int )> fct; }
>>>
>>> After:
>>> void inFunction() { std::function<void( int, int)> fct; }
>>>
>>
>> I take it the typo in ^ between the "(" and the "int" is just a typo in
>> the commit message, not reflected in the actual behavior? (judging by the
>> test that seems to be the case)
>>
>>
>>>
>>> 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=251284&r1=251283&r2=251284&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
>>> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Oct 26 07:08:47 2015
>>> @@ -1086,7 +1086,8 @@ private:
>>> Tok.Previous->isOneOf(TT_PointerOrReference, TT_TemplateCloser)
>>> ||
>>> Tok.Previous->isSimpleTypeSpecifier();
>>> bool ParensCouldEndDecl =
>>> - Tok.Next && Tok.Next->isOneOf(tok::equal, tok::semi,
>>> tok::l_brace);
>>> + Tok.Next &&
>>> + Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace,
>>> tok::greater);
>>> bool IsSizeOfOrAlignOf =
>>> LeftOfParens && LeftOfParens->isOneOf(tok::kw_sizeof,
>>> tok::kw_alignof);
>>> if (ParensAreType && !ParensCouldEndDecl && !IsSizeOfOrAlignOf &&
>>>
>>> Modified: cfe/trunk/unittests/Format/FormatTest.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=251284&r1=251283&r2=251284&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
>>> +++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Oct 26 07:08:47 2015
>>> @@ -8398,6 +8398,8 @@ TEST_F(FormatTest, ConfigurableSpacesInP
>>> verifyFormat("call( x, y, z );", Spaces);
>>> verifyFormat("call();", Spaces);
>>> verifyFormat("std::function<void( int, int )> callback;", Spaces);
>>> + verifyFormat("void inFunction() { std::function<void( int, int )>
>>> fct; }",
>>> + Spaces);
>>> verifyFormat("while ( (bool)1 )\n"
>>> " continue;",
>>> Spaces);
>>> @@ -10633,6 +10635,9 @@ TEST_F(FormatTest, SpacesInAngles) {
>>> verifyFormat("f< int, float >();", Spaces);
>>> verifyFormat("template <> g() {}", Spaces);
>>> verifyFormat("template < std::vector< int > > f() {}", Spaces);
>>> + verifyFormat("std::function< void(int, int) > fct;", Spaces);
>>> + verifyFormat("void inFunction() { std::function< void(int, int) >
>>> fct; }",
>>> + Spaces);
>>>
>>> Spaces.Standard = FormatStyle::LS_Cpp03;
>>> Spaces.SpacesInAngles = true;
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151026/574eff5f/attachment-0001.html>
More information about the cfe-commits
mailing list