This is an archive of the discontinued LLVM Phabricator instance.

[lld] add ability to register exit handlers
AbandonedPublic

Authored by inglorion on Jun 12 2018, 3:50 PM.

Details

Summary

We have an exitLld() function that can be used to exit lld without
running the normal atexit() handlers, destructors, etc. In some cases,
there is still some code we need to run when lld exits. This patch
adds an addLldExitHandler() function which allows the registration
of handlers which will be run by exitLld(). It also moves exitLld()
into its own file.

Event Timeline

inglorion created this revision.Jun 12 2018, 3:50 PM
sbc100 added inline comments.Jun 13 2018, 7:20 AM
lld/Common/Exit.cpp
27

Maybe just to static instead of anon namespace here. This is what we do for freestanding functions.

50

I think the convention is not to wrap the whole .cpp file in namespace but to explicitly add it to each function impl.

lld/include/lld/Common/Exit.h
29

Seems a little strange to have lld in the function name here. I think lld::addExitHandler would be cleaner, but I can see you are following the convention of exitLld.

Thanks for your suggestions, sbc. Those would be good to implement if we wanted the feature. However, we decided against the feature that depends on this, so I'll be abandoning this diff.

inglorion abandoned this revision.Jun 13 2018, 2:53 PM

We decided against shipping the feature that depends on this. Given that, I'd rather not have this code. Abandoning the diff.