[PATCH] D127873: [clang-format] Fix misplacement of `*` in declaration of pointer to struct

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 19:29:04 PDT 2022


owenpan accepted this revision.
owenpan added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2319-2320
+      //   enable_if<>{} && ...
+      if (MatchingLBrace && MatchingLBrace->getPreviousNonComment() &&
+          MatchingLBrace->getPreviousNonComment()->is(TT_TemplateCloser))
+        return TT_BinaryOperator;
----------------
Can we have a variable for `MatchingLBrace->getPreviousNonComment()` so that the function doesn't get called twice?


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2324
+      //   struct {} &&ref = {};
+      else
+        return TT_PointerOrReference;
----------------
Nit: Don’t use `else` after a `return`.


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

https://reviews.llvm.org/D127873



More information about the cfe-commits mailing list