[clang-tools-extra] r346608 - [clangd] Make ClangdFuzzer compile again.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 11 03:09:59 PST 2018
Author: d0k
Date: Sun Nov 11 03:09:58 2018
New Revision: 346608
URL: http://llvm.org/viewvc/llvm-project?rev=346608&view=rev
Log:
[clangd] Make ClangdFuzzer compile again.
Modified:
clang-tools-extra/trunk/clangd/fuzzer/ClangdFuzzer.cpp
Modified: clang-tools-extra/trunk/clangd/fuzzer/ClangdFuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/fuzzer/ClangdFuzzer.cpp?rev=346608&r1=346607&r2=346608&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/fuzzer/ClangdFuzzer.cpp (original)
+++ clang-tools-extra/trunk/clangd/fuzzer/ClangdFuzzer.cpp Sun Nov 11 03:09:58 2018
@@ -19,20 +19,23 @@
#include <sstream>
#include <stdio.h>
+using namespace clang::clangd;
+
extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
if (size == 0)
return 0;
- clang::clangd::JSONOutput Out(llvm::nulls(), llvm::nulls(),
- clang::clangd::Logger::Error, nullptr);
- clang::clangd::CodeCompleteOptions CCOpts;
+ // fmemopen isn't portable, but I think we only run the fuzzer on Linux.
+ std::FILE *In = fmemopen(data, size, "r");
+ auto Transport = newJSONTransport(In, llvm::nulls(),
+ /*InMirror=*/nullptr, /*Pretty=*/false,
+ /*Style=*/JSONStreamStyle::Standard);
+ CodeCompleteOptions CCOpts;
CCOpts.EnableSnippets = false;
- clang::clangd::ClangdServer::Options Opts;
+ ClangdServer::Options Opts;
// Initialize and run ClangdLSPServer.
- clang::clangd::ClangdLSPServer LSPServer(Out, CCOpts, llvm::None, false,
- Opts);
- // fmemopen isn't portable, but I think we only run the fuzzer on Linux.
- LSPServer.run(fmemopen(data, size, "r"));
+ ClangdLSPServer LSPServer(*Transport, CCOpts, llvm::None, false, Opts);
+ LSPServer.run();
return 0;
}
More information about the cfe-commits
mailing list