benhamilton 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
----------------
djasper wrote:
> 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).
Oh! Yes, re-using the logic for `TT_FunctionTypeLParen` is clearly the right 
thing to do, since it has exactly the same syntax (just `*` or `&` instead of 
`^`).

Done, code is much cleaner now.


Repository:
  rC Clang

https://reviews.llvm.org/D43906



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to