diff options
| author | Alex Shlyapnikov <alekseys@google.com> | 2018-06-20 17:10:33 +0000 |
|---|---|---|
| committer | Alex Shlyapnikov <alekseys@google.com> | 2018-06-20 17:10:33 +0000 |
| commit | 7e067ab1afec1984e8c9d663a333d145f66c2adf (patch) | |
| tree | e6eaeb781b743cd9851596dab7cfbd08cb1c4a0a /compiler-rt/lib/sanitizer_common/sanitizer_allocator.h | |
| parent | 8e3e374e5f72d7a89a0903b0d1c8fbd18b2b8f9d (diff) | |
| download | bcm5719-llvm-7e067ab1afec1984e8c9d663a333d145f66c2adf.tar.gz bcm5719-llvm-7e067ab1afec1984e8c9d663a333d145f66c2adf.zip | |
[Sanitizers] Remove OOM/BadRequest allocator error handling policies.
Summary:
Remove the generic error nadling policies and handle each allocator error
explicitly. Although more verbose, it allows for more comprehensive, precise
and actionable allocator related failure reports.
This finishes up the series of changes of the particular sanitizer
allocators, improves the internal allocator error reporting and removes
now unused policies.
Reviewers: vitalybuka, cryptoad
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D48328
llvm-svn: 335147
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.h')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_allocator.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h index 0036f80a257..9655a2264f3 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h @@ -34,26 +34,14 @@ extern const char *SecondaryAllocatorName; bool AllocatorMayReturnNull(); void SetAllocatorMayReturnNull(bool may_return_null); -// Allocator failure handling policies: -// Implements AllocatorMayReturnNull policy, returns null when the flag is set, -// dies otherwise. -struct ReturnNullOrDieOnFailure { - static void *OnBadRequest(); - static void *OnOOM(); -}; -// Always dies on the failure. -struct DieOnFailure { - static void NORETURN *OnBadRequest(); - static void NORETURN *OnOOM(); -}; - -void PrintHintAllocatorCannotReturnNull(const char *options_name); - // Returns true if allocator detected OOM condition. Can be used to avoid memory -// hungry operations. Set when AllocatorReturnNullOrDieOnOOM() is called. +// hungry operations. bool IsAllocatorOutOfMemory(); +// Should be called by a particular allocator when OOM is detected. void SetAllocatorOutOfMemory(); +void PrintHintAllocatorCannotReturnNull(); + // Allocators call these callbacks on mmap/munmap. struct NoOpMapUnmapCallback { void OnMap(uptr p, uptr size) const { } |

