[PATCH] D64632: [clang-format] Don't detect call to ObjC class method as C++11 attribute specifier

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 08:20:07 PDT 2019


benhamilton added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:400-413
     while (AttrTok && !AttrTok->startsSequence(tok::r_square, tok::r_square)) {
       // ObjC message send. We assume nobody will use : in a C++11 attribute
       // specifier parameter, although this is technically valid:
-      // [[foo(:)]]
+      // [[foo(:)]]. 'class' is a common ObjC method selector, so allow it as
+      // well.
       if (AttrTok->is(tok::colon) ||
           AttrTok->startsSequence(tok::identifier, tok::identifier) ||
----------------
Maybe we should check the token before AttrTok to see if it's `tok::at`, rather than checking for an identifier followed by `tok::kw_class`?

I don't think there's any valid C++11 attribute specifier sequence of `@[[]]`.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64632/new/

https://reviews.llvm.org/D64632





More information about the cfe-commits mailing list