summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r--clang/test/Analysis/constant-folding.c10
-rw-r--r--clang/test/Analysis/dead-stores.c6
-rw-r--r--clang/test/Analysis/idempotent-operations.c2
-rw-r--r--clang/test/Analysis/misc-ps.m4
-rw-r--r--clang/test/Analysis/null-deref-ps.c2
-rw-r--r--clang/test/Analysis/rdar-6541136-region.c4
-rw-r--r--clang/test/Analysis/rdar-6541136.c2
7 files changed, 15 insertions, 15 deletions
diff --git a/clang/test/Analysis/constant-folding.c b/clang/test/Analysis/constant-folding.c
index 6ed2b390cf7..5a7e6be1dc1 100644
--- a/clang/test/Analysis/constant-folding.c
+++ b/clang/test/Analysis/constant-folding.c
@@ -18,10 +18,10 @@ void testComparisons (int a) {
}
void testSelfOperations (int a) {
- if ((a|a) != a) WARN;
- if ((a&a) != a) WARN;
- if ((a^a) != 0) WARN;
- if ((a-a) != 0) WARN;
+ if ((a|a) != a) WARN; // expected-warning{{idempotent operation}}
+ if ((a&a) != a) WARN; // expected-warning{{idempotent operation}}
+ if ((a^a) != 0) WARN; // expected-warning{{idempotent operation}}
+ if ((a-a) != 0) WARN; // expected-warning{{idempotent operation}}
}
void testIdempotent (int a) {
@@ -68,5 +68,5 @@ void testLocations (char *a) {
if (b!=a) WARN;
if (b>a) WARN;
if (b<a) WARN;
- if (b-a) WARN;
+ if (b-a) WARN; // expected-warning{{idempotent operation}}
}
diff --git a/clang/test/Analysis/dead-stores.c b/clang/test/Analysis/dead-stores.c
index defd7e0b7bd..a295d964643 100644
--- a/clang/test/Analysis/dead-stores.c
+++ b/clang/test/Analysis/dead-stores.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
@@ -158,7 +158,7 @@ int f16(int x) {
// Self-assignments should not be flagged as dead stores.
void f17() {
int x = 1;
- x = x; // no-warning
+ x = x; // expected-warning{{idempotent operation}}
}
// <rdar://problem/6506065>
@@ -458,7 +458,7 @@ void rdar8014335() {
// Note that the next value stored to 'i' is never executed
// because the next statement to be executed is the 'break'
// in the increment code of the first loop.
- i = i * 3; // expected-warning{{Value stored to 'i' is never read}}
+ i = i * 3; // expected-warning{{Value stored to 'i' is never read}} expected-warning{{idempotent operation}}
}
}
diff --git a/clang/test/Analysis/idempotent-operations.c b/clang/test/Analysis/idempotent-operations.c
index 9cef08edc43..72adb8ef25c 100644
--- a/clang/test/Analysis/idempotent-operations.c
+++ b/clang/test/Analysis/idempotent-operations.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-idempotent-operation -analyzer-store=region -analyzer-constraints=range -fblocks -verify -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -verify -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -verify %s
// Basic tests
diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m
index b1d47e214ef..7de1305049b 100644
--- a/clang/test/Analysis/misc-ps.m
+++ b/clang/test/Analysis/misc-ps.m
@@ -86,11 +86,11 @@ unsigned r6268365Aux();
void r6268365() {
unsigned x = 0;
- x &= r6268365Aux();
+ x &= r6268365Aux(); // expected-warning{{idempotent operation}}
unsigned j = 0;
if (x == 0) ++j;
- if (x == 0) x = x / j; // no-warning
+ if (x == 0) x = x / j; // expected-warning{{idempotent operation}} expected-warning{{idempotent operation}}
}
void divzeroassume(unsigned x, unsigned j) {
diff --git a/clang/test/Analysis/null-deref-ps.c b/clang/test/Analysis/null-deref-ps.c
index 7ca22ada7da..0b4153c8344 100644
--- a/clang/test/Analysis/null-deref-ps.c
+++ b/clang/test/Analysis/null-deref-ps.c
@@ -280,7 +280,7 @@ void f12(HF12ITEM i, char *q) {
// Test handling of translating between integer "pointers" and back.
void f13() {
int *x = 0;
- if (((((int) x) << 2) + 1) >> 1) *x = 1; // no-warning
+ if (((((int) x) << 2) + 1) >> 1) *x = 1; // expected-warning{{idempotent operation}}
}
// PR 4759 - Attribute non-null checking by the analyzer was not correctly
diff --git a/clang/test/Analysis/rdar-6541136-region.c b/clang/test/Analysis/rdar-6541136-region.c
index 82232c6bb97..c1734eec9ba 100644
--- a/clang/test/Analysis/rdar-6541136-region.c
+++ b/clang/test/Analysis/rdar-6541136-region.c
@@ -9,7 +9,7 @@ extern kernel_tea_cheese_t _wonky_gesticulate_cheese;
void test1( void ) {
kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese;
struct load_wine *cmd = (void*) &wonky[1];
- cmd = cmd;
+ cmd = cmd; // expected-warning{{idempotent operation}}
char *p = (void*) &wonky[1];
kernel_tea_cheese_t *q = &wonky[1];
// This test case tests both the RegionStore logic (doesn't crash) and
@@ -21,7 +21,7 @@ void test1( void ) {
void test1_b( void ) {
kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese;
struct load_wine *cmd = (void*) &wonky[1];
- cmd = cmd;
+ cmd = cmd; // expected-warning{{idempotent operation}}
char *p = (void*) &wonky[1];
*p = 1; // expected-warning{{Access out-of-bound array element (buffer overflow)}}
}
diff --git a/clang/test/Analysis/rdar-6541136.c b/clang/test/Analysis/rdar-6541136.c
index 844a9367b43..c729cb518fe 100644
--- a/clang/test/Analysis/rdar-6541136.c
+++ b/clang/test/Analysis/rdar-6541136.c
@@ -12,7 +12,7 @@ void foo( void )
{
kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese;
struct load_wine *cmd = (void*) &wonky[1];
- cmd = cmd;
+ cmd = cmd; // expected-warning{{idempotent operation}}
char *p = (void*) &wonky[1];
*p = 1;
kernel_tea_cheese_t *q = &wonky[1];
OpenPOWER on IntegriCloud