Author: rtrieu
Date: Fri Sep 26 18:48:30 2014
New Revision: 218556
URL: http://llvm.org/viewvc/llvm-project?rev=218556&view=rev
Log:
Add back checking for condition of conditional operator for -Wuninitialized
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/uninitialized.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=218556&r1=218555&r2=218556&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Sep 26 18:48:30 2014
@@ -8348,6 +8348,7 @@ namespace {
}
if (ConditionalOperator *CO = dyn_cast<ConditionalOperator>(E)) {
+ Visit(CO->getCond());
HandleValue(CO->getTrueExpr());
HandleValue(CO->getFalseExpr());
return;
Modified: cfe/trunk/test/SemaCXX/uninitialized.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/uninitialized.cpp?rev=218556&r1=218555&r2=218556&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/uninitialized.cpp (original)
+++ cfe/trunk/test/SemaCXX/uninitialized.cpp Fri Sep 26 18:48:30 2014
@@ -50,6 +50,7 @@ int x = x++; // expected-warning {{varia
int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning {{variable
'y' is uninitialized when used within its own initialization}}
int z = ++ref(z); // expected-warning {{variable 'z' is uninitialized when
used within its own initialization}}
int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is uninitialized
when used within its own initialization}}
+int bb = bb ? x : y; // expected-warning {{variable 'bb' is uninitialized when
used within its own initialization}}
void test_stuff () {
int a = a; // no-warning: used to signal intended lack of initialization.
@@ -83,6 +84,8 @@ void test_stuff () {
int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning
{{variable 'y' is uninitialized when used within its own initialization}}
int z = ++ref(z); // expected-warning
{{variable 'z' is uninitialized when used within its own initialization}}
int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is
uninitialized when used within its own initialization}}
+ int bb = bb ? x : y; // expected-warning {{variable 'bb' is uninitialized
when used within its own initialization}}
+
for (;;) {
int a = a; // no-warning: used to signal intended lack of initialization.
@@ -116,6 +119,8 @@ void test_stuff () {
int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning
{{variable 'y' is uninitialized when used within its own initialization}}
int z = ++ref(z); // expected-warning
{{variable 'z' is uninitialized when used within its own initialization}}
int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is
uninitialized when used within its own initialization}}
+ int bb = bb ? x : y; // expected-warning {{variable 'bb' is uninitialized
when used within its own initialization}}
+
}
}
@@ -522,6 +527,8 @@ namespace statics {
static int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning
{{variable 'y' is uninitialized when used within its own initialization}}
static int z = ++ref(z); // expected-warning {{variable 'z' is uninitialized
when used within its own initialization}}
static int aa = (ref(aa) += 10); // expected-warning {{variable 'aa' is
uninitialized when used within its own initialization}}
+ static int bb = bb ? x : y; // expected-warning {{variable 'bb' is
uninitialized when used within its own initialization}}
+
void test() {
static int a = a; // no-warning: used to signal intended lack of
initialization.
@@ -555,7 +562,9 @@ namespace statics {
static int y = ((s ? (y, v) : (77, y))++, sizeof(y)); // expected-warning
{{static variable 'y' is suspiciously used within its own initialization}}
static int z = ++ref(z); // expected-warning {{static variable 'z' is
suspiciously used within its own initialization}}
static int aa = (ref(aa) += 10); // expected-warning {{static variable
'aa' is suspiciously used within its own initialization}}
- for (;;) {
+ static int bb = bb ? x : y; // expected-warning {{static variable 'bb' is
suspiciously used within its own initialization}}
+
+ for (;;) {
static int a = a; // no-warning: used to signal intended lack of
initialization.
static int b = b + 1; // expected-warning {{static variable 'b' is
suspiciously used within its own initialization}}
static int c = (c + c); // expected-warning 2{{static variable 'c' is
suspiciously used within its own initialization}}
@@ -587,6 +596,7 @@ namespace statics {
static int y = ((s ? (y, v) : (77, y))++, sizeof(y)); //
expected-warning {{static variable 'y' is suspiciously used within its own
initialization}}
static int z = ++ref(z); // expected-warning {{static variable 'z' is
suspiciously used within its own initialization}}
static int aa = (ref(aa) += 10); // expected-warning {{static variable
'aa' is suspiciously used within its own initialization}}
+ static int bb = bb ? x : y; // expected-warning {{static variable 'bb'
is suspiciously used within its own initialization}}
}
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits