r189132 - Consumed analysis: change class name in test cases.
DeLesley Hutchins
delesley at google.com
Fri Aug 23 11:40:39 PDT 2013
Author: delesley
Date: Fri Aug 23 13:40:39 2013
New Revision: 189132
URL: http://llvm.org/viewvc/llvm-project?rev=189132&view=rev
Log:
Consumed analysis: change class name in test cases.
The name of a class used in the testing files was updated to actually
be descriptive. Patch by chris.wailes at gmail.com.
Modified:
cfe/trunk/test/SemaCXX/warn-consumed-analysis-strict.cpp
cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp
Modified: cfe/trunk/test/SemaCXX/warn-consumed-analysis-strict.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-consumed-analysis-strict.cpp?rev=189132&r1=189131&r2=189132&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-consumed-analysis-strict.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-consumed-analysis-strict.cpp Fri Aug 23 13:40:39 2013
@@ -7,24 +7,24 @@
typedef decltype(nullptr) nullptr_t;
template <typename T>
-class Bar {
+class ConsumableClass {
T var;
public:
- Bar(void);
- Bar(T val);
- Bar(Bar<T> &other);
- Bar(Bar<T> &&other);
-
- Bar<T>& operator=(Bar<T> &other);
- Bar<T>& operator=(Bar<T> &&other);
- Bar<T>& operator=(nullptr_t);
+ ConsumableClass(void);
+ ConsumableClass(T val);
+ ConsumableClass(ConsumableClass<T> &other);
+ ConsumableClass(ConsumableClass<T> &&other);
+
+ ConsumableClass<T>& operator=(ConsumableClass<T> &other);
+ ConsumableClass<T>& operator=(ConsumableClass<T> &&other);
+ ConsumableClass<T>& operator=(nullptr_t);
template <typename U>
- Bar<T>& operator=(Bar<U> &other);
+ ConsumableClass<T>& operator=(ConsumableClass<U> &other);
template <typename U>
- Bar<T>& operator=(Bar<U> &&other);
+ ConsumableClass<T>& operator=(ConsumableClass<U> &&other);
void operator*(void) const CALLABLE_WHEN_UNCONSUMED;
@@ -36,11 +36,11 @@ class Bar {
void consume(void) CONSUMES;
};
-void baf0(Bar<int> &var);
-void baf1(Bar<int> *var);
+void baf0(ConsumableClass<int> &var);
+void baf1(ConsumableClass<int> *var);
void testIfStmt(void) {
- Bar<int> var;
+ ConsumableClass<int> var;
if (var.isValid()) { // expected-warning {{unnecessary test. Variable 'var' is known to be in the 'consumed' state}}
@@ -52,7 +52,7 @@ void testIfStmt(void) {
}
void testConditionalMerge(void) {
- Bar<int> var;
+ ConsumableClass<int> var;
if (var.isValid()) {// expected-warning {{unnecessary test. Variable 'var' is known to be in the 'consumed' state}}
@@ -72,25 +72,25 @@ void testConditionalMerge(void) {
}
void testCallingConventions(void) {
- Bar<int> var(42);
+ ConsumableClass<int> var(42);
baf0(var);
*var; // expected-warning {{invocation of method 'operator*' on object 'var' while it is in an unknown state}}
- var = Bar<int>(42);
+ var = ConsumableClass<int>(42);
baf1(&var);
*var; // expected-warning {{invocation of method 'operator*' on object 'var' while it is in an unknown state}}
}
void testMoveAsignmentish(void) {
- Bar<int> var;
+ ConsumableClass<int> var;
var = nullptr;
*var; // expected-warning {{invocation of method 'operator*' on object 'var' while it is in an unknown state}}
}
void testConstAndNonConstMemberFunctions(void) {
- Bar<int> var(42);
+ ConsumableClass<int> var(42);
var.constCall();
*var;
@@ -100,7 +100,7 @@ void testConstAndNonConstMemberFunctions
}
void testSimpleForLoop(void) {
- Bar<int> var;
+ ConsumableClass<int> var;
for (int i = 0; i < 10; ++i) {
*var; // expected-warning {{invocation of method 'operator*' on object 'var' while it is in an unknown state}}
@@ -112,7 +112,7 @@ void testSimpleForLoop(void) {
void testSimpleWhileLoop(void) {
int i = 0;
- Bar<int> var;
+ ConsumableClass<int> var;
while (i < 10) {
*var; // expected-warning {{invocation of method 'operator*' on object 'var' while it is in an unknown state}}
Modified: cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp?rev=189132&r1=189131&r2=189132&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp Fri Aug 23 13:40:39 2013
@@ -7,25 +7,25 @@
typedef decltype(nullptr) nullptr_t;
template <typename T>
-class Bar {
+class ConsumableClass {
T var;
public:
- Bar(void);
- Bar(nullptr_t p) CONSUMES;
- Bar(T val);
- Bar(Bar<T> &other);
- Bar(Bar<T> &&other);
-
- Bar<T>& operator=(Bar<T> &other);
- Bar<T>& operator=(Bar<T> &&other);
- Bar<T>& operator=(nullptr_t);
+ ConsumableClass(void);
+ ConsumableClass(nullptr_t p) CONSUMES;
+ ConsumableClass(T val);
+ ConsumableClass(ConsumableClass<T> &other);
+ ConsumableClass(ConsumableClass<T> &&other);
+
+ ConsumableClass<T>& operator=(ConsumableClass<T> &other);
+ ConsumableClass<T>& operator=(ConsumableClass<T> &&other);
+ ConsumableClass<T>& operator=(nullptr_t);
template <typename U>
- Bar<T>& operator=(Bar<U> &other);
+ ConsumableClass<T>& operator=(ConsumableClass<U> &other);
template <typename U>
- Bar<T>& operator=(Bar<U> &&other);
+ ConsumableClass<T>& operator=(ConsumableClass<U> &&other);
void operator()(int a) CONSUMES;
void operator*(void) const CALLABLE_WHEN_UNCONSUMED;
@@ -41,17 +41,17 @@ class Bar {
void consume(void) CONSUMES;
};
-void baf0(const Bar<int> var);
-void baf1(const Bar<int> &var);
-void baf2(const Bar<int> *var);
+void baf0(const ConsumableClass<int> var);
+void baf1(const ConsumableClass<int> &var);
+void baf2(const ConsumableClass<int> *var);
-void baf3(Bar<int> &&var);
+void baf3(ConsumableClass<int> &&var);
void testInitialization(void) {
- Bar<int> var0;
- Bar<int> var1 = Bar<int>();
+ ConsumableClass<int> var0;
+ ConsumableClass<int> var1 = ConsumableClass<int>();
- var0 = Bar<int>();
+ var0 = ConsumableClass<int>();
*var0; // expected-warning {{invocation of method 'operator*' on object 'var0' while it is in the 'consumed' state}}
*var1; // expected-warning {{invocation of method 'operator*' on object 'var1' while it is in the 'consumed' state}}
@@ -65,25 +65,25 @@ void testInitialization(void) {
}
}
-void testTempValue(void) {
- *Bar<int>(); // expected-warning {{invocation of method 'operator*' on a temporary object while it is in the 'consumed' state}}
+void testTempValue() {
+ *ConsumableClass<int>(); // expected-warning {{invocation of method 'operator*' on a temporary object while it is in the 'consumed' state}}
}
void testSimpleRValueRefs(void) {
- Bar<int> var0;
- Bar<int> var1(42);
+ ConsumableClass<int> var0;
+ ConsumableClass<int> var1(42);
*var0; // expected-warning {{invocation of method 'operator*' on object 'var0' while it is in the 'consumed' state}}
*var1;
- var0 = static_cast<Bar<int>&&>(var1);
+ var0 = static_cast<ConsumableClass<int>&&>(var1);
*var0;
*var1; // expected-warning {{invocation of method 'operator*' on object 'var1' while it is in the 'consumed' state}}
}
void testIfStmt(void) {
- Bar<int> var;
+ ConsumableClass<int> var;
if (var.isValid()) {
// Empty
@@ -115,7 +115,7 @@ void testIfStmt(void) {
}
void testCallingConventions(void) {
- Bar<int> var(42);
+ ConsumableClass<int> var(42);
baf0(var);
*var;
@@ -126,25 +126,25 @@ void testCallingConventions(void) {
baf2(&var);
*var;
- baf3(static_cast<Bar<int>&&>(var));
+ baf3(static_cast<ConsumableClass<int>&&>(var));
*var; // expected-warning {{invocation of method 'operator*' on object 'var' while it is in the 'consumed' state}}
}
void testMoveAsignmentish(void) {
- Bar<int> var0;
- Bar<long> var1(42);
+ ConsumableClass<int> var0;
+ ConsumableClass<long> var1(42);
*var0; // expected-warning {{invocation of method 'operator*' on object 'var0' while it is in the 'consumed' state}}
*var1;
- var0 = static_cast<Bar<long>&&>(var1);
+ var0 = static_cast<ConsumableClass<long>&&>(var1);
*var0;
*var1; // expected-warning {{invocation of method 'operator*' on object 'var1' while it is in the 'consumed' state}}
}
void testConditionalMerge(void) {
- Bar<int> var;
+ ConsumableClass<int> var;
if (var.isValid()) {
// Empty
@@ -163,7 +163,7 @@ void testConditionalMerge(void) {
}
void testConsumes0(void) {
- Bar<int> var(42);
+ ConsumableClass<int> var(42);
*var;
@@ -173,13 +173,13 @@ void testConsumes0(void) {
}
void testConsumes1(void) {
- Bar<int> var(nullptr);
+ ConsumableClass<int> var(nullptr);
*var; // expected-warning {{invocation of method 'operator*' on object 'var' while it is in the 'consumed' state}}
}
void testConsumes2(void) {
- Bar<int> var(42);
+ ConsumableClass<int> var(42);
var.unconsumedCall();
var(6);
@@ -188,7 +188,7 @@ void testConsumes2(void) {
}
void testSimpleForLoop(void) {
- Bar<int> var;
+ ConsumableClass<int> var;
for (int i = 0; i < 10; ++i) {
*var;
@@ -200,7 +200,7 @@ void testSimpleForLoop(void) {
void testSimpleWhileLoop(void) {
int i = 0;
- Bar<int> var;
+ ConsumableClass<int> var;
while (i < 10) {
*var;
More information about the cfe-commits
mailing list