[PATCH] D18793: fix for 19986, extra spacing around c++14 lambda capture with initializer

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 10:06:35 PDT 2016

djasper added a comment.

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

Comment at: lib/Format/UnwrappedLineParser.cpp:1086
@@ +1085,3 @@
+      int parens = 0;
+      while (!eof()) {
+        if (FormatTok->isOneOf(tok::l_paren, tok::l_square)) {
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?

Comment at: lib/Format/UnwrappedLineParser.cpp:1094
@@ +1093,3 @@
+        } else if (!FormatTok->isOneOf(tok::identifier, tok::coloncolon)) {
+          return false;
+        }
This seems wrong. Even in the case of the bug you say you are fixing, the "23" is neither an identifier nor a coloncolon..


More information about the cfe-commits mailing list