[swift-dev] No return functions and program exit
mgottesman at apple.com
Mon Feb 6 11:48:52 CST 2017
One thing that is an issue that has come up with ownership is that at the SIL level we do not distinguish in between exceptional noreturn functions and exceptional return functions.
This is important since in the non-exceptional case, we would like to clean up all of the values used in the current function before calling the no-return function. An example of such a function is dispatch_main from libdispatch. In the exceptional case though, we are ok with leaking since the program will be exiting. Beyond reducing code size (I guess?), the argument I have heard for this is that this will allow for people to examine values in the debugger since we will not have cleaned things up before the abort is called.
>From what I can tell, if we are going to distinguish in between these cases, then we need a distinction in between the two baked into the compiler. Thoughts? I have code written that will enable either case to be handled as long as I can distinguish in between them at the SIL level.
More information about the swift-dev