[PATCH] D146434: [clang-format] Fix support for ObjC blocks with pointer return types

Jared Grubb via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 10:34:07 PDT 2023


jaredgrubb marked 2 inline comments as done.
jaredgrubb added inline comments.
Herald added a subscriber: wangpc.
Herald added a reviewer: rymiel.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1779-1782
         nextToken();
+        // Return types: pointers are ok too.
+        while (FormatTok->is(tok::star))
+          nextToken();
----------------
owenpan wrote:
> 
I think this obscures the logic a bit. The first one is to consume one token (the return type) and the next is to consume a different kind of token (trailing stars). Putting them in a while loop makes it harder to reason about why it's looping in that way.


================
Comment at: clang/unittests/Format/FormatTestObjC.cpp:1007-1010
+  Style = getWebKitStyle();
+  verifyFormat("int* p = ^int*() { //\n"
+               "    return nullptr;\n"
+               "}();");
----------------
owenpan wrote:
> 
Fixed!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146434



More information about the cfe-commits mailing list