diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-04-04 23:29:12 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-04-04 23:29:12 +0000 |
commit | 378819342eb448477a8666ad96adbe67408f4705 (patch) | |
tree | 611438b3c2bfa11fb1e013ea4ac31c55802c86d0 /clang/test/SemaCXX/uninitialized.cpp | |
parent | 44927690c3a460ee5f5499998255947161e9ca4f (diff) | |
download | bcm5719-llvm-378819342eb448477a8666ad96adbe67408f4705.tar.gz bcm5719-llvm-378819342eb448477a8666ad96adbe67408f4705.zip |
Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with numerous CFG and UninitializedValues analysis changes:
1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt.
2) Update ExprEngine (the static analyzer) to understand (1), so not to regress.
3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method.
4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases.
The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer
contained control-flow.
llvm-svn: 128858
Diffstat (limited to 'clang/test/SemaCXX/uninitialized.cpp')
-rw-r--r-- | clang/test/SemaCXX/uninitialized.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/uninitialized.cpp b/clang/test/SemaCXX/uninitialized.cpp index 13ea9688efe..cf75187ab8e 100644 --- a/clang/test/SemaCXX/uninitialized.cpp +++ b/clang/test/SemaCXX/uninitialized.cpp @@ -11,7 +11,7 @@ int a = a; // FIXME: This doesn't warn!? Seems it doesn't cast 'a' to an RValue. int b = b + 1; // expected-warning {{variable 'b' is uninitialized when used within its own initialization}} int c = (c + c); // expected-warning 2 {{variable 'c' is uninitialized when used within its own initialization}} void test() { - int d = ({ d + d ;}); // expected-warning 2 {{variable 'd' is uninitialized when used within its own initialization}} + int d = ({ d + d ;}); // expected-warning {{variable 'd' is uninitialized when used within its own initialization}} } int e = static_cast<long>(e) + 1; // expected-warning {{variable 'e' is uninitialized when used within its own initialization}} int f = foo(f); // expected-warning {{variable 'f' is uninitialized when used within its own initialization}} |