[PATCH] D11693: clang-format: Support generalized lambda captures.

strager via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 17:16:46 PDT 2015


strager marked 4 inline comments as done.

================
Comment at: lib/Format/UnwrappedLineParser.cpp:1057-1058
@@ +1056,4 @@
+      while (!eof()) {
+        // FIXME: Once we have an expression parser in the UnwrappedLineParser,
+        // replace this by using parseAssigmentExpression() inside.
+        if (FormatTok->is(tok::l_paren)) {
----------------
strager wrote:
> djasper wrote:
> > I very much doubt that we'll have an Expression parser here anytime soon. So, I don't think that this FIXME makes much sense. Instead, please provide a comment on what this is actually doing and in which cases it might fail.
> I copied the comment from elsewhere in the file.
I expanded the comment, including a reference to the other reference to `parseAssigmentExpression`.

================
Comment at: lib/Format/UnwrappedLineParser.cpp:1061
@@ +1060,3 @@
+          parseParens();
+        } else if (FormatTok->isOneOf(tok::comma, tok::r_square)) {
+          break;
----------------
strager wrote:
> djasper wrote:
> > I think this list should be extended to figure out certain cases where we know something is fishy. In particular:
> > * If you find an l_square or less, call into parseSquare and parseAngle respectively.
> > * If you find an r_brace or semi, something is wrong, break.
> > 
> Will do.
Handling r_brace and semi is a bit weird, since we end up aborting mid-stream and what's left becomes unparsable/incomplete by clang-format.

parseAngle doesn't exist, and even if it did, the less-than operator wouldn't be handled properly.

I added l_square and l_brace support.


http://reviews.llvm.org/D11693





More information about the cfe-commits mailing list