This revision was automatically updated to reflect the committed changes. Closed by commit rL311185: [clang-proto-fuzzer] Allow user-specified compiler arguments. (authored by morehouse).
Changed prior to commit: https://reviews.llvm.org/D36882?vs=111713&id=111715#toc Repository: rL LLVM https://reviews.llvm.org/D36882 Files: cfe/trunk/tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp 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 <cstring> + using namespace clang_fuzzer; +static std::vector<const char *> 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); }
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 <cstring> + using namespace clang_fuzzer; +static std::vector<const char *> 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); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits