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

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 09:06:59 PST 2018


benhamilton added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:419
           StartsObjCMethodExpr = true;
+          Left->ParameterCount = 0;
           Contexts.back().ColonIsObjCMethodExpr = true;
----------------
jolesiak wrote:
> 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).
I see. Could you add a comment explaining that?


Repository:
  rC Clang

https://reviews.llvm.org/D42493





More information about the cfe-commits mailing list