]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/scudo/scudo_termination.cpp
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / scudo / scudo_termination.cpp
1 //===-- scudo_termination.cpp -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// This file contains bare-bones termination functions to replace the
11 /// __sanitizer ones, in order to avoid any potential abuse of the callbacks
12 /// functionality.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #include "scudo_utils.h"
17
18 #include "sanitizer_common/sanitizer_common.h"
19
20 namespace __sanitizer {
21
22 bool AddDieCallback(DieCallbackType Callback) { return true; }
23
24 bool RemoveDieCallback(DieCallbackType Callback) { return true; }
25
26 void SetUserDieCallback(DieCallbackType Callback) {}
27
28 void NORETURN Die() {
29   if (common_flags()->abort_on_error)
30     Abort();
31   internal__exit(common_flags()->exitcode);
32 }
33
34 void SetCheckFailedCallback(CheckFailedCallbackType callback) {}
35
36 void NORETURN CheckFailed(const char *File, int Line, const char *Condition,
37                           u64 Value1, u64 Value2) {
38   __scudo::dieWithMessage("CHECK failed at %s:%d %s (%lld, %lld)\n",
39                           File, Line, Condition, Value1, Value2);
40 }
41
42 }  // namespace __sanitizer