This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Add public function to emit C++ destructor call.
ClosedPublic

Authored by zoecarver on Jun 23 2020, 9:48 AM.

Details

Summary

Adds CodeGen::emitCXXDestructorCall, a function that creates a CodeGenFunction using the arguments provided, then invokes CodeGenFunction::EmitCXXDestructorCall.

This will allow other frontends (Swift, for example) to easily emit calls to object destructors with correct ABI semantics and calling convetions.

This is needed for Swift C++ interop. Here's the corresponding Swift change: https://github.com/apple/swift/pull/32291

Diff Detail

Event Timeline

zoecarver created this revision.Jun 23 2020, 9:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2020, 9:48 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Can we do a design more like what we did with constructors?

zoecarver updated this revision to Diff 274616.Jun 30 2020, 2:32 PM
  • Remove emitCXXDestructorCall and add getCXXDestructorImplicitParam.

@rjmccall I updated this patch to introduce the function getCXXDestructorImplicitParam instead. This should be closer to D79942. It seems like there is never more than one implicit parameter so, I just have it return a single llvm::Value*.

This revision is now accepted and ready to land.Jul 1 2020, 10:43 AM
This revision was automatically updated to reflect the committed changes.