[PATCH] D108003: [Clang] Extend -Wbool-operation to warn about bitwise and of bools with side effects

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 16 11:39:13 PDT 2021


aeubanks added a comment.

In D108003#2944714 <https://reviews.llvm.org/D108003#2944714>, @xbolva00 wrote:

> In D108003#2944178 <https://reviews.llvm.org/D108003#2944178>, @aeubanks wrote:
>
>> I ran this over Chrome and ran into a use case that looks legitimate. It seems like the pattern in LLVM where we want to run a bunch of transformations and get if any of them changed anything.
>>
>> https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/api/audio/echo_canceller3_config.cc;drc=cbdbb8c1666fd08a094422905e73391706a05b03;l=111
>
> Maybe “res &= foo ();” would be better? “Changed |= foo();” is very typical for LLVM.

Can we either emit that as a suggestion if the code looks like `a = a & foo()`? Or simply not emit a warning?


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

https://reviews.llvm.org/D108003



More information about the cfe-commits mailing list