[PATCH] D42493: [clang-format] Fix ObjC message arguments formatting.

Jacek Olesiak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 02:03:33 PST 2018


jolesiak added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:419
           StartsObjCMethodExpr = true;
+          Left->ParameterCount = 0;
           Contexts.back().ColonIsObjCMethodExpr = true;
----------------
benhamilton wrote:
> What does this line do? Seems like it's initialized to 0 already, right?
It is indeed initialized to 0.
However, before 'Left' bracket is recognized as TT_ObjCMethodExpr it has a different type assigned. Hence it gets updated here:
https://github.com/llvm-mirror/clang/blob/release_60/lib/Format/TokenAnnotator.cpp#L495
This assignment is due to fact that for other languages number of parameters is calculated as (1 + number_of_commas).


Repository:
  rC Clang

https://reviews.llvm.org/D42493





More information about the cfe-commits mailing list