summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-11-13 01:54:40 +0000
committerKostya Serebryany <kcc@google.com>2015-11-13 01:54:40 +0000
commit2a48c24d77c6b5bd7d7f3ed52839a5cf2981dabf (patch)
tree944e1deb2fce3cdfd78d663e6d5cedf35a6201ab /llvm/lib/Fuzzer/FuzzerLoop.cpp
parenta87d0ae61b42e06e0b86ac114e3613a9976d2ca0 (diff)
downloadbcm5719-llvm-2a48c24d77c6b5bd7d7f3ed52839a5cf2981dabf.tar.gz
bcm5719-llvm-2a48c24d77c6b5bd7d7f3ed52839a5cf2981dabf.zip
[libFuzzer] make libFuzzer build even with a compiler that does not have sanitizer headers
llvm-svn: 253003
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 455aa625337..48c1b35dccb 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -10,12 +10,17 @@
//===----------------------------------------------------------------------===//
#include "FuzzerInternal.h"
-#include <sanitizer/coverage_interface.h>
#include <algorithm>
+#if defined(__has_include)
+# if __has_include(<sanitizer/coverage_interface.h>)
+# include <sanitizer/coverage_interface.h>
+# endif
+#endif
+
extern "C" {
// Re-declare some of the sanitizer functions as "weak" so that
-// libFuzzer can be linked w/o the sanitizers and sanitizer-coveragte
+// libFuzzer can be linked w/o the sanitizers and sanitizer-coverage
// (in which case it will complain at start-up time).
__attribute__((weak)) void __sanitizer_print_stack_trace();
__attribute__((weak)) void __sanitizer_reset_coverage();
OpenPOWER on IntegriCloud