[PATCH] D43906: [clang-format] Improve detection of Objective-C block types

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 8 16:01:05 PST 2018

djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Nice.. Removed a lot of complexity :). Let's see whether this heuristic is good enough.

Comment at: lib/Format/TokenAnnotator.cpp:210
-    bool MightBeFunctionType = !Contexts[Contexts.size() - 2].IsExpression;
-    bool ProbablyFunctionType = CurrentToken->isOneOf(tok::star, tok::amp);
+    bool MightBeFunctionOrObjCBlockType =
+        !Contexts[Contexts.size() - 2].IsExpression;
I'd suggest to put a comment here saying that this is for both ObjC blocks and Function types, because they look very similar in nature (maybe giving examples) and then not actually rename the variables. To me, the long names make the code harder to read.

But if you feel strongly the other way, I'd be ok with it.

  rC Clang


More information about the cfe-commits mailing list