[clang] f600a5a - [clang-format] Add macro replacement to fuzzing.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 27 02:40:39 PST 2023
Author: Manuel Klimek
Date: 2023-02-27T10:40:22Z
New Revision: f600a5aec52c0aa56e4e47c992b6f10e5cd7b7af
URL: https://github.com/llvm/llvm-project/commit/f600a5aec52c0aa56e4e47c992b6f10e5cd7b7af
DIFF: https://github.com/llvm/llvm-project/commit/f600a5aec52c0aa56e4e47c992b6f10e5cd7b7af.diff
LOG: [clang-format] Add macro replacement to fuzzing.
Added:
Modified:
clang/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp b/clang/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp
index f90cdf5ab60db..a8a783ba1a53e 100644
--- a/clang/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp
+++ b/clang/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp
@@ -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);
More information about the cfe-commits
mailing list