[PATCH] D48104: [lld] add ability to register exit handlers

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 07:20:56 PDT 2018


sbc100 added inline comments.


================
Comment at: lld/Common/Exit.cpp:27
+namespace {
+SmallVector<std::function<void()>, 4> ExitHandlers;
+} // anonymous namespace
----------------
Maybe just to `static` instead of anon namespace here.  This is what we do for freestanding functions.


================
Comment at: lld/Common/Exit.cpp:50
+  _exit(Val);
+}
+} // namespace lld
----------------
I think the convention is not to wrap the whole .cpp file in namespace but to explicitly add it to each function impl.


================
Comment at: lld/include/lld/Common/Exit.h:29
+/// Functions are called in reverse order of registration.
+void addLldExitHandler(std::function<void()> &&Handler);
+
----------------
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.   


https://reviews.llvm.org/D48104





More information about the llvm-commits mailing list