[PATCH] D47666: Refactored clang-fuzzer and added new (copy) files

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 1 17:06:09 PDT 2018


vitalybuka added a comment.

Good practice is to avoid merging changes into a single one.
Here one patch should be "refactoring" and the second for "loop-proto-fuzzer."



================
Comment at: tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp:29
+/*
 static std::vector<const char *> CLArgs;
 
----------------
Please delete commented code.


================
Comment at: tools/clang-fuzzer/FuzzerInitialize.h:11
+
+static std::vector<const char *> CLArgs;
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv);
----------------
static here means that each module which includes this header is going to have own instance of the variable.
I guess you need only one instance in FuzzerInitialize.cpp which can be achieved with 
```
extern std::vector<const char *> CLArgs;

```

However I'd recommend getter:

```
const std::vector<const char *>& GetCLArgs();
```
with implementation and 
```
static std::vector<const char *> CLArgs;
```
in FuzzerInitialize.cpp


================
Comment at: tools/clang-fuzzer/FuzzerInitialize.h:12
+static std::vector<const char *> CLArgs;
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv);
+
----------------
you need only CLArgs here.
code which includes this header is not going to call LLVMFuzzerInitialize


================
Comment at: tools/clang-fuzzer/experimental/ExampleClangLoopProtoFuzzer.cpp:30
 
+/*
 static std::vector<const char *> CLArgs;
----------------
Please remove deleted code


Repository:
  rC Clang

https://reviews.llvm.org/D47666





More information about the cfe-commits mailing list