diff options
| author | Kostya Serebryany <kcc@google.com> | 2017-03-15 00:34:25 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2017-03-15 00:34:25 +0000 |
| commit | 862a845aa5815a52f5622b53300d5ddadf1e991a (patch) | |
| tree | 564482134cf12833f56dced599a7aa9a93ff9954 /llvm/lib | |
| parent | 10f54e39fa13be0e85819c69e8c049a08914738d (diff) | |
| download | bcm5719-llvm-862a845aa5815a52f5622b53300d5ddadf1e991a.tar.gz bcm5719-llvm-862a845aa5815a52f5622b53300d5ddadf1e991a.zip | |
[libFuzzer] simplify code a bit
llvm-svn: 297796
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Fuzzer/FuzzerInternal.h | 1 | ||||
| -rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 21 |
2 files changed, 2 insertions, 20 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h index 347228ebc42..3a3889723f7 100644 --- a/llvm/lib/Fuzzer/FuzzerInternal.h +++ b/llvm/lib/Fuzzer/FuzzerInternal.h @@ -110,7 +110,6 @@ private: // Stop tracing. void StopTraceRecording(); - void SetDeathCallback(); static void StaticDeathCallback(); void DumpCurrentUnit(const char *Prefix); void DeathCallback(); diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index bed28d84e6a..4f1755055c0 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -45,19 +45,6 @@ thread_local bool Fuzzer::IsMyThread; SharedMemoryRegion SMR; -static void MissingExternalApiFunction(const char *FnName) { - Printf("ERROR: %s is not defined. Exiting.\n" - "Did you use -fsanitize-coverage=... to build your code?\n", - FnName); - exit(1); -} - -#define CHECK_EXTERNAL_FUNCTION(fn) \ - do { \ - if (!(EF->fn)) \ - MissingExternalApiFunction(#fn); \ - } while (false) - // Only one Fuzzer per process. static Fuzzer *F; @@ -128,7 +115,8 @@ void Fuzzer::HandleMalloc(size_t Size) { Fuzzer::Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD, FuzzingOptions Options) : CB(CB), Corpus(Corpus), MD(MD), Options(Options) { - SetDeathCallback(); + if (EF->__sanitizer_set_death_callback) + EF->__sanitizer_set_death_callback(StaticDeathCallback); InitializeTraceState(); assert(!F); F = this; @@ -157,11 +145,6 @@ void Fuzzer::AllocateCurrentUnitData() { CurrentUnitData = new uint8_t[MaxInputLen]; } -void Fuzzer::SetDeathCallback() { - CHECK_EXTERNAL_FUNCTION(__sanitizer_set_death_callback); - EF->__sanitizer_set_death_callback(StaticDeathCallback); -} - void Fuzzer::StaticDeathCallback() { assert(F); F->DeathCallback(); |

