Skip to content

Conversation

kazutakahirata
Copy link
Contributor

std::move is more idiomatic and readable than the equivalent
static_cast.

std::move is more idiomatic and readable than the equivalent
static_cast.
@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2025

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

Changes

std::move is more idiomatic and readable than the equivalent
static_cast.


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

1 Files Affected:

  • (modified) llvm/include/llvm/Support/AllocatorBase.h (+1-1)
diff --git a/llvm/include/llvm/Support/AllocatorBase.h b/llvm/include/llvm/Support/AllocatorBase.h
index 0442432250069..3cfc4425bd406 100644
--- a/llvm/include/llvm/Support/AllocatorBase.h
+++ b/llvm/include/llvm/Support/AllocatorBase.h
@@ -111,7 +111,7 @@ template <typename Alloc> class AllocatorHolder : Alloc {
 public:
   AllocatorHolder() = default;
   AllocatorHolder(const Alloc &A) : Alloc(A) {}
-  AllocatorHolder(Alloc &&A) : Alloc(static_cast<Alloc &&>(A)) {}
+  AllocatorHolder(Alloc &&A) : Alloc(std::move(A)) {}
   Alloc &getAllocator() { return *this; }
   const Alloc &getAllocator() const { return *this; }
 };

@kazutakahirata kazutakahirata merged commit 3b5c6bf into llvm:main Sep 24, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250923_ADT_AllocatorBase branch September 24, 2025 15:44
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
…lvm#160444)

std::move is more idiomatic and readable than the equivalent
static_cast.
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.

4 participants