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

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 19 14:14:12 PDT 2021


xbolva00 added a comment.

In D108003#2955009 <https://reviews.llvm.org/D108003#2955009>, @aeubanks 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
>
> The remaining places where this fired looked like places where `&&` would be better than `&`, except for one where the code was treating bools as one bit integers and doing various bitwise operations on them
> https://source.chromium.org/chromium/chromium/src/+/main:third_party/distributed_point_functions/src/dpf/distributed_point_function.cc;drc=87b84b3834343e141ec94e3321f4d1c7be8a7a9d;l=230



In D108003#2955009 <https://reviews.llvm.org/D108003#2955009>, @aeubanks 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
>
> The remaining places where this fired looked like places where `&&` would be better than `&`, except for one where the code was treating bools as one bit integers and doing various bitwise operations on them
> https://source.chromium.org/chromium/chromium/src/+/main:third_party/distributed_point_functions/src/dpf/distributed_point_function.cc;drc=87b84b3834343e141ec94e3321f4d1c7be8a7a9d;l=230

New revision should be more conversative to avoid warning on cases you mentioned.


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

https://reviews.llvm.org/D108003



More information about the cfe-commits mailing list