[PATCH] D44996: [clang-format] Ensure ObjC selectors with 0 args are annotated correctly

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 09:39:53 PDT 2018


benhamilton marked 2 inline comments as done.
benhamilton added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:1347
+    } else if (Current.isOneOf(tok::identifier, tok::kw_new) &&
+               Current.Previous && Current.Previous->is(TT_CastRParen) &&
+               Current.Previous->MatchingParen &&
----------------
benhamilton wrote:
> djasper wrote:
> > Isn't it wrong that we detect this as a cast r_paren in the first place?
> Fantastic question, I asked myself the same thing.
> 
> I tried a few variations on this (leaving it as `TT_Unknown`, making a new type, etc.) and discovered there is at least one existing place which relies on the `TT_CastRParen` type as an indicator of ObjC code. Example:
> 
> https://github.com/llvm-mirror/clang/blob/e37a191e99773959118155304ec2ed0bc0d591c2/lib/Format/TokenAnnotator.cpp#L394
> 
> I can fix those, but if I do so, I think it should be a separate diff. What do you think?
@djasper and I talked about this on Friday and agreed we should follow up separately.

I filed https://bugs.llvm.org/show_bug.cgi?id=36976 to follow up.


Repository:
  rC Clang

https://reviews.llvm.org/D44996





More information about the cfe-commits mailing list