summaryrefslogtreecommitdiffstats
path: root/tools/clang-format
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2017-10-12 18:39:10 +0000
committerMatt Morehouse <mascasa@google.com>2017-10-12 18:39:10 +0000
commit780c8ad4b33c3e9703a02584c1afe7e81f38144b (patch)
treeae7dd4ae507812dedf3985cbf1c98b1cc96c6739 /tools/clang-format
parentcf450b4ea47ae5400d1ba4877a2d807d46f208cd (diff)
[clang-format] Allow building fuzzer with OSS-Fuzz flags.
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
Diffstat (limited to 'tools/clang-format')
-rw-r--r--tools/clang-format/CMakeLists.txt2
-rw-r--r--tools/clang-format/fuzzer/CMakeLists.txt8
2 files changed, 7 insertions, 3 deletions
diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
index a13633eaef..466cc009b4 100644
--- a/tools/clang-format/CMakeLists.txt
+++ b/tools/clang-format/CMakeLists.txt
@@ -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()
diff --git a/tools/clang-format/fuzzer/CMakeLists.txt b/tools/clang-format/fuzzer/CMakeLists.txt
index 9dc4f2a6e8..245186eea1 100644
--- a/tools/clang-format/fuzzer/CMakeLists.txt
+++ b/tools/clang-format/fuzzer/CMakeLists.txt
@@ -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}
+ )