[clang-tools-extra] 1c5e85b - [FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR.
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Sat May 7 03:13:05 PDT 2022
Author: Sam McCall
Date: 2022-05-07T12:11:51+02:00
New Revision: 1c5e85b3da649c89db87abecc53b42f6eaa574c2
URL: https://github.com/llvm/llvm-project/commit/1c5e85b3da649c89db87abecc53b42f6eaa574c2
DIFF: https://github.com/llvm/llvm-project/commit/1c5e85b3da649c89db87abecc53b42f6eaa574c2.diff
LOG: [FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR.
All llvm-project fuzzers use this library to parse command-line arguments.
Many of them don't deal with LLVM IR or modules in any way. Bundling those
functions in one library forces build dependencies that don't need to be there.
Among other things, this means check-clang-pseudo no longer depends on most of
LLVM.
Differential Revision: https://reviews.llvm.org/D125081
Added:
Modified:
clang-tools-extra/clangd/fuzzer/CMakeLists.txt
clang-tools-extra/pseudo/fuzzer/CMakeLists.txt
clang/tools/clang-fuzzer/CMakeLists.txt
llvm/lib/FuzzMutate/CMakeLists.txt
llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt
llvm/tools/llvm-isel-fuzzer/CMakeLists.txt
llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt
llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt
llvm/tools/llvm-opt-fuzzer/CMakeLists.txt
llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt
llvm/tools/llvm-special-case-list-fuzzer/CMakeLists.txt
llvm/tools/llvm-yaml-numeric-parser-fuzzer/CMakeLists.txt
mlir/tools/mlir-parser-fuzzer/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/fuzzer/CMakeLists.txt b/clang-tools-extra/clangd/fuzzer/CMakeLists.txt
index 5600a354decb3..eaf4478585290 100644
--- a/clang-tools-extra/clangd/fuzzer/CMakeLists.txt
+++ b/clang-tools-extra/clangd/fuzzer/CMakeLists.txt
@@ -1,5 +1,5 @@
set(LLVM_LINK_COMPONENTS
- FuzzMutate
+ FuzzerCLI
Support
)
diff --git a/clang-tools-extra/pseudo/fuzzer/CMakeLists.txt b/clang-tools-extra/pseudo/fuzzer/CMakeLists.txt
index fc583de8b011b..556c2f438d388 100644
--- a/clang-tools-extra/pseudo/fuzzer/CMakeLists.txt
+++ b/clang-tools-extra/pseudo/fuzzer/CMakeLists.txt
@@ -1,5 +1,5 @@
set(LLVM_LINK_COMPONENTS
- FuzzMutate
+ FuzzerCLI
Support
)
diff --git a/clang/tools/clang-fuzzer/CMakeLists.txt b/clang/tools/clang-fuzzer/CMakeLists.txt
index 4b2243c5ceb97..80ae9b611f65b 100644
--- a/clang/tools/clang-fuzzer/CMakeLists.txt
+++ b/clang/tools/clang-fuzzer/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} FuzzMutate)
+set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} FuzzerCLI)
set(CXX_FLAGS_NOFUZZ ${CMAKE_CXX_FLAGS})
set(DUMMY_MAIN DummyClangFuzzer.cpp)
if(LLVM_LIB_FUZZING_ENGINE)
diff --git a/llvm/lib/FuzzMutate/CMakeLists.txt b/llvm/lib/FuzzMutate/CMakeLists.txt
index 47ddeb5e1d2a9..0aea7fe0d8f0f 100644
--- a/llvm/lib/FuzzMutate/CMakeLists.txt
+++ b/llvm/lib/FuzzMutate/CMakeLists.txt
@@ -1,9 +1,23 @@
-add_llvm_component_library(LLVMFuzzMutate
+# Generic helper for fuzzer binaries.
+# This should not depend on LLVM IR etc.
+add_llvm_component_library(LLVMFuzzerCLI
FuzzerCLI.cpp
+ PARTIAL_SOURCES_INTENDED
+
+ ADDITIONAL_HEADER_DIRS
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/FuzzMutate
+
+ LINK_COMPONENTS
+ Support
+ )
+
+# Library for using LLVM IR together with fuzzers.
+add_llvm_component_library(LLVMFuzzMutate
IRMutator.cpp
OpDescriptor.cpp
Operations.cpp
RandomIRBuilder.cpp
+ PARTIAL_SOURCES_INTENDED
ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/FuzzMutate
diff --git a/llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt b/llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt
index 5f90def79847b..427aff5c6d2ea 100644
--- a/llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS
Demangle
- FuzzMutate
+ FuzzerCLI
Support
)
diff --git a/llvm/tools/llvm-isel-fuzzer/CMakeLists.txt b/llvm/tools/llvm-isel-fuzzer/CMakeLists.txt
index 6ce0835f0465a..32b65384144ce 100644
--- a/llvm/tools/llvm-isel-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-isel-fuzzer/CMakeLists.txt
@@ -9,6 +9,7 @@ set(LLVM_LINK_COMPONENTS
BitWriter
CodeGen
Core
+ FuzzerCLI
FuzzMutate
IRReader
MC
diff --git a/llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt b/llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt
index 07f02a35b2031..18b160d2b9c8b 100644
--- a/llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS
Demangle
- FuzzMutate
+ FuzzerCLI
Support
)
diff --git a/llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt b/llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt
index d3db43a686bbd..bacb88a3d5633 100644
--- a/llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS
Demangle
- FuzzMutate
+ FuzzerCLI
Support
)
diff --git a/llvm/tools/llvm-opt-fuzzer/CMakeLists.txt b/llvm/tools/llvm-opt-fuzzer/CMakeLists.txt
index 67a401f0ef7f8..0ae3d2ee7a25f 100644
--- a/llvm/tools/llvm-opt-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-opt-fuzzer/CMakeLists.txt
@@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS
AggressiveInstCombine
InstCombine
Instrumentation
+ FuzzerCLI
FuzzMutate
MC
ObjCARCOpts
diff --git a/llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt b/llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt
index eeb37fc50efe6..d755a07c04c56 100644
--- a/llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS
Demangle
- FuzzMutate
+ FuzzerCLI
Support
)
diff --git a/llvm/tools/llvm-special-case-list-fuzzer/CMakeLists.txt b/llvm/tools/llvm-special-case-list-fuzzer/CMakeLists.txt
index 381f07b1ae910..c4c65ade31c21 100644
--- a/llvm/tools/llvm-special-case-list-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-special-case-list-fuzzer/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS
Support
- FuzzMutate
+ FuzzerCLI
)
add_llvm_fuzzer(llvm-special-case-list-fuzzer
diff --git a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/CMakeLists.txt b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/CMakeLists.txt
index 34027431697f6..e69267db393f8 100644
--- a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/CMakeLists.txt
+++ b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/CMakeLists.txt
@@ -1,6 +1,6 @@
set(LLVM_LINK_COMPONENTS
Support
- FuzzMutate
+ FuzzerCLI
)
add_llvm_fuzzer(llvm-yaml-numeric-parser-fuzzer
diff --git a/mlir/tools/mlir-parser-fuzzer/CMakeLists.txt b/mlir/tools/mlir-parser-fuzzer/CMakeLists.txt
index 4cfd31d112901..fa1d5fd24c460 100644
--- a/mlir/tools/mlir-parser-fuzzer/CMakeLists.txt
+++ b/mlir/tools/mlir-parser-fuzzer/CMakeLists.txt
@@ -1,5 +1,5 @@
set(LLVM_LINK_COMPONENTS
- FuzzMutate
+ FuzzerCLI
Support
)
add_llvm_fuzzer(mlir-parser-fuzzer
More information about the cfe-commits
mailing list