[PATCH] D122111: [clang-tidy] Fix false positives in `misc-redundant-expression` check
    Aaron Ballman via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Mar 21 09:25:31 PDT 2022
    
    
  
aaron.ballman added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp:605
+          unless(isMacro()), unless(isInTemplateInstantiation()),
+          hasRHS(ignoringParenImpCasts(integerLiteral().bind(ConstId))))
           .bind(OverloadId);
----------------
This seems incorrect to me -- the LHS and RHS can be swapped along with which operator is used and still achieve the same semantic results.
While playing around to test the behavior we currently have, I was a bit surprised at the difference in results here: https://godbolt.org/z/hE4qfca1b.
Also, do we need to bind? Nothing seems to look at that binding that I can see.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122111/new/
https://reviews.llvm.org/D122111
    
    
More information about the cfe-commits
mailing list