diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2017-08-24 00:30:28 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2017-08-24 00:30:28 +0000 |
commit | af5b021504d0578ec76e59fcf0d5b44b1b7f592d (patch) | |
tree | e997f2f636d7eb2b206a09baed327e6a49391508 /tools/clang-format | |
parent | daa2ac3611e7571cb2f7121e73850297e93f333e (diff) | |
download | clang-af5b021504d0578ec76e59fcf0d5b44b1b7f592d.tar.gz |
Fix ClangFormatFuzzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-format')
-rw-r--r-- | tools/clang-format/fuzzer/ClangFormatFuzzer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp b/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp index 5334ce873e..d440a6124b 100644 --- a/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp +++ b/tools/clang-format/fuzzer/ClangFormatFuzzer.cpp @@ -20,7 +20,10 @@ 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; - applyAllReplacements(s, clang::format::reformat( - Style, s, {clang::tooling::Range(0, s.size())})); + auto Replaces = reformat(Style, s, clang::tooling::Range(0, s.size())); + auto Result = applyAllReplacements(s, Replaces); + + // Output must be checked, as otherwise we crash. + if (!Result) {} return 0; } |