[clang] 13faed8 - [clang][Interp][NFC] Use move ctor in moveArrayTy
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 2 20:45:17 PDT 2024
Author: Timm Bäder
Date: 2024-08-03T05:44:59+02:00
New Revision: 13faed8737b3021e59c3df6db3066876ce831dc9
URL: https://github.com/llvm/llvm-project/commit/13faed8737b3021e59c3df6db3066876ce831dc9
DIFF: https://github.com/llvm/llvm-project/commit/13faed8737b3021e59c3df6db3066876ce831dc9.diff
LOG: [clang][Interp][NFC] Use move ctor in moveArrayTy
Similar to what we did previously for primitive types, do it for
primitive arrays as well.
Added:
Modified:
clang/lib/AST/Interp/Descriptor.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Descriptor.cpp b/clang/lib/AST/Interp/Descriptor.cpp
index 671f2c03d7e5c..8becdca6f5c24 100644
--- a/clang/lib/AST/Interp/Descriptor.cpp
+++ b/clang/lib/AST/Interp/Descriptor.cpp
@@ -76,7 +76,7 @@ static void moveArrayTy(Block *, const std::byte *Src, std::byte *Dst,
Src += sizeof(InitMapPtr);
Dst += sizeof(InitMapPtr);
for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) {
- const auto *SrcPtr = &reinterpret_cast<const T *>(Src)[I];
+ auto *SrcPtr = &reinterpret_cast<T *>(const_cast<std::byte *>(Src))[I];
auto *DstPtr = &reinterpret_cast<T *>(Dst)[I];
new (DstPtr) T(std::move(*SrcPtr));
}
More information about the cfe-commits
mailing list