Skip to content

Commit

Permalink
[clang-format] Add macro replacement to fuzzing.
Browse files Browse the repository at this point in the history
  • Loading branch information
r4nt committed Feb 27, 2023
1 parent 0264ca4 commit f600a5a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
std::string s((const char *)data, size);
auto Style = getGoogleStyle(clang::format::FormatStyle::LK_Cpp);
Style.ColumnLimit = 60;
Style.Macros.push_back("ASSIGN_OR_RETURN(a, b)=a = (b)");
Style.Macros.push_back("ASSIGN_OR_RETURN(a, b, c)=a = (b); if (x) return c");
Style.Macros.push_back("MOCK_METHOD(r, n, a, s)=r n a s");
auto Replaces = reformat(Style, s, clang::tooling::Range(0, s.size()));
auto Result = applyAllReplacements(s, Replaces);

Expand Down

0 comments on commit f600a5a

Please sign in to comment.