================
@@ -1201,6 +1202,10 @@ void CodeGenFunction::EmitNewArrayInitializer(
EmitCXXAggrConstructorCall(Ctor, NumElements, CurPtr, CCE,
/*NewPointerIsChecked*/ true,
CCE->requiresZeroInitialization());
+ if (getContext().classNeedsVectorDeletingDestructor(Ctor->getParent())) {
+ CXXDestructorDecl *Dtor = Ctor->getParent()->getDestructor();
+ CGM.EmitGlobal(GlobalDecl(Dtor, Dtor_VectorDeleting));
----------------
Fznamznon wrote:
I would be happy to use `addDeferredDeclToEmit` directly but it is a private
member of CGM. Does that make sense to make it public so it is accessible from
CGF?
What I'm trying to do here is to add a deferred decl to emit for a vector
deleting destructor if we just emitted a new[]. It is required because
currently all deleting destructors (including vector and scalar) are emitted
during emission of vtable. If constructor of the class is defined in another
translation unit, no vtable will be emitted and no deleting destructors either.
I actually noticed that even if I define destructor but not the constructor,
call new[], no vector deleting destructor will be emitted by clang and this
also seems wrong https://godbolt.org/z/5Y4vzsWEj. We just need a separate path
for all vector deleting destructors that doesn't depend on the vtable.
https://github.com/llvm/llvm-project/pull/185653
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits