diff options
author | Nico Weber <nicolasweber@gmx.de> | 2012-07-20 03:39:05 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2012-07-20 03:39:05 +0000 |
commit | 381767fcfe2fdf53727099d95b23b0c9e6a9aa6c (patch) | |
tree | b3f008d6d05f480d9b1ac8c317c47b48b05ce8b7 /test | |
parent | 4a410dd179a960318dc0fef0a4eb1c1de63d9870 (diff) |
Let Expr::HasSideEffects() return false for NULL, bool literals, this, and nullptr.
Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/ARCMT/cxx-rewrite.mm.result | 2 | ||||
-rw-r--r-- | test/SemaCXX/warn-unused-private-field.cpp | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/test/ARCMT/cxx-rewrite.mm.result b/test/ARCMT/cxx-rewrite.mm.result index a2dc9a51f0..7c944d5f24 100644 --- a/test/ARCMT/cxx-rewrite.mm.result +++ b/test/ARCMT/cxx-rewrite.mm.result @@ -16,7 +16,7 @@ struct foo { [NSString string]; } } - ~foo(){ s; } + ~foo(){ } private: foo(foo const &); foo &operator=(foo const &); diff --git a/test/SemaCXX/warn-unused-private-field.cpp b/test/SemaCXX/warn-unused-private-field.cpp index 6a7922e8e5..640a9b9a69 100644 --- a/test/SemaCXX/warn-unused-private-field.cpp +++ b/test/SemaCXX/warn-unused-private-field.cpp @@ -209,3 +209,13 @@ union S { unsigned char Data[8]; }; } // namespace anonymous_structs_unions + +namespace pr13413 { +class A { + A() : p_(__null), b_(false), a_(this), p2_(nullptr) {} + void* p_; // expected-warning{{private field 'p_' is not used}} + bool b_; // expected-warning{{private field 'b_' is not used}} + A* a_; // expected-warning{{private field 'a_' is not used}} + void* p2_; // expected-warning{{private field 'p2_' is not used}} +}; +} |