[PATCH] D91495: [clang-tidy] false-positive for bugprone-redundant-branch-condition in case of passed-by-ref params

Zinovy Nis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 11:58:46 PST 2020


zinovy.nis added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-redundant-branch-condition.cpp:968
+  }
+}
+
----------------
aaron.ballman wrote:
> Another test that would be interesting is:
> ```
> if (tryToExtinguish(isSet) && isSet) {
>   if (tryToExtinguishByVal(isSet) && isSet) { // Dupe check of isSet should be diagnosed
>     scream();
>   }
> }
> 
> if (tryToExtinguishByVal(isSet) && isSet) {
>   if (tryToExtinguish(isSet) && isSet) { // Ok
>     scream();
>   }
> }
> ```
Nice catch! Thanks. Looks like isChangedBefore is too rough and must be refined



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91495



More information about the cfe-commits mailing list