]> granicus.if.org Git - clang/commitdiff
[clang-format] Allow building fuzzer with OSS-Fuzz flags.
authorMatt Morehouse <mascasa@google.com>
Thu, 12 Oct 2017 18:39:10 +0000 (18:39 +0000)
committerMatt Morehouse <mascasa@google.com>
Thu, 12 Oct 2017 18:39:10 +0000 (18:39 +0000)
Reviewers: kcc, bogner

Reviewed By: kcc

Subscribers: cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D38853

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315603 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format/CMakeLists.txt
tools/clang-format/fuzzer/CMakeLists.txt

index a13633eaefc4e4ee3066018c71f175d5958d5077..466cc009b4ff02422ce7edb55004db61dab3fd22 100644 (file)
@@ -15,7 +15,7 @@ target_link_libraries(clang-format
   ${CLANG_FORMAT_LIB_DEPS}
   )
 
-if( LLVM_USE_SANITIZE_COVERAGE )
+if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 
index 9dc4f2a6e8b22bb164cc0ce32724fa1f32ed464d..245186eea1f1704b264801d4497b58d75e58236f 100644 (file)
@@ -1,6 +1,8 @@
 set(LLVM_LINK_COMPONENTS support)
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+if(LLVM_USE_SANITIZE_COVERAGE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
+endif()
 
 add_clang_executable(clang-format-fuzzer
   EXCLUDE_FROM_ALL
@@ -8,4 +10,6 @@ add_clang_executable(clang-format-fuzzer
   )
 
 target_link_libraries(clang-format-fuzzer
-  ${CLANG_FORMAT_LIB_DEPS})
+  ${CLANG_FORMAT_LIB_DEPS}
+  ${LIB_FUZZING_ENGINE}
+  )