[PATCH] D68332: [clang-format] [PR43531] clang-format damages "alternative representations" for operators

Mitchell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 12:36:43 PDT 2019


mitchell-stellar requested changes to this revision.
mitchell-stellar added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2892
+  if (Left.is(TT_UnaryOperator)) {
+    // Don't combine the unary operators !~ into "compl5" and "not5"
+    // when using alternative operators "compl" and "not"
----------------
Without context, "compl5" and "not5" do not make sense. Can you try to rephrase this comment?


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2896
+    if (!Right.is(tok::l_paren)) {
+      if (Left.is(tok::exclaim) && Left.TokenText.equals("not"))
+        return true;
----------------
For consistency, `Left.TokenText == "not"` may be better. I cannot find another instance of `.equals()`.


================
Comment at: clang/unittests/Format/FormatTest.cpp:14445
+TEST_F(FormatTest, AlternativeOperators) {
+  // Test case for bug https://bugs.llvm.org/show_bug.cgi?id=43531
+  verifyFormat("int a and b;");
----------------
Instead of using a URL link, perhaps describe in words what this test is supposed to do?


Repository:
  rC Clang

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

https://reviews.llvm.org/D68332





More information about the cfe-commits mailing list