[llvm] [Support] Use std::move in AllocatorHolder's move constructor (NFC) (PR #160444)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 22:58:43 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

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
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; }
 };

``````````

</details>


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


More information about the llvm-commits mailing list