summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/uninitialized.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2012-10-01 17:39:51 +0000
committerRichard Trieu <rtrieu@google.com>2012-10-01 17:39:51 +0000
commit3267347ccac4009d14a2be63bde5cc471de244bf (patch)
treed954a2bc10b6f7b407be555febf70b71630c6ee0 /clang/test/SemaCXX/uninitialized.cpp
parente00af8093c2fc454dc3d2f1987e16c5fc64ed8e8 (diff)
downloadbcm5719-llvm-3267347ccac4009d14a2be63bde5cc471de244bf.tar.gz
bcm5719-llvm-3267347ccac4009d14a2be63bde5cc471de244bf.zip
Cleaning up the self initialization checker.
-Allow Sema to do more processing on the initial Expr before checking it. -Remove the special conditions in HandleExpr() -Move the code so that only one call site is needed. -Removed the function from Sema and only call it locally. -Warn on potentially evaluated reference variables, not just casts to r-values. -Update tests. llvm-svn: 164951
Diffstat (limited to 'clang/test/SemaCXX/uninitialized.cpp')
-rw-r--r--clang/test/SemaCXX/uninitialized.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/uninitialized.cpp b/clang/test/SemaCXX/uninitialized.cpp
index 6725bf9fd69..614844930e7 100644
--- a/clang/test/SemaCXX/uninitialized.cpp
+++ b/clang/test/SemaCXX/uninitialized.cpp
@@ -114,6 +114,8 @@ void setupA(bool x) {
A a17(a17.get2()); // expected-warning {{variable 'a17' is uninitialized when used within its own initialization}}
A a18 = x ? a18 : a17; // expected-warning {{variable 'a18' is uninitialized when used within its own initialization}}
A a19 = getA(x ? a19 : a17); // expected-warning {{variable 'a19' is uninitialized when used within its own initialization}}
+ A a20{a20}; // expected-warning {{variable 'a20' is uninitialized when used within its own initialization}}
+ A a21 = {a21}; // expected-warning {{variable 'a21' is uninitialized when used within its own initialization}}
}
bool x;
@@ -138,6 +140,8 @@ A a16(&a16.num); // expected-warning {{variable 'a16' is uninitialized when use
A a17(a17.get2()); // expected-warning {{variable 'a17' is uninitialized when used within its own initialization}}
A a18 = x ? a18 : a17; // expected-warning {{variable 'a18' is uninitialized when used within its own initialization}}
A a19 = getA(x ? a19 : a17); // expected-warning {{variable 'a19' is uninitialized when used within its own initialization}}
+A a20{a20}; // expected-warning {{variable 'a20' is uninitialized when used within its own initialization}}
+A a21 = {a21}; // expected-warning {{variable 'a21' is uninitialized when used within its own initialization}}
struct B {
// POD struct.
@@ -400,6 +404,9 @@ namespace in_class_initializers {
namespace references {
int &a = a; // expected-warning{{reference 'a' is not yet bound to a value when used within its own initialization}}
+ int &b(b); // expected-warning{{reference 'b' is not yet bound to a value when used within its own initialization}}
+ int &c = a ? b : c; // expected-warning{{reference 'c' is not yet bound to a value when used within its own initialization}}
+ int &d{d}; // expected-warning{{reference 'd' is not yet bound to a value when used within its own initialization}}
struct S {
S() : a(a) {} // expected-warning{{reference 'a' is not yet bound to a value when used here}}
@@ -408,6 +415,9 @@ namespace references {
void f() {
int &a = a; // expected-warning{{reference 'a' is not yet bound to a value when used within its own initialization}}
+ int &b(b); // expected-warning{{reference 'b' is not yet bound to a value when used within its own initialization}}
+ int &c = a ? b : c; // expected-warning{{reference 'c' is not yet bound to a value when used within its own initialization}}
+ int &d{d}; // expected-warning{{reference 'd' is not yet bound to a value when used within its own initialization}}
}
struct T {
OpenPOWER on IntegriCloud