Finesse 'idempotent operations' analyzer issues to include the opcode of the binary operator for clearer error reporting.  Also remove the 'Idempotent operation' prefix in messages; it's redundant since the bug type is the same.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109527 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/constant-folding.c b/test/Analysis/constant-folding.c
index 5a7e6be..b1ca3ee 100644
--- a/test/Analysis/constant-folding.c
+++ b/test/Analysis/constant-folding.c
@@ -18,10 +18,10 @@
 }
 
 void testSelfOperations (int a) {
-  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}}
+  if ((a|a) != a) WARN; // expected-warning{{Both operands to '|' always have the same value}}
+  if ((a&a) != a) WARN; // expected-warning{{Both operands to '&' always have the same value}}
+  if ((a^a) != 0) WARN; // expected-warning{{Both operands to '^' always have the same value}}
+  if ((a-a) != 0) WARN; // expected-warning{{Both operands to '-' always have the same value}}
 }
 
 void testIdempotent (int a) {
@@ -68,5 +68,5 @@
   if (b!=a) WARN;
   if (b>a) WARN;
   if (b<a) WARN;
-  if (b-a) WARN; // expected-warning{{idempotent operation}}
+  if (b-a) WARN; // expected-warning{{Both operands to '-' always have the same value}}
 }
diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c
index a295d96..cc8a3f5 100644
--- a/test/Analysis/dead-stores.c
+++ b/test/Analysis/dead-stores.c
@@ -158,7 +158,7 @@
 // Self-assignments should not be flagged as dead stores.
 void f17() {
   int x = 1;
-  x = x; // expected-warning{{idempotent operation}}
+  x = x; // expected-warning{{Assigned value is always the same as the existing value}}
 }
 
 // <rdar://problem/6506065>
@@ -458,7 +458,7 @@
     // 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}} expected-warning{{idempotent operation}}
+    i = i * 3; // expected-warning{{Value stored to 'i' is never read}} expected-warning{{The left operand to '*' is always 1}}
   }
 }
 
diff --git a/test/Analysis/idempotent-operations.c b/test/Analysis/idempotent-operations.c
index 94e972c..74d31e7 100644
--- a/test/Analysis/idempotent-operations.c
+++ b/test/Analysis/idempotent-operations.c
@@ -9,47 +9,47 @@
   int x = 10, zero = 0, one = 1;
 
   // x op x
-  x = x;        // expected-warning {{idempotent operation; both operands are always equal in value}}
-  test(x - x);  // expected-warning {{idempotent operation; both operands are always equal in value}}
-  x -= x;       // expected-warning {{idempotent operation; both operands are always equal in value}}
+  x = x;        // expected-warning {{Assigned value is always the same as the existing value}}
+  test(x - x);  // expected-warning {{Both operands to '-' always have the same value}}
+  x -= x;       // expected-warning {{Both operands to '-=' always have the same value}}
   x = 10;       // no-warning
-  test(x / x);  // expected-warning {{idempotent operation; both operands are always equal in value}}
-  x /= x;       // expected-warning {{idempotent operation; both operands are always equal in value}}
+  test(x / x);  // expected-warning {{Both operands to '/' always have the same value}}
+  x /= x;       // expected-warning {{Both operands to '/=' always have the same value}}
   x = 10;       // no-warning
-  test(x & x);  // expected-warning {{idempotent operation; both operands are always equal in value}}
-  x &= x;       // expected-warning {{idempotent operation; both operands are always equal in value}}
-  test(x | x);  // expected-warning {{idempotent operation; both operands are always equal in value}}
-  x |= x;       // expected-warning {{idempotent operation; both operands are always equal in value}}
+  test(x & x);  // expected-warning {{Both operands to '&' always have the same value}}
+  x &= x;       // expected-warning {{Both operands to '&=' always have the same value}}
+  test(x | x);  // expected-warning {{Both operands to '|' always have the same value}}
+  x |= x;       // expected-warning {{Both operands to '|=' always have the same value}}
 
   // x op 1
-  test(x * one);  // expected-warning {{idempotent operation; the right operand is always 1}}
-  x *= one;       // expected-warning {{idempotent operation; the right operand is always 1}}
-  test(x / one);  // expected-warning {{idempotent operation; the right operand is always 1}}
-  x /= one;       // expected-warning {{idempotent operation; the right operand is always 1}}
+  test(x * one);  // expected-warning {{The right operand to '*' is always 1}}
+  x *= one;       // expected-warning {{The right operand to '*=' is always 1}}
+  test(x / one);  // expected-warning {{The right operand to '/' is always 1}}
+  x /= one;       // expected-warning {{The right operand to '/=' is always 1}}
 
   // 1 op x
-  test(one * x);   // expected-warning {{idempotent operation; the left operand is always 1}}
+  test(one * x);   // expected-warning {{The left operand to '*' is always 1}}
 
   // x op 0
