[llvm] [llvm][NFC] Remove redundant copy parameter (PR #109859)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 13:31:15 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Amr Hesham (AmrDeveloper)

<details>
<summary>Changes</summary>

Remove redundant copy parameter and move it

from `explicit OwningMemoryBlock(MemoryBlock M) : M(M) {}`

to `explicit OwningMemoryBlock(MemoryBlock M) : M(std::move(m)) {}`

Fixes: #<!-- -->95640

---
Full diff: https://github.com/llvm/llvm-project/pull/109859.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/Memory.h (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index d7d60371d315f0..c02a3cc14dc7de 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -137,7 +137,7 @@ namespace sys {
   class OwningMemoryBlock {
   public:
     OwningMemoryBlock() = default;
-    explicit OwningMemoryBlock(MemoryBlock M) : M(M) {}
+    explicit OwningMemoryBlock(MemoryBlock M) : M(std::move(M)) {}
     OwningMemoryBlock(OwningMemoryBlock &&Other) {
       M = Other.M;
       Other.M = MemoryBlock();

``````````

</details>


https://github.com/llvm/llvm-project/pull/109859


More information about the llvm-commits mailing list