llvm-project
c74f833f - [CIR] Implement cleanup for array delete with throwing dtor (#194965)

Commit
30 days ago
[CIR] Implement cleanup for array delete with throwing dtor (#194965) This implements cleanup handling to perform partial array destruction in the case where an exception is thrown while we are calling destructors for an array delete expression. When an exception occurs, we attempt to continuing destructing the rest of the array. If a second exception is thrown, we terminate the process, but if only one exception is thrown we will complete the array element destruction and then call operator delete. This matches the behavior of classic codegen. As part of this implementation, I had to move the array delete operator call to a cleanup handler in order to ensure that it was called both in the normal case (when no exception is thrown) and in the case where an exception is thrown but the partial cleanup completes successfully. This required updating one existing test. In the case where exception are not enabled, we still call the array delete operator from a cleanup handler, but the cleanup executes unconditionally in the non-exception control flow. Assisted-by: Cursor / claude-opus-4.7-thinking-xhigh
Author
Parents
Loading