[PATCH] D56226: [clang-format] square parens that are followed by '=' are not Objective-C message sends

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 7 09:27:52 PST 2019


benhamilton added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:501
+                    CurrentToken->Next->is(tok::equal))) ||
+                  (CurrentToken->Previous->Previous == Left)) &&
                  Left->is(TT_ObjCMethodExpr)) {
----------------
I think you need to check if `CurrentToken->Previous` is null before dereferencing it.



================
Comment at: lib/Format/TokenAnnotator.cpp:504
+          // An ObjC method call is rarely followed by an open parenthesis or
+          // an assignment. It also usually contains more than one token.
           // FIXME: Do we incorrectly label ":" with this?
----------------
I think it's actually required to have more than one token. Can we reduce the change to that?


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

https://reviews.llvm.org/D56226





More information about the cfe-commits mailing list