summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2016-11-02 16:11:30 +0000
committerAlex Lorenz <arphaman@gmail.com>2016-11-02 16:11:30 +0000
commit4eec18ffc931a6ce744ab3f35ceed8675d9b8521 (patch)
tree3220a3da3661c98660d8c9f43dfd870ec08f40dc /clang/test
parent6a0855470f54a0cc4a1ea52cf8ac51d05500db8d (diff)
downloadbcm5719-llvm-4eec18ffc931a6ce744ab3f35ceed8675d9b8521.tar.gz
bcm5719-llvm-4eec18ffc931a6ce744ab3f35ceed8675d9b8521.zip
Simplify the test case from r285289.
This commit simplifies and clarifies the test code that was added in r285289. Suggested by David Blaikie. llvm-svn: 285825
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/warn-unused-variables.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/clang/test/SemaCXX/warn-unused-variables.cpp b/clang/test/SemaCXX/warn-unused-variables.cpp
index e40cf1a2c9c..d7be785b35a 100644
--- a/clang/test/SemaCXX/warn-unused-variables.cpp
+++ b/clang/test/SemaCXX/warn-unused-variables.cpp
@@ -153,36 +153,29 @@ namespace ctor_with_cleanups {
namespace arrayRecords {
-int total = 0;
-
-class Adder {
+class NonTriviallyDestructible {
public:
- Adder(int x); // out of line below
- ~Adder() {}
+ ~NonTriviallyDestructible() {}
};
-Adder::Adder(int x) {
- total += x;
-}
-
struct Foo {
int x;
Foo(int x) : x(x) {}
};
-struct S1 {
- S1();
+struct Elidable {
+ Elidable();
};
void foo(int size) {
- S1 y; // no warning
- S1 yarray[2]; // no warning
- S1 dynArray[size]; // no warning
- S1 nestedArray[1][2][3]; // no warning
+ Elidable elidable; // no warning
+ Elidable elidableArray[2]; // no warning
+ Elidable elidableDynArray[size]; // no warning
+ Elidable elidableNestedArray[1][2][3]; // no warning
- Adder scalerInFuncScope = 134; // no warning
- Adder arrayInFuncScope[] = { 135, 136 }; // no warning
- Adder nestedArrayInFuncScope[2][2] = { {1,2}, {3,4} }; // no warning
+ NonTriviallyDestructible scalar; // no warning
+ NonTriviallyDestructible array[2]; // no warning
+ NonTriviallyDestructible nestedArray[2][2]; // no warning
Foo fooScalar = 1; // expected-warning {{unused variable 'fooScalar'}}
Foo fooArray[] = {1,2}; // expected-warning {{unused variable 'fooArray'}}
@@ -191,8 +184,8 @@ void foo(int size) {
template<int N>
void bar() {
- Adder scaler = 123; // no warning
- Adder array[N] = {1,2}; // no warning
+ NonTriviallyDestructible scaler; // no warning
+ NonTriviallyDestructible array[N]; // no warning
}
void test() {
OpenPOWER on IntegriCloud