diff options
author | Mariya Podchishchaeva <mariya.podchishchaeva@intel.com> | 2025-03-04 09:17:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-04 09:17:50 +0100 |
commit | d6942d54f677000cf713d2b0eba57b641452beb4 (patch) | |
tree | 5a1e1e7a9748b14506f2fe03136fa604381b5916 /clang/lib/CodeGen/CGVTables.cpp | |
parent | a619a2e53a9ba09ba18a047b8389bf4dd1912b72 (diff) | |
download | llvm-d6942d54f677000cf713d2b0eba57b641452beb4.zip llvm-d6942d54f677000cf713d2b0eba57b641452beb4.tar.gz llvm-d6942d54f677000cf713d2b0eba57b641452beb4.tar.bz2 |
[MS][clang] Add support for vector deleting destructors (#126240)
Whereas it is UB in terms of the standard to delete an array of objects
via pointer whose static type doesn't match its dynamic type, MSVC
supports an extension allowing to do it.
Aside from array deletion not working correctly in the mentioned case,
currently not having this extension implemented causes clang to generate
code that is not compatible with the code generated by MSVC, because
clang always puts scalar deleting destructor to the vftable. This PR
aims to resolve these problems.
Fixes https://github.com/llvm/llvm-project/issues/19772
Diffstat (limited to 'clang/lib/CodeGen/CGVTables.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGVTables.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index c910893..66d75ef 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -769,7 +769,8 @@ void CodeGenVTables::addVTableComponent(ConstantArrayBuilder &builder, case VTableComponent::CK_FunctionPointer: case VTableComponent::CK_CompleteDtorPointer: case VTableComponent::CK_DeletingDtorPointer: { - GlobalDecl GD = component.getGlobalDecl(); + GlobalDecl GD = + component.getGlobalDecl(CGM.getCXXABI().hasVectorDeletingDtors()); const bool IsThunk = nextVTableThunkIndex < layout.vtable_thunks().size() && |