[PATCH] D152443: Add operator style options to clang-format

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 04:16:25 PDT 2023


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4203
       return true;
-
-    if (Left.is(tok::kw_operator))
-      return Right.is(tok::coloncolon);
+    // Operator overloads, calls and address-of expressions
+    if (Left.is(tok::kw_operator)) {
----------------



================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4211
+        }
+        Token = Token->Previous; // Skip one more token and check if it exists
+        if (!Token)
----------------
Token could be null here already.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4213
+        if (!Token)
+          return Right.is(tok::coloncolon);
+        // This handles all overload cases; type/type*/type&/type&&/type<>
----------------
This would be `operator::`, or not?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152443



More information about the cfe-commits mailing list