Skip to content

[llvm][NFC] Remove redundant copy parameter #109859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

AmrDeveloper
Copy link
Member

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

@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2024

@llvm/pr-subscribers-llvm-support

Author: Amr Hesham (AmrDeveloper)

Changes

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 --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();

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@AmrDeveloper AmrDeveloper merged commit dd63ede into llvm:main Oct 15, 2024
11 checks passed
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
Remove redundant copy parameter and move it

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

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

Fixes: llvm#95640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

llvm/include/llvm/Support/Memory.h:140: Pointless copy ?
3 participants