diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 | 
| commit | 54db30ce18663e6c2991958f3b5d18362e8e93c4 (patch) | |
| tree | 4aa6442802570767398cc83ba484e97b1309bdc2 /contrib/llvm/lib/Support/ErrorHandling.cpp | |
| parent | 35284c22e9c8348159b7ce032ea45f2cdeb65298 (diff) | |
| parent | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Support/ErrorHandling.cpp')
| -rw-r--r-- | contrib/llvm/lib/Support/ErrorHandling.cpp | 29 | 
1 files changed, 8 insertions, 21 deletions
| diff --git a/contrib/llvm/lib/Support/ErrorHandling.cpp b/contrib/llvm/lib/Support/ErrorHandling.cpp index 21712c5c039e..0f13f7a536f1 100644 --- a/contrib/llvm/lib/Support/ErrorHandling.cpp +++ b/contrib/llvm/lib/Support/ErrorHandling.cpp @@ -1,9 +1,8 @@  //===- lib/Support/ErrorHandling.cpp - Callbacks for errors ---------------===//  // -//                     The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception  //  //===----------------------------------------------------------------------===//  // @@ -187,25 +186,13 @@ static void out_of_memory_new_handler() {    llvm::report_bad_alloc_error("Allocation failed");  } -// Installs new handler that causes crash on allocation failure. It does not -// need to be called explicitly, if this file is linked to application, because -// in this case it is called during construction of 'new_handler_installer'. +// Installs new handler that causes crash on allocation failure. It is called by +// InitLLVM.  void llvm::install_out_of_memory_new_handler() { -  static bool out_of_memory_new_handler_installed = false; -  if (!out_of_memory_new_handler_installed) { -    std::set_new_handler(out_of_memory_new_handler); -    out_of_memory_new_handler_installed = true; -  } +  std::new_handler old = std::set_new_handler(out_of_memory_new_handler); +  (void)old; +  assert(old == nullptr && "new-handler already installed");  } - -// Static object that causes installation of 'out_of_memory_new_handler' before -// execution of 'main'. -static class NewHandlerInstaller { -public: -  NewHandlerInstaller() { -    install_out_of_memory_new_handler(); -  } -} new_handler_installer;  #endif  void llvm::llvm_unreachable_internal(const char *msg, const char *file, | 
