[llvm] c6bce68 - [NFC] [Coroutines] Use std::move to avoid copying (#116776)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 21:47:21 PST 2024


Author: abhishek-kaushik22
Date: 2024-11-20T13:47:18+08:00
New Revision: c6bce68f9a357d13b4ad85a1a0b74ce4ee768885

URL: https://github.com/llvm/llvm-project/commit/c6bce68f9a357d13b4ad85a1a0b74ce4ee768885
DIFF: https://github.com/llvm/llvm-project/commit/c6bce68f9a357d13b4ad85a1a0b74ce4ee768885.diff

LOG: [NFC] [Coroutines] Use std::move to avoid copying (#116776)

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Coroutines/ABI.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Coroutines/ABI.h b/llvm/include/llvm/Transforms/Coroutines/ABI.h
index 8b83c5308056eb..0b2d405f3caec4 100644
--- a/llvm/include/llvm/Transforms/Coroutines/ABI.h
+++ b/llvm/include/llvm/Transforms/Coroutines/ABI.h
@@ -41,7 +41,7 @@ class BaseABI {
 public:
   BaseABI(Function &F, coro::Shape &S,
           std::function<bool(Instruction &)> IsMaterializable)
-      : F(F), Shape(S), IsMaterializable(IsMaterializable) {}
+      : F(F), Shape(S), IsMaterializable(std::move(IsMaterializable)) {}
   virtual ~BaseABI() = default;
 
   // Initialize the coroutine ABI
@@ -67,7 +67,7 @@ class SwitchABI : public BaseABI {
 public:
   SwitchABI(Function &F, coro::Shape &S,
             std::function<bool(Instruction &)> IsMaterializable)
-      : BaseABI(F, S, IsMaterializable) {}
+      : BaseABI(F, S, std::move(IsMaterializable)) {}
 
   void init() override;
 
@@ -80,7 +80,7 @@ class AsyncABI : public BaseABI {
 public:
   AsyncABI(Function &F, coro::Shape &S,
            std::function<bool(Instruction &)> IsMaterializable)
-      : BaseABI(F, S, IsMaterializable) {}
+      : BaseABI(F, S, std::move(IsMaterializable)) {}
 
   void init() override;
 
@@ -93,7 +93,7 @@ class AnyRetconABI : public BaseABI {
 public:
   AnyRetconABI(Function &F, coro::Shape &S,
                std::function<bool(Instruction &)> IsMaterializable)
-      : BaseABI(F, S, IsMaterializable) {}
+      : BaseABI(F, S, std::move(IsMaterializable)) {}
 
   void init() override;
 


        


More information about the llvm-commits mailing list