r197428 - Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::move
Richard Trieu
rtrieu at google.com
Mon Dec 16 13:41:30 PST 2013
Author: rtrieu
Date: Mon Dec 16 15:41:30 2013
New Revision: 197428
URL: http://llvm.org/viewvc/llvm-project?rev=197428&view=rev
Log:
Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::move
Modified:
cfe/trunk/lib/Analysis/Consumed.cpp
cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp
Modified: cfe/trunk/lib/Analysis/Consumed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/Consumed.cpp?rev=197428&r1=197427&r2=197428&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/Consumed.cpp (original)
+++ cfe/trunk/lib/Analysis/Consumed.cpp Mon Dec 16 15:41:30 2013
@@ -611,7 +611,8 @@ void ConsumedStmtVisitor::VisitCallExpr(
// Special case for the std::move function.
// TODO: Make this more specific. (Deferred)
- if (FunDecl->getNameAsString() == "move") {
+ if (FunDecl->getQualifiedNameAsString() == "std::move" &&
+ Call->getNumArgs() == 1) {
forwardInfo(Call->getArg(0), Call);
return;
}
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=197428&r1=197427&r2=197428&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp Mon Dec 16 15:41:30 2013
@@ -793,3 +793,22 @@ void testTemporariesAndOperators2() {
} // end namespace InitializerAssertionFailTest
+
+namespace std {
+ void move();
+ template<class T>
+ void move(T&&);
+}
+
+namespace PR18260 {
+ class X {
+ public:
+ void move();
+ } x;
+
+ void test() {
+ x.move();
+ std::move();
+ std::move(x);
+ }
+} // end namespace PR18260
More information about the cfe-commits
mailing list