[fuzzer] move default sanitizer options to a separate file
authorKostya Serebryany <kcc@google.com>
Fri, 6 Feb 2015 19:52:07 +0000 (19:52 +0000)
committerKostya Serebryany <kcc@google.com>
Fri, 6 Feb 2015 19:52:07 +0000 (19:52 +0000)
llvm-svn: 228429

llvm/lib/Fuzzer/CMakeLists.txt
llvm/lib/Fuzzer/FuzzerMain.cpp
llvm/lib/Fuzzer/FuzzerSanitizerOptions.cpp [new file with mode: 0644]

index a68df7f..02370c9 100644 (file)
@@ -6,6 +6,7 @@ if( LLVM_USE_SANITIZE_COVERAGE  )
     FuzzerIO.cpp
     FuzzerLoop.cpp
     FuzzerMutate.cpp
+    FuzzerSanitizerOptions.cpp
     FuzzerUtil.cpp
     )
   add_library(LLVMFuzzer STATIC
index 294b9cc..15a325d 100644 (file)
 #include <atomic>
 #include <mutex>
 
-// ASAN options:
-//   * don't dump the coverage to disk.
-//   * enable coverage by default.
-extern "C" const char *__asan_default_options() {
-  return "coverage_pcs=0:coverage=1";
-}
-
 // Program arguments.
 struct FlagDescription {
   const char *Name;
diff --git a/llvm/lib/Fuzzer/FuzzerSanitizerOptions.cpp b/llvm/lib/Fuzzer/FuzzerSanitizerOptions.cpp
new file mode 100644 (file)
index 0000000..1c58f3a
--- /dev/null
@@ -0,0 +1,18 @@
+//===- FuzzerSanitizerOptions.cpp - default flags for sanitizers ----------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// Set default options for sanitizers while running the fuzzer.
+// Options reside in a separate file, so if we don't want to set the default
+// options we simply do not link this file in.
+// ASAN options:
+//   * don't dump the coverage to disk.
+//   * enable coverage by default.
+//===----------------------------------------------------------------------===//
+extern "C" const char *__asan_default_options() {
+  return "coverage_pcs=0:coverage=1";
+}