-  test(x + zero);  // expected-warning {{idempotent operation; the right operand is always 0}}
-  test(x - zero);  // expected-warning {{idempotent operation; the right operand is always 0}}
-  test(x * zero);  // expected-warning {{idempotent operation; the right operand is always 0}}
-  test(x & zero);  // expected-warning {{idempotent operation; the right operand is always 0}}
-  test(x | zero);  // expected-warning {{idempotent operation; the right operand is always 0}}
-  test(x ^ zero);  // expected-warning {{idempotent operation; the right operand is always 0}}
-  test(x << zero); // expected-warning {{idempotent operation; the right operand is always 0}}
-  test(x >> zero); // expected-warning {{idempotent operation; the right operand is always 0}}
+  test(x + zero);  // expected-warning {{The right operand to '+' is always 0}}
+  test(x - zero);  // expected-warning {{The right operand to '-' is always 0}}
+  test(x * zero);  // expected-warning {{The right operand to '*' is always 0}}
+  test(x & zero);  // expected-warning {{The right operand to '&' is always 0}}
+  test(x | zero);  // expected-warning {{The right operand to '|' is always 0}}
+  test(x ^ zero);  // expected-warning {{The right operand to '^' is always 0}}
+  test(x << zero); // expected-warning {{The right operand to '<<' is always 0}}
+  test(x >> zero); // expected-warning {{The right operand to '>>' is always 0}}
 
   // 0 op x
-  test(zero + x);  // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero - x);  // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero / x);  // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero * x);  // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero & x);  // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero | x);  // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero ^ x);  // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero << x); // expected-warning {{idempotent operation; the left operand is always 0}}
-  test(zero >> x); // expected-warning {{idempotent operation; the left operand is always 0}}
+  test(zero + x);  // expected-warning {{The left operand to '+' is always 0}}
+  test(zero - x);  // expected-warning {{The left operand to '-' is always 0}}
+  test(zero / x);  // expected-warning {{The left operand to '/' is always 0}}
+  test(zero * x);  // expected-warning {{The left operand to '*' is always 0}}
+  test(zero & x);  // expected-warning {{The left operand to '&' is always 0}}
+  test(zero | x);  // expected-warning {{The left operand to '|' is always 0}}
+  test(zero ^ x);  // expected-warning {{The left operand to '^' is always 0}}
+  test(zero << x); // expected-warning {{The left operand to '<<' is always 0}}
+  test(zero >> x); // expected-warning {{The left operand to '>>' is always 0}}
 }
 
 void floats(float x) {
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index c2099b0..be7f450 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -86,11 +86,11 @@
 
 void r6268365() {
   unsigned x = 0;
-  x &= r6268365Aux(); // expected-warning{{idempotent operation}}
+  x &= r6268365Aux(); // expected-warning{{The left operand to '&=' is always 0}}
   unsigned j = 0;
     
   if (x == 0) ++j;
-  if (x == 0) x = x / j; // expected-warning{{idempotent operation}} expected-warning{{idempotent operation}}
+  if (x == 0) x = x / j; // expected-warning{{Assigned value is always the same as the existing value}} expected-warning{{The right operand to '/' is always 1}}
 }
 
 void divzeroassume(unsigned x, unsigned j) {  
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index 0b4153c..9be73a8 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -280,7 +280,7 @@
 // Test handling of translating between integer "pointers" and back.
 void f13() {
   int *x = 0;
-  if (((((int) x) << 2) + 1) >> 1) *x = 1; // expected-warning{{idempotent operation}}
+  if (((((int) x) << 2) + 1) >> 1) *x = 1; // expected-warning{{he left operand to '<<' is always 0}}
 }
 
 // PR 4759 - Attribute non-null checking by the analyzer was not correctly
diff --git a/test/Analysis/rdar-6541136-region.c b/test/Analysis/rdar-6541136-region.c
index c1734ee..80c04ae 100644
--- a/test/Analysis/rdar-6541136-region.c
+++ b/test/Analysis/rdar-6541136-region.c
@@ -9,7 +9,7 @@
 void test1( void ) {
   kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese;
   struct load_wine *cmd = (void*) &wonky[1];
-  cmd = cmd; // expected-warning{{idempotent operation}}
+  cmd = cmd; // expected-warning{{Assigned value is always the same as the existing value}}
   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_b( void ) {
   kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese;
   struct load_wine *cmd = (void*) &wonky[1];
-  cmd = cmd; // expected-warning{{idempotent operation}}
+  cmd = cmd; // expected-warning{{Assigned value is always the same as the existing value}}
   char *p = (void*) &wonky[1];
   *p = 1;  // expected-warning{{Access out-of-bound array element (buffer overflow)}}
 }
diff --git a/test/Analysis/rdar-6541136.c b/test/Analysis/rdar-6541136.c
index c729cb5..911fb4a 100644
--- a/test/Analysis/rdar-6541136.c
+++ b/test/Analysis/rdar-6541136.c
@@ -12,7 +12,7 @@
 {
   kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese;
   struct load_wine *cmd = (void*) &wonky[1];
-  cmd = cmd; // expected-warning{{idempotent operation}}
+  cmd = cmd; // expected-warning{{Assigned value is always the same as the existing value}}
   char *p = (void*) &wonky[1];
   *p = 1;
   kernel_tea_cheese_t *q = &wonky[1];