r197428 - Fix PR18260 - Make std::move handling in -Wconsumed only trigger on std::move
Richard Trieu
rtrieu at google.com
Mon Dec 16 14:07:10 PST 2013
Is there a more canonical way to detect that the function is std::move
instead of another move function? This would fail to recognize
std::__1::move.
On Mon, Dec 16, 2013 at 1:49 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131216/43b4892b/attachment.html>
More information about the cfe-commits
mailing list