diff options
| author | Zequan Wu <zequanwu@google.com> | 2025-11-21 17:14:34 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-21 17:14:34 -0800 |
| commit | 54a4da9df6906b63878ad6d0ea6da3ed7d2d8432 (patch) | |
| tree | 26d9fa3d54fbec6de66f26ee732881245563f336 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | 58e2dde45f775328b71b532e65762a9696ccccbd (diff) | |
Revert "Reland [MS][clang] Add support for vector deleting destructors" (#169116)
This reverts 4d10c1165442cbbbc0017b48fcdd7dae1ccf3678 and its two
dependent commits: e6b9805b574bb5c90263ec7fbcb94df76d2807a4 and
c243406a695ca056a07ef4064b0f9feee7685320, see discussion in
https://github.com/llvm/llvm-project/pull/165598#issuecomment-3563825509.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4bd3e4f8c02c..645b78a599f8 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -8288,53 +8288,3 @@ void CodeGenModule::moveLazyEmissionStates(CodeGenModule *NewBuilder) { NewBuilder->ABI->MangleCtx = std::move(ABI->MangleCtx); } - -bool CodeGenModule::classNeedsVectorDestructor(const CXXRecordDecl *RD) { - if (!Context.getTargetInfo().emitVectorDeletingDtors(Context.getLangOpts())) - return false; - CXXDestructorDecl *Dtor = RD->getDestructor(); - // The compiler can't know if new[]/delete[] will be used outside of the DLL, - // so just force vector deleting destructor emission if dllexport is present. - // This matches MSVC behavior. - if (Dtor && Dtor->isVirtual() && Dtor->isDefined() && - Dtor->hasAttr<DLLExportAttr>()) - return true; - - return RequireVectorDeletingDtor.count(RD); -} - -void CodeGenModule::requireVectorDestructorDefinition(const CXXRecordDecl *RD) { - if (!Context.getTargetInfo().emitVectorDeletingDtors(Context.getLangOpts())) - return; - RequireVectorDeletingDtor.insert(RD); - - // To reduce code size in general case we lazily emit scalar deleting - // destructor definition and an alias from vector deleting destructor to - // scalar deleting destructor. It may happen that we first emitted the scalar - // deleting destructor definition and the alias and then discovered that the - // definition of the vector deleting destructor is required. Then we need to - // remove the alias and the scalar deleting destructor and queue vector - // deleting destructor body for emission. Check if that is the case. - CXXDestructorDecl *DtorD = RD->getDestructor(); - GlobalDecl ScalarDtorGD(DtorD, Dtor_Deleting); - StringRef MangledName = getMangledName(ScalarDtorGD); - llvm::GlobalValue *Entry = GetGlobalValue(MangledName); - if (Entry && !Entry->isDeclaration()) { - GlobalDecl VectorDtorGD(DtorD, Dtor_VectorDeleting); - StringRef VDName = getMangledName(VectorDtorGD); - llvm::GlobalValue *VDEntry = GetGlobalValue(VDName); - // It exists and it should be an alias. - assert(VDEntry && isa<llvm::GlobalAlias>(VDEntry)); - auto *NewFn = llvm::Function::Create( - cast<llvm::FunctionType>(VDEntry->getValueType()), - llvm::Function::ExternalLinkage, VDName, &getModule()); - SetFunctionAttributes(VectorDtorGD, NewFn, /*IsIncompleteFunction*/ false, - /*IsThunk*/ false); - NewFn->takeName(VDEntry); - VDEntry->replaceAllUsesWith(NewFn); - VDEntry->eraseFromParent(); - Entry->replaceAllUsesWith(NewFn); - Entry->eraseFromParent(); - addDeferredDeclToEmit(VectorDtorGD); - } -} |
