[all-commits] [llvm/llvm-project] 8b0d14: New tautological warning for bitwise-or with non-z...
llvm-git-migration via All-commits
all-commits at lists.llvm.org
Fri Oct 18 17:56:08 PDT 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 8b0d14a8f0cc085afa2a9c86c237da81c74517fc
https://github.com/llvm/llvm-project/commit/8b0d14a8f0cc085afa2a9c86c237da81c74517fc
Author: Richard Trieu <rtrieu at google.com>
Date: 2019-10-19 (Sat, 19 Oct 2019)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Analysis/CFG.h
M clang/include/clang/Basic/DiagnosticGroups.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Analysis/CFG.cpp
M clang/lib/Sema/AnalysisBasedWarnings.cpp
M clang/test/Sema/warn-bitwise-compare.c
A clang/test/SemaCXX/warn-bitwise-compare.cpp
Log Message:
-----------
New tautological warning for bitwise-or with non-zero constant always true.
Taking a value and the bitwise-or it with a non-zero constant will always
result in a non-zero value. In a boolean context, this is always true.
if (x | 0x4) {} // always true, intended '&'
This patch creates a new warning group -Wtautological-bitwise-compare for this
warning. It also moves in the existing tautological bitwise comparisons into
this group. A few other changes were needed to the CFGBuilder so that all bool
contexts would be checked. The warnings in -Wtautological-bitwise-compare will
be off by default due to using the CFG.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=42666
Differential Revision: https://reviews.llvm.org/D66046
llvm-svn: 375318
More information about the All-commits
mailing list