Author: Timm Bäder Date: 2024-06-25T18:32:12+02:00 New Revision: 580343d96f18e3c2fa8d7a8e25a175aaa2e20522
URL: https://github.com/llvm/llvm-project/commit/580343d96f18e3c2fa8d7a8e25a175aaa2e20522 DIFF: https://github.com/llvm/llvm-project/commit/580343d96f18e3c2fa8d7a8e25a175aaa2e20522.diff LOG: [clang][Interp][NFC] Destroy InitMap when moving contents to DeadBlock 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 fcb778f7aeab0..fea8a7b1d14a9 100644 --- a/clang/lib/AST/Interp/Descriptor.cpp +++ b/clang/lib/AST/Interp/Descriptor.cpp @@ -64,7 +64,14 @@ static void dtorArrayTy(Block *, std::byte *Ptr, const Descriptor *D) { template <typename T> static void moveArrayTy(Block *, const std::byte *Src, std::byte *Dst, const Descriptor *D) { - // FIXME: Need to copy the InitMap? + // FIXME: Get rid of the const_cast. + InitMapPtr &SrcIMP = + *reinterpret_cast<InitMapPtr *>(const_cast<std::byte *>(Src)); + if (SrcIMP) { + // We only ever invoke the moveFunc when moving block contents to a + // DeadBlock. DeadBlocks don't need InitMaps, so we destroy them here. + SrcIMP = std::nullopt; + } Src += sizeof(InitMapPtr); Dst += sizeof(InitMapPtr); for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits