[clang-tools-extra] r343199 - [clang-tidy] use CHECK-NOTES in tests for bugprone-use-after-move
Jonas Toth via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 27 05:22:48 PDT 2018
Author: jonastoth
Date: Thu Sep 27 05:22:48 2018
New Revision: 343199
URL: http://llvm.org/viewvc/llvm-project?rev=343199&view=rev
Log:
[clang-tidy] use CHECK-NOTES in tests for bugprone-use-after-move
Reviewers: alexfh, aaron.ballman, hokein
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D52228
Modified:
clang-tools-extra/trunk/test/clang-tidy/bugprone-use-after-move.cpp
Modified: clang-tools-extra/trunk/test/clang-tidy/bugprone-use-after-move.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/bugprone-use-after-move.cpp?rev=343199&r1=343198&r2=343199&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/bugprone-use-after-move.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/bugprone-use-after-move.cpp Thu Sep 27 05:22:48 2018
@@ -125,8 +125,8 @@ void simple() {
a.foo();
A other_a = std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:15: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:15: note: move occurred here
}
// A warning should only be emitted for one use-after-move.
@@ -135,8 +135,8 @@ void onlyFlagOneUseAfterMove() {
a.foo();
A other_a = std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:15: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:15: note: move occurred here
a.foo();
}
@@ -146,8 +146,8 @@ void moveAfterMove() {
A a;
std::move(a);
std::move(a);
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:15: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// This is also true if the move itself turns into the use on the second loop
// iteration.
@@ -155,9 +155,9 @@ void moveAfterMove() {
A a;
for (int i = 0; i < 10; ++i) {
std::move(a);
- // CHECK-MESSAGES: [[@LINE-1]]:17: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:7: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-3]]:17: note: the use happens in a later loop
+ // CHECK-NOTES: [[@LINE-1]]:17: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-3]]:17: note: the use happens in a later loop
}
}
}
@@ -166,8 +166,8 @@ void moveAfterMove() {
void parameters(A a) {
std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:3: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:3: note: move occurred here
}
void standardSmartPtr() {
@@ -180,22 +180,22 @@ void standardSmartPtr() {
ptr.get();
static_cast<bool>(ptr);
*ptr;
- // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'ptr' used after it was moved
- // CHECK-MESSAGES: [[@LINE-5]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:6: warning: 'ptr' used after it was moved
+ // CHECK-NOTES: [[@LINE-5]]:5: note: move occurred here
}
{
std::unique_ptr<A> ptr;
std::move(ptr);
ptr->foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
{
std::unique_ptr<A> ptr;
std::move(ptr);
ptr[0];
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
{
std::shared_ptr<A> ptr;
@@ -203,15 +203,15 @@ void standardSmartPtr() {
ptr.get();
static_cast<bool>(ptr);
*ptr;
- // CHECK-MESSAGES: [[@LINE-1]]:6: warning: 'ptr' used after it was moved
- // CHECK-MESSAGES: [[@LINE-5]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:6: warning: 'ptr' used after it was moved
+ // CHECK-NOTES: [[@LINE-5]]:5: note: move occurred here
}
{
std::shared_ptr<A> ptr;
std::move(ptr);
ptr->foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
{
// std::weak_ptr<> cannot be dereferenced directly, so we only check that
@@ -252,8 +252,8 @@ void standardSmartPtr() {
} ptr;
std::move(ptr);
ptr.get();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'ptr' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
}
@@ -263,8 +263,8 @@ class Container {
A a;
std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
};
@@ -273,8 +273,8 @@ void moveInDeclaration() {
A a;
A another_a(std::move(a));
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// We see the std::move if it's inside an initializer list. Initializer lists
@@ -290,8 +290,8 @@ void moveInInitList() {
A a;
S s{std::move(a)};
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:7: note: move occurred here
}
void lambdas() {
@@ -301,8 +301,8 @@ void lambdas() {
auto lambda = [a] {
std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:7: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:7: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:7: note: move occurred here
};
}
// This is just as true if the variable was declared inside the lambda.
@@ -311,8 +311,8 @@ void lambdas() {
A a;
std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:7: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:7: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:7: note: move occurred here
};
}
// But don't warn if the move happened inside the lambda but the use happened
@@ -331,31 +331,31 @@ void lambdas() {
A a;
std::move(a);
auto lambda = [a]() { a.foo(); };
- // CHECK-MESSAGES: [[@LINE-1]]:20: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:20: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// ...even if the capture was implicit.
{
A a;
std::move(a);
auto lambda = [=]() { a.foo(); };
- // CHECK-MESSAGES: [[@LINE-1]]:20: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:20: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// Same tests but for capture by reference.
{
A a;
std::move(a);
auto lambda = [&a]() { a.foo(); };
- // CHECK-MESSAGES: [[@LINE-1]]:21: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:21: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
{
A a;
std::move(a);
auto lambda = [&]() { a.foo(); };
- // CHECK-MESSAGES: [[@LINE-1]]:20: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:20: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// But don't warn if the move happened after the capture.
{
@@ -390,8 +390,8 @@ void movedTypeIsNotDependentType() {
A a;
std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:3: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:3: note: move occurred here
}
// And if the moved type is a dependent type, the use-after-move is detected if
@@ -401,8 +401,8 @@ void movedTypeIsDependentType() {
T t;
std::move(t);
t.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 't' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:3: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 't' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:3: note: move occurred here
}
template void movedTypeIsDependentType<A>();
@@ -417,8 +417,8 @@ void implicitConversionOperator() {
Convertible convertible;
takeA(std::move(convertible));
convertible;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: 'convertible' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:9: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:3: warning: 'convertible' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:9: note: move occurred here
}
// Using decltype on an expression is not a use.
@@ -480,9 +480,9 @@ void useAndMoveInLoop() {
A a;
for (int i = 0; i < 10; ++i) {
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:7: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE+2]]:7: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-3]]:7: note: the use happens in a later loop
+ // CHECK-NOTES: [[@LINE-1]]:7: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE+2]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-3]]:7: note: the use happens in a later loop
std::move(a);
}
}
@@ -559,8 +559,8 @@ void differentBranches(int i) {
std::move(a);
case 2:
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:7: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-4]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:7: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-4]]:7: note: move occurred here
break;
}
}
@@ -575,8 +575,8 @@ void mutuallyExclusiveBranchesFalsePosit
}
if (!b) {
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-5]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-5]]:5: note: move occurred here
}
}
@@ -658,8 +658,8 @@ void assignments(int i) {
a = A();
std::move(a);
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// Report a use-after-move if we can't be sure that the variable was assigned
// to.
@@ -671,8 +671,8 @@ void assignments(int i) {
}
if (i > 5) {
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:7: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-7]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:7: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-7]]:5: note: move occurred here
}
}
}
@@ -708,14 +708,14 @@ void passByConstPointerIsUse() {
const A a;
std::move(a);
passByConstPointer(&a);
- // CHECK-MESSAGES: [[@LINE-1]]:25: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:25: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
const A a;
std::move(a);
passByConstReference(a);
- // CHECK-MESSAGES: [[@LINE-1]]:24: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:3: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:24: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:3: note: move occurred here
}
// Clearing a standard container using clear() is treated as a
@@ -820,8 +820,8 @@ void standardContainerClearIsReinit() {
} container;
std::move(container);
container.clear();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'container' used after it was
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'container' used after it was
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// An intervening clear() on a different container does not reinitialize.
{
@@ -829,8 +829,8 @@ void standardContainerClearIsReinit() {
std::move(container1);
container2.clear();
container1.empty();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'container1' used after it was
- // CHECK-MESSAGES: [[@LINE-4]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'container1' used after it was
+ // CHECK-NOTES: [[@LINE-4]]:5: note: move occurred here
}
}
@@ -875,8 +875,8 @@ void standardContainerAssignIsReinit() {
} container;
std::move(container);
container.assign(0, 0);
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'container' used after it was
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'container' used after it was
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
// An intervening assign() on a different container does not reinitialize.
{
@@ -884,8 +884,8 @@ void standardContainerAssignIsReinit() {
std::move(container1);
container2.assign(0, 0);
container1.empty();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'container1' used after it was
- // CHECK-MESSAGES: [[@LINE-4]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'container1' used after it was
+ // CHECK-NOTES: [[@LINE-4]]:5: note: move occurred here
}
}
@@ -912,8 +912,8 @@ void reinitAnnotation() {
AnnotatedContainer<int> obj;
std::move(obj);
obj.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'obj' used after it was
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'obj' used after it was
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
{
AnnotatedContainer<int> obj;
@@ -928,8 +928,8 @@ void reinitAnnotation() {
std::move(obj1);
obj2.clear();
obj1.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'obj1' used after it was
- // CHECK-MESSAGES: [[@LINE-4]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'obj1' used after it was
+ // CHECK-NOTES: [[@LINE-4]]:5: note: move occurred here
}
}
@@ -962,27 +962,27 @@ void sequencingOfMoveAndUse() {
{
A a;
passByValue(a.getInt(), std::move(a));
- // CHECK-MESSAGES: [[@LINE-1]]:17: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:29: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-3]]:17: note: the use and move are unsequenced
+ // CHECK-NOTES: [[@LINE-1]]:17: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:29: note: move occurred here
+ // CHECK-NOTES: [[@LINE-3]]:17: note: the use and move are unsequenced
}
{
A a;
passByValue(std::move(a), a.getInt());
- // CHECK-MESSAGES: [[@LINE-1]]:31: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:17: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-3]]:31: note: the use and move are unsequenced
+ // CHECK-NOTES: [[@LINE-1]]:31: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:17: note: move occurred here
+ // CHECK-NOTES: [[@LINE-3]]:31: note: the use and move are unsequenced
}
// An even more convoluted example.
{
A a;
g(g(a, std::move(a)), g(a, std::move(a)));
- // CHECK-MESSAGES: [[@LINE-1]]:9: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:27: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-3]]:9: note: the use and move are unsequenced
- // CHECK-MESSAGES: [[@LINE-4]]:29: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-5]]:7: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-6]]:29: note: the use and move are unsequenced
+ // CHECK-NOTES: [[@LINE-1]]:9: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:27: note: move occurred here
+ // CHECK-NOTES: [[@LINE-3]]:9: note: the use and move are unsequenced
+ // CHECK-NOTES: [[@LINE-4]]:29: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-5]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-6]]:29: note: the use and move are unsequenced
}
// This case is fine because the actual move only happens inside the call to
// operator=(). a.getInt(), by necessity, is evaluated before that call.
@@ -997,17 +997,17 @@ void sequencingOfMoveAndUse() {
A a;
int v[3];
v[a.getInt()] = intFromA(std::move(a));
- // CHECK-MESSAGES: [[@LINE-1]]:7: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:21: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-3]]:7: note: the use and move are unsequenced
+ // CHECK-NOTES: [[@LINE-1]]:7: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:21: note: move occurred here
+ // CHECK-NOTES: [[@LINE-3]]:7: note: the use and move are unsequenced
}
{
A a;
int v[3];
v[intFromA(std::move(a))] = intFromInt(a.i);
- // CHECK-MESSAGES: [[@LINE-1]]:44: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:7: note: move occurred here
- // CHECK-MESSAGES: [[@LINE-3]]:44: note: the use and move are unsequenced
+ // CHECK-NOTES: [[@LINE-1]]:44: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:7: note: move occurred here
+ // CHECK-NOTES: [[@LINE-3]]:44: note: the use and move are unsequenced
}
}
@@ -1023,15 +1023,15 @@ void sequencingOfMoveAndReinit() {
A a;
passByValue(std::move(a), (a = A()));
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:17: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:17: note: move occurred here
}
{
A a;
passByValue((a = A()), std::move(a));
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:28: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:28: note: move occurred here
}
// Common usage pattern: Move the object to a function that mutates it in some
// way, then reassign the result to the object. This pattern is fine.
@@ -1053,15 +1053,15 @@ void sequencingOfReinitAndUse() {
A a;
std::move(a);
passByValue(a.getInt(), (a = A()));
- // CHECK-MESSAGES: [[@LINE-1]]:17: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:17: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
{
A a;
std::move(a);
passByValue((a = A()), a.getInt());
- // CHECK-MESSAGES: [[@LINE-1]]:28: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:5: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:28: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:5: note: move occurred here
}
}
@@ -1077,8 +1077,8 @@ void commaOperatorSequences() {
A a;
(a = A()), A(std::move(a));
a.foo();
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-3]]:16: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:5: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-3]]:16: note: move occurred here
}
}
@@ -1099,8 +1099,8 @@ void initializerListSequences() {
};
A a;
S2 s2{std::move(a), a.getInt()};
- // CHECK-MESSAGES: [[@LINE-1]]:25: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:11: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:25: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:11: note: move occurred here
}
}
@@ -1114,8 +1114,8 @@ void declarationSequences() {
{
A a;
A a1 = std::move(a), a2 = a;
- // CHECK-MESSAGES: [[@LINE-1]]:31: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:12: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:31: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:12: note: move occurred here
}
}
@@ -1138,8 +1138,8 @@ void logicalOperatorsSequence() {
{
A a;
if (A(std::move(a)).getInt() > 0 && a.getInt() > 0) {
- // CHECK-MESSAGES: [[@LINE-1]]:41: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:9: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:41: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:9: note: move occurred here
A().foo();
}
}
@@ -1152,8 +1152,8 @@ void logicalOperatorsSequence() {
{
A a;
if (A(std::move(a)).getInt() > 0 || a.getInt() > 0) {
- // CHECK-MESSAGES: [[@LINE-1]]:41: warning: 'a' used after it was moved
- // CHECK-MESSAGES: [[@LINE-2]]:9: note: move occurred here
+ // CHECK-NOTES: [[@LINE-1]]:41: warning: 'a' used after it was moved
+ // CHECK-NOTES: [[@LINE-2]]:9: note: move occurred here
A().foo();
}
}
More information about the cfe-commits
mailing list