[PATCH] D72911: clang-format: fix spacing in `operator const char*()`

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 17 04:01:04 PST 2020


mprobst accepted this revision.
mprobst added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2717
+    //   operator Foo*()
+    // dependant on PointerAlignment style.
+
----------------
typo dependent


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2722
+    FormatToken *Before = Left.getPreviousNonComment();
+    while (Before && Before->isOneOf(tok::kw_const, tok::kw_volatile)) {
+      Before = Before->getPreviousNonComment();
----------------
how many const and volatile may be there, and is their order fixed?

We also have the `endsSequence` helper on FormatToken that might express the concept better (`Left.endsSequence(tok::kw_const, tok::kw_volatile) || ...`). YMMV, with the tokens being optional that might lead to too many alternates to check for.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72911





More information about the cfe-commits mailing list