Page MenuHomePhabricator

fix for 19986, extra spacing around c++14 lambda capture with initializer
Changes PlannedPublic

Authored by arnetheduck on Apr 5 2016, 7:46 AM.



Here's a little one-off patch that fixes for me, by allowing a few
more things inside [] when trying to match a lambda capture section.

I hope someone can help it find its way into the main repo.

Diff Detail

Event Timeline

arnetheduck updated this revision to Diff 52691.Apr 5 2016, 7:46 AM
arnetheduck retitled this revision from to fix for 19986, extra spacing around c++14 lambda capture with initializer.
arnetheduck updated this object.
arnetheduck added a reviewer: djasper.
arnetheduck added a subscriber: cfe-commits.
meadori added a subscriber: meadori.Apr 5 2016, 8:40 AM

This needs a test case.

djasper edited edge metadata.Apr 5 2016, 10:06 AM

Please add tests in unittests/Format/FormatTest.cpp.


We need to be much more error resilient here as people will frequently call clang-format with mismatched parentheses and such. I am actually quite skeptical about having yet another instance of parentheses counting. Maybe just call parseParens() instead?


This seems wrong. Even in the case of the bug you say you are fixing, the "23" is neither an identifier nor a coloncolon..

arnetheduck planned changes to this revision.Apr 7 2016, 5:00 AM

Thanks for the comments - I'll see when I have time to get back to this as the current patch happens to take care of my (rather limited) use case..


makes sense.


Ah, right... I've run it against our code base at work where it happened to be enough.. , but since full expressions can be used nowadays, I guess it's a lot more than just these to that *can* appear.