summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerDFSan.h
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/FuzzerDFSan.h
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/FuzzerDFSan.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerDFSan.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerDFSan.h b/llvm/lib/Fuzzer/FuzzerDFSan.h
index 6398575e695..eb206ec61ce 100644
--- a/llvm/lib/Fuzzer/FuzzerDFSan.h
+++ b/llvm/lib/Fuzzer/FuzzerDFSan.h
@@ -12,15 +12,17 @@
#ifndef LLVM_FUZZER_DFSAN_H
#define LLVM_FUZZER_DFSAN_H
-#ifndef LLVM_FUZZER_SUPPORTS_DFSAN
-# if defined(__linux__)
-# define LLVM_FUZZER_SUPPORTS_DFSAN 1
-# else
-# define LLVM_FUZZER_SUPPORTS_DFSAN 0
-# endif // __linux__
-#endif // LLVM_FUZZER_SUPPORTS_DFSAN
+#define LLVM_FUZZER_SUPPORTS_DFSAN 0
+#if defined(__has_include)
+# if __has_include(<sanitizer/dfsan_interface.h>)
+# if defined (__linux__)
+# undef LLVM_FUZZER_SUPPORTS_DFSAN
+# define LLVM_FUZZER_SUPPORTS_DFSAN 1
+# include <sanitizer/dfsan_interface.h>
+# endif // __linux__
+# endif
+#endif // defined(__has_include)
-#include <sanitizer/dfsan_interface.h>
#if LLVM_FUZZER_SUPPORTS_DFSAN
extern "C" {
@@ -42,6 +44,14 @@ static bool ReallyHaveDFSan() {
}
} // namespace fuzzer
#else
+// When compiling with a compiler which does not support dfsan,
+// this code is still expected to build (but not necessary work).
+typedef unsigned short dfsan_label;
+struct dfsan_label_info {
+ dfsan_label l1, l2;
+ const char *desc;
+ void *userdata;
+};
namespace fuzzer {
static bool ReallyHaveDFSan() { return false; }
} // namespace fuzzer
OpenPOWER on IntegriCloud