diff options
Diffstat (limited to 'llvm/tools/llvm-isel-fuzzer/DummyISelFuzzer.cpp')
| -rw-r--r-- | llvm/tools/llvm-isel-fuzzer/DummyISelFuzzer.cpp | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/llvm/tools/llvm-isel-fuzzer/DummyISelFuzzer.cpp b/llvm/tools/llvm-isel-fuzzer/DummyISelFuzzer.cpp index 89c1c81cdbe..ec9c74e3040 100644 --- a/llvm/tools/llvm-isel-fuzzer/DummyISelFuzzer.cpp +++ b/llvm/tools/llvm-isel-fuzzer/DummyISelFuzzer.cpp @@ -11,43 +11,11 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/Compiler.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/raw_ostream.h" - -using namespace llvm; +#include "llvm/FuzzMutate/FuzzerCLI.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv); - int main(int argc, char *argv[]) { - errs() << "*** This tool was not linked to libFuzzer.\n" - << "*** No fuzzing will be performed.\n"; - if (int RC = LLVMFuzzerInitialize(&argc, &argv)) { - errs() << "Initialization failed\n"; - return RC; - } - - for (int I = 1; I < argc; ++I) { - StringRef Arg(argv[I]); - if (Arg.startswith("-")) { - if (Arg.equals("-ignore_remaining_args=1")) - break; - continue; - } - - auto BufOrErr = MemoryBuffer::getFile(Arg, /*FileSize-*/ -1, - /*RequiresNullTerminator=*/false); - if (std::error_code EC = BufOrErr.getError()) { - errs() << "Error reading file: " << Arg << ": " << EC.message() << "\n"; - return 1; - } - std::unique_ptr<MemoryBuffer> Buf = std::move(BufOrErr.get()); - errs() << "Running: " << Arg << " (" << Buf->getBufferSize() << " bytes)\n"; - LLVMFuzzerTestOneInput( - reinterpret_cast<const uint8_t *>(Buf->getBufferStart()), - Buf->getBufferSize()); - } + return llvm::runFuzzerOnInputs(argc, argv, LLVMFuzzerTestOneInput, + LLVMFuzzerInitialize); } |

