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

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 5 02:37:14 PDT 2018


djasper accepted this revision.
djasper 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:
> 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.
You might also want to add a

  // FIXME: ...


Repository:
  rC Clang

https://reviews.llvm.org/D44996





More information about the cfe-commits mailing list