Re: Fix some misc-move-forwarding-reference warnings

2016-12-06 Thread Malcolm Parsons via cfe-commits
On 2 December 2016 at 17:13, Michael Sharpe via cfe-commits
 wrote:
> The attached patch fixes a couple of incorrect uses of std::move as revealed
> by clang-tidy.

LGTM.

Committed as r288813.

-- 
Malcolm Parsons
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Fix some misc-move-forwarding-reference warnings

2016-12-02 Thread Michael Sharpe via cfe-commits
Hello,

The attached patch fixes a couple of incorrect uses of std::move as
revealed by clang-tidy.

Best regards,

Michael Sharpe
diff --git lib/AST/Type.cpp lib/AST/Type.cpp
index d98d8d7..0d0cd2e 100644
--- lib/AST/Type.cpp
+++ lib/AST/Type.cpp
@@ -1050,24 +1050,24 @@ template
 QualType simpleTransform(ASTContext , QualType type, F &) {
   // Transform the type. If it changed, return the transformed result.
   QualType transformed = f(type);
   if (transformed.getAsOpaquePtr() != type.getAsOpaquePtr())
 return transformed;
 
   // Split out the qualifiers from the type.
   SplitQualType splitType = type.split();
 
   // Visit the type itself.
-  SimpleTransformVisitor visitor(ctx, std::move(f));
+  SimpleTransformVisitor visitor(ctx, std::forward(f));
   QualType result = visitor.Visit(splitType.Ty);
   if (result.isNull())
 return result;
 
   // Reconstruct the transformed type by applying the local qualifiers
   // from the split type.
   return ctx.getQualifiedType(result, splitType.Quals);
 }
 
 } // end anonymous namespace
 
 /// Substitute the given type arguments for Objective-C type
 /// parameters within the given type, recursively.
diff --git lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGBlocks.cpp
index 09911d4..50a6d61 100644
--- lib/CodeGen/CGBlocks.cpp
+++ lib/CodeGen/CGBlocks.cpp
@@ -1931,21 +1931,21 @@ template 
 static T *buildByrefHelpers(CodeGenModule , const BlockByrefInfo ,
 T &) {
   llvm::FoldingSetNodeID id;
   generator.Profile(id);
 
   void *insertPos;
   BlockByrefHelpers *node
 = CGM.ByrefHelpersCache.FindNodeOrInsertPos(id, insertPos);
   if (node) return static_cast(node);
 
   generator.CopyHelper = buildByrefCopyHelper(CGM, byrefInfo, generator);
   generator.DisposeHelper = buildByrefDisposeHelper(CGM, byrefInfo, generator);
 
-  T *copy = new (CGM.getContext()) T(std::move(generator));
+  T *copy = new (CGM.getContext()) T(std::forward(generator));
   CGM.ByrefHelpersCache.InsertNode(copy, insertPos);
   return copy;
 }
 
 /// Build the copy and dispose helpers for the given __block variable
 /// emission.  Places the helpers in the global cache.  Returns null
 /// if no helpers are required.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits