This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

Reviewers
djasper
Summary

Here's a little one-off patch that fixes
https://llvm.org/bugs/show_bug.cgi?id=19986 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.

lib/Format/UnwrappedLineParser.cpp
1086

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?

1094

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..

lib/Format/UnwrappedLineParser.cpp
1086

makes sense.

1094

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.