diff options
author | Timm Bäder <tbaeder@redhat.com> | 2024-06-25 17:03:49 +0200 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2024-06-25 18:32:12 +0200 |
commit | 580343d96f18e3c2fa8d7a8e25a175aaa2e20522 (patch) | |
tree | 1bc091425391211c072d1b14b24e62b7210869f0 | |
parent | ac1e22f3053f761e4e2ef832b92de15876e68335 (diff) | |
download | llvm-580343d96f18e3c2fa8d7a8e25a175aaa2e20522.zip llvm-580343d96f18e3c2fa8d7a8e25a175aaa2e20522.tar.gz llvm-580343d96f18e3c2fa8d7a8e25a175aaa2e20522.tar.bz2 |
[clang][Interp][NFC] Destroy InitMap when moving contents to DeadBlock
-rw-r--r-- | clang/lib/AST/Interp/Descriptor.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/Interp/Descriptor.cpp b/clang/lib/AST/Interp/Descriptor.cpp index fcb778f..fea8a7b 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) { |