[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 7 04:48:07 PST 2018


djasper added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:152
+      const FormatToken *Next = CurrentToken->getNextNonComment();
+      int ParenDepth = 1;
+      // Handle nested parens in case we have an array of blocks with
----------------
No. Don't implement yet another parenthesis counting. This function already iterates over all tokens until the closing paren. Just store a pointer to the caret here and mark it (or unmark it) when encountering the closing brace (line 271). There is already very similar logic there to set TT_FunctionTypeLParen (which is actually doing the exact same parsing now that I think of it).


Repository:
  rC Clang

https://reviews.llvm.org/D43906





More information about the cfe-commits mailing list