summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc
diff options
context:
space:
mode:
authorAlex Shlyapnikov <alekseys@google.com>2017-06-28 21:58:57 +0000
committerAlex Shlyapnikov <alekseys@google.com>2017-06-28 21:58:57 +0000
commit4b450685d3364db59dc58f5b10aa53ecf2126e1b (patch)
treebcf0808b3c032aaaaaece7233a343a2384d120e1 /compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc
parent7c525903efd25646f3d4d8f3888d9ed8b49ad843 (diff)
downloadbcm5719-llvm-4b450685d3364db59dc58f5b10aa53ecf2126e1b.tar.gz
bcm5719-llvm-4b450685d3364db59dc58f5b10aa53ecf2126e1b.zip
[Sanitizers] Operator new() interceptors always die on allocation error
Summary: Operator new interceptors behavior is now controlled by their nothrow property as well as by allocator_may_return_null flag value: - allocator_may_return_null=* + new() - die on allocation error - allocator_may_return_null=0 + new(nothrow) - die on allocation error - allocator_may_return_null=1 + new(nothrow) - return null Ideally new() should throw std::bad_alloc exception, but that is not trivial to achieve, hence TODO. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34731 llvm-svn: 306604
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc
index db3ebb0336a..e081cc576ad 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc
@@ -246,11 +246,11 @@ void *ReturnNullOrDieOnFailure::OnOOM() {
ReportAllocatorCannotReturnNull();
}
-void *DieOnFailure::OnBadRequest() {
+void NORETURN *DieOnFailure::OnBadRequest() {
ReportAllocatorCannotReturnNull();
}
-void *DieOnFailure::OnOOM() {
+void NORETURN *DieOnFailure::OnOOM() {
atomic_store_relaxed(&allocator_out_of_memory, 1);
ReportAllocatorCannotReturnNull();
}
OpenPOWER on IntegriCloud