Index: cfe/trunk/tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp =================================================================== --- cfe/trunk/tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp +++ cfe/trunk/tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp @@ -20,9 +20,25 @@ #include "src/libfuzzer/libfuzzer_macro.h" +#include + using namespace clang_fuzzer; +static std::vector CLArgs; + +extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { + CLArgs.push_back("-O2"); + for (int I = 1; I < *argc; I++) { + if (strcmp((*argv)[I], "-ignore_remaining_args=1") == 0) { + for (I++; I < *argc; I++) + CLArgs.push_back((*argv)[I]); + break; + } + } + return 0; +} + DEFINE_BINARY_PROTO_FUZZER(const Function& input) { auto S = FunctionToString(input); - HandleCXX(S, {"-O2"}); + HandleCXX(S, CLArgs); }