[PATCH] D141959: [clang-format] Fix inconsistent identification of operator&

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 12:09:36 PST 2023


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:851
       if (CurrentToken->is(tok::r_brace)) {
+        // Handle unbalanced braces
+        if (Scopes.size() > 1)
----------------
See below


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:852
+        // Handle unbalanced braces
+        if (Scopes.size() > 1)
+          Scopes.pop_back();
----------------
Is this check also necessary? Here we should only be when we have pushed before.
I'd change the if for an assert.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1204
     case tok::r_brace:
+      // Handle unbalanced braces
+      if (Scopes.size() > 1)
----------------
Move the comment in the if? In general it hasn't to be a unbalanced brace, right?


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

https://reviews.llvm.org/D141959



More information about the cfe-commits mailing list