sammccall created this revision. sammccall added reviewers: hokein, igor-laevsky. Herald added subscribers: sdasgup3, wenzhicui, wrengr, Chia-hungDuan, dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, usaxena95, kadircet, arphaman, hiraditya, mgorny. Herald added a project: All. sammccall requested review of this revision. Herald added subscribers: cfe-commits, llvm-commits, stephenneuendorffer, nicolasvasilache. Herald added projects: clang, MLIR, LLVM, clang-tools-extra.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D125081 Files: 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
Index: mlir/tools/mlir-parser-fuzzer/CMakeLists.txt =================================================================== --- mlir/tools/mlir-parser-fuzzer/CMakeLists.txt +++ mlir/tools/mlir-parser-fuzzer/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_LINK_COMPONENTS - FuzzMutate + FuzzerCLI Support ) add_llvm_fuzzer(mlir-parser-fuzzer Index: llvm/tools/llvm-yaml-numeric-parser-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-yaml-numeric-parser-fuzzer/CMakeLists.txt +++ 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 Index: llvm/tools/llvm-special-case-list-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-special-case-list-fuzzer/CMakeLists.txt +++ 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 Index: llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt +++ llvm/tools/llvm-rust-demangle-fuzzer/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_LINK_COMPONENTS Demangle - FuzzMutate + FuzzerCLI Support ) Index: llvm/tools/llvm-opt-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-opt-fuzzer/CMakeLists.txt +++ llvm/tools/llvm-opt-fuzzer/CMakeLists.txt @@ -14,6 +14,7 @@ AggressiveInstCombine InstCombine Instrumentation + FuzzerCLI FuzzMutate MC ObjCARCOpts Index: llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt +++ llvm/tools/llvm-microsoft-demangle-fuzzer/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_LINK_COMPONENTS Demangle - FuzzMutate + FuzzerCLI Support ) Index: llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt +++ llvm/tools/llvm-itanium-demangle-fuzzer/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_LINK_COMPONENTS Demangle - FuzzMutate + FuzzerCLI Support ) Index: llvm/tools/llvm-isel-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-isel-fuzzer/CMakeLists.txt +++ llvm/tools/llvm-isel-fuzzer/CMakeLists.txt @@ -9,6 +9,7 @@ BitWriter CodeGen Core + FuzzerCLI FuzzMutate IRReader MC Index: llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt =================================================================== --- llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt +++ llvm/tools/llvm-dlang-demangle-fuzzer/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_LINK_COMPONENTS Demangle - FuzzMutate + FuzzerCLI Support ) Index: llvm/lib/FuzzMutate/CMakeLists.txt =================================================================== --- llvm/lib/FuzzMutate/CMakeLists.txt +++ 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 Index: clang/tools/clang-fuzzer/CMakeLists.txt =================================================================== --- clang/tools/clang-fuzzer/CMakeLists.txt +++ 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) Index: clang-tools-extra/pseudo/fuzzer/CMakeLists.txt =================================================================== --- clang-tools-extra/pseudo/fuzzer/CMakeLists.txt +++ clang-tools-extra/pseudo/fuzzer/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_LINK_COMPONENTS - FuzzMutate + FuzzerCLI Support ) Index: clang-tools-extra/clangd/fuzzer/CMakeLists.txt =================================================================== --- clang-tools-extra/clangd/fuzzer/CMakeLists.txt +++ clang-tools-extra/clangd/fuzzer/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_LINK_COMPONENTS - FuzzMutate + FuzzerCLI Support )
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits