[PATCH] D64505: [Support] Move the static initializer install_out_memory_new_handler to InitLLVM

JF Bastien via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 15:44:01 PDT 2019


jfb added a comment.

In D64505#1579335 <https://reviews.llvm.org/D64505#1579335>, @rnk wrote:

> In D64505#1578699 <https://reviews.llvm.org/D64505#1578699>, @jfb wrote:
>
> > Does it make sense to reset any previous handler in `llvm_shutdown`?
>
>
> Doing so would require saving the current handler somewhere, if one exists.


That's easy.

> InitLLVM really only works if you call it in main at the start of the program (see how it rewrites argv). If a user wants to initialize LLVM as a library and then shut it down, I would expect the user to avoid InitLLVM and instead use llvm_shutdown directly. With this change, they won't get LLVM's OOM handler, but that seems desirable. It's easy for them to set their own to one that is equivalent to LLVM's if desired.

So you're saying: maybe it's a bug if we install one but there was already one installed?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64505/new/

https://reviews.llvm.org/D64505





More information about the llvm-commits mailing list