[llvm] 3b5c6bf - [Support] Use std::move in AllocatorHolder's move constructor (NFC) (#160444)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 24 08:44:35 PDT 2025
Author: Kazu Hirata
Date: 2025-09-24T08:44:30-07:00
New Revision: 3b5c6bfc6abbc8c11f386a68f66eceafc3bb786c
URL: https://github.com/llvm/llvm-project/commit/3b5c6bfc6abbc8c11f386a68f66eceafc3bb786c
DIFF: https://github.com/llvm/llvm-project/commit/3b5c6bfc6abbc8c11f386a68f66eceafc3bb786c.diff
LOG: [Support] Use std::move in AllocatorHolder's move constructor (NFC) (#160444)
std::move is more idiomatic and readable than the equivalent
static_cast.
Added:
Modified:
llvm/include/llvm/Support/AllocatorBase.h
Removed:
################################################################################
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; }
};
More information about the llvm-commits
mailing list