aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Checker/IdempotentOperationChecker.cpp2
-rw-r--r--test/Analysis/misc-ps.m4
-rw-r--r--test/Analysis/null-deref-ps.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/Checker/IdempotentOperationChecker.cpp b/lib/Checker/IdempotentOperationChecker.cpp
index 35fb83e877..8a9e333ce5 100644
--- a/lib/Checker/IdempotentOperationChecker.cpp
+++ b/lib/Checker/IdempotentOperationChecker.cpp
@@ -210,6 +210,8 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
case BO_Xor:
case BO_LOr:
case BO_LAnd:
+ case BO_EQ:
+ case BO_NE:
if (LHSVal != RHSVal || LHSContainsFalsePositive
|| RHSContainsFalsePositive)
break;
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index 1aa80bd89f..6aac74b109 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -407,14 +407,14 @@ void test_trivial_symbolic_comparison(int *x) {
int test_trivial_symbolic_comparison_aux();
int a = test_trivial_symbolic_comparison_aux();
int b = a;
- if (a != b) {
+ if (a != b) { // expected-warning{{Both operands to '!=' always have the same value}}
int *p = 0;
*p = 0xDEADBEEF; // no-warning
}
a = a == 1;
b = b == 1;
- if (a != b) {
+ if (a != b) { // expected-warning{{Both operands to '!=' always have the same value}}
int *p = 0;
*p = 0xDEADBEEF; // no-warning
}
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index d0e4f61521..8daa845068 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -66,7 +66,7 @@ int f4_b() {
short *p = x; // expected-warning{{incompatible integer to pointer conversion}}
// The following branch should be infeasible.
- if (!(p == &array[0])) {
+ if (!(p == &array[0])) { // expected-warning{{Both operands to '==' always have the same value}}
p = 0;
*p = 1; // no-warning
}