aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/ErrorHandling.cpp
diff options
context:
space:
mode:
authorMehdi Amini <joker.eph@gmail.com>2020-08-21 04:25:57 +0000
committerMehdi Amini <joker.eph@gmail.com>2020-08-21 06:13:00 +0000
commit927da43ade12fffc8077c248e0243711071b2094 (patch)
tree98180dcf43b302cf5319308e12713ae0bba3e9e4 /llvm/lib/Support/ErrorHandling.cpp
parent6ad3de350c462399a02adccab7fc70de8ecd6224 (diff)
downloadllvm-927da43ade12fffc8077c248e0243711071b2094.zip
llvm-927da43ade12fffc8077c248e0243711071b2094.tar.gz
llvm-927da43ade12fffc8077c248e0243711071b2094.tar.bz2
Allow multiple calls to InitLLVM() (NFC)
In e99dee82b0, the "out_of_memory_new_handler" was changed to be explicitly initialized instead of relying on a global static constructor. However before this change, install_out_of_memory_new_handler could be called multiple times while it asserts right now. We can be more tolerant to calling multiple time InitLLVM without reintroducing a global constructor for this handler. Differential Revision: https://reviews.llvm.org/D86330
Diffstat (limited to 'llvm/lib/Support/ErrorHandling.cpp')
-rw-r--r--llvm/lib/Support/ErrorHandling.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp
index f70a692..e962657 100644
--- a/llvm/lib/Support/ErrorHandling.cpp
+++ b/llvm/lib/Support/ErrorHandling.cpp
@@ -192,7 +192,8 @@ static void out_of_memory_new_handler() {
void llvm::install_out_of_memory_new_handler() {
std::new_handler old = std::set_new_handler(out_of_memory_new_handler);
(void)old;
- assert(old == nullptr && "new-handler already installed");
+ assert((old == nullptr || old == out_of_memory_new_handler) &&
+ "new-handler already installed");
}
#endif