r197428 - Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::move
Jordan Rose
jordan_rose at apple.com
Mon Dec 16 13:49:29 PST 2013
getQualifiedNameAsString is pretty expensive. Moreover, won't this fail if libc++ puts std::move in std::__1::move?
Jordan
On Dec 16, 2013, at 13:41, Richard Trieu <rtrieu at google.com> wrote:
> 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
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list