[PATCH] D36882: [clang-proto-fuzzer] Allow user-specified compiler arguments.
Matt Morehouse via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 18 11:36:27 PDT 2017
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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36882.111715.patch
Type: text/x-patch
Size: 873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170818/7c8a79d6/attachment.bin>
More information about the cfe-commits
mailing list