[cfe-commits] r129126 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td test/Sema/uninit-variables-vectors.c test/Sema/uninit-variables.c test/SemaCXX/uninit-variables.cpp test/SemaObjC/uninit-variables.m

Chandler Carruth chandlerc at gmail.com
Thu Apr 7 23:33:38 PDT 2011


Author: chandlerc
Date: Fri Apr  8 01:33:38 2011
New Revision: 129126

URL: http://llvm.org/viewvc/llvm-project?rev=129126&view=rev
Log:
Now that the analyzer is distinguishing between uninitialized uses that
definitely have a path leading to them, and possibly have a path leading
to them; reflect that distinction in the warning text emitted.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/test/Sema/uninit-variables-vectors.c
    cfe/trunk/test/Sema/uninit-variables.c
    cfe/trunk/test/SemaCXX/uninit-variables.cpp
    cfe/trunk/test/SemaObjC/uninit-variables.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=129126&r1=129125&r2=129126&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Apr  8 01:33:38 2011
@@ -874,7 +874,8 @@
 def warn_uninit_self_reference_in_init : Warning<
   "variable %0 is uninitialized when used within its own initialization">,
   InGroup<Uninitialized>;
-def warn_uninit_var : Warning<"variable %0 is possibly uninitialized when used here">,
+def warn_uninit_var : Warning<
+  "variable %0 is uninitialized when used here">,
   InGroup<Uninitialized>, DefaultIgnore;
 def warn_maybe_uninit_var :
   Warning<"variable %0 is possibly uninitialized when used here">,
@@ -882,7 +883,7 @@
 def note_uninit_var_def : Note<
   "variable %0 is declared here">;
 def warn_uninit_var_captured_by_block : Warning<
-  "variable %0 is possibly uninitialized when captured by block">,
+  "variable %0 is uninitialized when captured by block">,
   InGroup<Uninitialized>, DefaultIgnore;
 def warn_maybe_uninit_var_captured_by_block : Warning<
   "variable %0 is possibly uninitialized when captured by block">,

Modified: cfe/trunk/test/Sema/uninit-variables-vectors.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/uninit-variables-vectors.c?rev=129126&r1=129125&r2=129126&view=diff
==============================================================================
--- cfe/trunk/test/Sema/uninit-variables-vectors.c (original)
+++ cfe/trunk/test/Sema/uninit-variables-vectors.c Fri Apr  8 01:33:38 2011
@@ -7,10 +7,10 @@
 
 void test1(float *input) {
   __m128 x, y, z, w, X; // expected-note {{variable 'x' is declared here}} expected-note {{variable 'y' is declared here}} expected-note {{variable 'w' is declared here}}  expected-note {{variable 'z' is declared here}}
-  x = _mm_xor_ps(x,x); // expected-warning {{variable 'x' is possibly uninitialized when used here}}
-  y = _mm_xor_ps(y,y); // expected-warning {{variable 'y' is possibly uninitialized when used here}}
-  z = _mm_xor_ps(z,z); // expected-warning {{variable 'z' is possibly uninitialized when used here}}
-  w = _mm_xor_ps(w,w); // expected-warning {{variable 'w' is possibly uninitialized when used here}}
+  x = _mm_xor_ps(x,x); // expected-warning {{variable 'x' is uninitialized when used here}}
+  y = _mm_xor_ps(y,y); // expected-warning {{variable 'y' is uninitialized when used here}}
+  z = _mm_xor_ps(z,z); // expected-warning {{variable 'z' is uninitialized when used here}}
+  w = _mm_xor_ps(w,w); // expected-warning {{variable 'w' is uninitialized when used here}}
   X = _mm_loadu_ps(&input[0]);
   X = _mm_xor_ps(X,X); // no-warning
 }

Modified: cfe/trunk/test/Sema/uninit-variables.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/uninit-variables.c?rev=129126&r1=129125&r2=129126&view=diff
==============================================================================
--- cfe/trunk/test/Sema/uninit-variables.c (original)
+++ cfe/trunk/test/Sema/uninit-variables.c Fri Apr  8 01:33:38 2011
@@ -2,7 +2,7 @@
 
 int test1() {
   int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
-  return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
 }
 
 int test2() {
@@ -18,19 +18,19 @@
 
 int test4() {
   int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
-  ++x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  ++x; // expected-warning{{variable 'x' is uninitialized when used here}}
   return x; 
 }
 
 int test5() {
   int x, y; // expected-note{{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
-  x = y; // expected-warning{{variable 'y' is possibly uninitialized when used here}}
+  x = y; // expected-warning{{variable 'y' is uninitialized when used here}}
   return x;
 }
 
 int test6() {
   int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
-  x += 2; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  x += 2; // expected-warning{{variable 'x' is uninitialized when used here}}
   return x;
 }
 
@@ -94,7 +94,7 @@
 int test15() {
   int x = x; // no-warning: signals intended lack of initialization. \
              // expected-note{{variable 'x' is declared here}}
-  return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
 }
 
 // Don't warn in the following example; shows dataflow confluence.
@@ -109,7 +109,7 @@
   // Don't warn multiple times about the same uninitialized variable
   // along the same path.
   int *x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
-  *x = 1; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  *x = 1; // expected-warning{{variable 'x' is uninitialized when used here}}
   *x = 1; // no-warning
 }
 
@@ -174,13 +174,13 @@
 
 float test25() {
   float x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
-  return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
 }
 
 typedef int MyInt;
 MyInt test26() {
   MyInt x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
-  return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
 }
 
 // Test handling of sizeof().
@@ -191,12 +191,12 @@
 
 int test28() {
   int len; // expected-note{{variable 'len' is declared here}} expected-note{{add initialization to silence this warning}}
-  return sizeof(int[len]); // expected-warning{{variable 'len' is possibly uninitialized when used here}}
+  return sizeof(int[len]); // expected-warning{{variable 'len' is uninitialized when used here}}
 }
 
 void test29() {
   int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
-  (void) ^{ (void) x; }; // expected-warning{{variable 'x' is possibly uninitialized when captured by block}}
+  (void) ^{ (void) x; }; // expected-warning{{variable 'x' is uninitialized when captured by block}}
 }
 
 void test30() {
@@ -222,7 +222,7 @@
 int test_34() {
   int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
   (void) x;
-  return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
 }
 
 // Test that this case doesn't crash.
@@ -264,14 +264,14 @@
 
 int test39(int x) {
   int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
-  int z = x + y; // expected-warning {{variable 'y' is possibly uninitialized when used here}}
+  int z = x + y; // expected-warning {{variable 'y' is uninitialized when used here}}
   return z;
 }
 
 
 int test40(int x) {
   int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
-  return x ? 1 : y; // expected-warning {{variable 'y' is possibly uninitialized when used here}}
+  return x ? 1 : y; // expected-warning {{variable 'y' is uninitialized when used here}}
 }
 
 int test41(int x) {
@@ -311,7 +311,7 @@
 void test46()
 {
   int i; // expected-note {{variable 'i' is declared here}} expected-note{{add initialization to silence this warning}}
-  int j = i ? : 1; // expected-warning {{variable 'i' is possibly uninitialized when used here}}
+  int j = i ? : 1; // expected-warning {{variable 'i' is uninitialized when used here}}
 }
 
 void *test47(int *i)

Modified: cfe/trunk/test/SemaCXX/uninit-variables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/uninit-variables.cpp?rev=129126&r1=129125&r2=129126&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/uninit-variables.cpp (original)
+++ cfe/trunk/test/SemaCXX/uninit-variables.cpp Fri Apr  8 01:33:38 2011
@@ -38,7 +38,7 @@
   if (flag && (x = test3_aux()) == 0) {
     x = 1;
   }
-  return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
 }
 
 enum test4_A {
@@ -46,7 +46,7 @@
 };
 test4_A test4() {
  test4_A a; // expected-note{{variable 'a' is declared here}}
- return a; // expected-warning{{variable 'a' is possibly uninitialized when used here}}
+ return a; // expected-warning{{variable 'a' is uninitialized when used here}}
 }
 
 // This test previously crashed Sema.

Modified: cfe/trunk/test/SemaObjC/uninit-variables.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/uninit-variables.m?rev=129126&r1=129125&r2=129126&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/uninit-variables.m (original)
+++ cfe/trunk/test/SemaObjC/uninit-variables.m Fri Apr  8 01:33:38 2011
@@ -4,7 +4,7 @@
 // Test just to ensure the analysis is working.
 int test1() {
   int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization}}
-  return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+  return x; // expected-warning{{variable 'x' is uninitialized when used here}}
 }
 
 // Test ObjC fast enumeration.





More information about the cfe-commits mailing list