Refactored LLVMFuzzerInitialize function into its own file.
Copied and renamed some files in preparation for new loop-proto-fuzzer.
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 18924 Build 18924: arc lint + arc unit
Event Timeline
Good practice is to avoid merging changes into a single one.
Here one patch should be "refactoring" and the second for "loop-proto-fuzzer."
tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp | ||
---|---|---|
24–25 | Please delete commented code. | |
tools/clang-fuzzer/FuzzerInitialize.h | ||
11 ↗ | (On Diff #149585) | static here means that each module which includes this header is going to have own instance of the variable. 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 |
12 ↗ | (On Diff #149585) | you need only CLArgs here. |
tools/clang-fuzzer/experimental/ExampleClangLoopProtoFuzzer.cpp | ||
30 ↗ | (On Diff #149585) | Please remove deleted code |
We are doing this for several reasons:
- smaller patches, faster review
- easier to investigate regressions caused by smaller patches
Changed CLArgs into getter and deleted commented code
Made changes in response to comments
Removed commented out code
Changed CLArgs to be a getter method
Removed LLVMFuzzerInitialize decl from header file
tools/clang-fuzzer/CMakeLists.txt | ||
---|---|---|
50 | Rather than compiling FuzzerInitialize.cpp into the binary, can we make it a library like handle-cxx or proto-to-cxx? | |
tools/clang-fuzzer/FuzzerInitialize.cpp | ||
17 ↗ | (On Diff #149854) | Do we need this include? |
tools/clang-fuzzer/FuzzerInitialize.h | ||
20 ↗ | (On Diff #149854) | Why do we need these includes in the header? Doesn't look like they're used here. |
tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp | ||
---|---|---|
22–23 | I think cstring is no longer used after this change. So we can probably remove this include. | |
tools/clang-fuzzer/fuzzer-initialize/CMakeLists.txt | ||
4 | Nit: clangFuzzerInitialize would better follow the naming convention of the other libraries. | |
tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.h | ||
16 | I don't think this include is used in this file either. Can we remove it? |
Some feedback on the generated code:
while (1){
let's not have the while loops inside the for loops for now.
If the initial goal is to stress the loop optimizations (e.g. vectorizer),
loops likes this are just a distraction
for (int loop_ctr = 0
too verbose. Use 'i'm 'j', 'k'
also, alternate int, unsigned, size_t, long (later).
a[436863498 % s]=1;
this is good for keeping the code UB-free, but it will render the tests non-vectorizable.
need more tests that won't use % s
void foo(int *a, size_t s) {
ok for a starter, but will need a more rich signature in the future versions.
Rather than compiling FuzzerInitialize.cpp into the binary, can we make it a library like handle-cxx or proto-to-cxx?