[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 14:22:27 PDT 2023


owenpan planned changes to this revision.
owenpan added a comment.

Yep! After reformating `clang/lib/Format/` and rebuilding clang-format, I got the same warning:

  WhitespaceManager.cpp:233:45: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
        } else if (Change.StartOfBlockComment = LastBlockComment) {
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
  /Users/Owen/llvm-project/clang/lib/Format/WhitespaceManager.cpp:233:45: note: place parentheses around the assignment to silence this warning
        } else if (Change.StartOfBlockComment = LastBlockComment) {
                                              ^
                   (                                            )
  /Users/Owen/llvm-project/clang/lib/Format/WhitespaceManager.cpp:233:45: note: use '==' to turn this assignment into an equality comparison
        } else if (Change.StartOfBlockComment = LastBlockComment) {
                                              ^
                                              ==
  1 warning generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154484



More information about the cfe-commits mailing list