2017-10-26 18:03:11 +08:00
|
|
|
//===-- ClangdFuzzer.cpp - Fuzz clangd ------------------------------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2017-10-26 18:03:11 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// This file implements a function that runs clangd on a single input.
|
2017-10-26 18:03:11 +08:00
|
|
|
/// This function is then linked into the Fuzzer library.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ClangdLSPServer.h"
|
2018-03-10 07:02:22 +08:00
|
|
|
#include "ClangdServer.h"
|
2017-12-12 20:56:46 +08:00
|
|
|
#include "CodeComplete.h"
|
2019-02-01 19:09:06 +08:00
|
|
|
#include "FSProvider.h"
|
2019-01-08 00:55:59 +08:00
|
|
|
#include <cstdio>
|
2017-10-26 18:03:11 +08:00
|
|
|
#include <sstream>
|
|
|
|
|
2018-11-11 19:09:58 +08:00
|
|
|
using namespace clang::clangd;
|
|
|
|
|
2017-10-26 18:03:11 +08:00
|
|
|
extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
|
2018-07-25 05:50:06 +08:00
|
|
|
if (size == 0)
|
|
|
|
return 0;
|
|
|
|
|
2018-11-11 19:09:58 +08:00
|
|
|
// 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,
|
2019-02-01 19:20:20 +08:00
|
|
|
/*Style=*/JSONStreamStyle::Delimited);
|
2019-02-01 19:09:06 +08:00
|
|
|
RealFileSystemProvider FS;
|
2018-11-11 19:09:58 +08:00
|
|
|
CodeCompleteOptions CCOpts;
|
2017-12-08 03:04:27 +08:00
|
|
|
CCOpts.EnableSnippets = false;
|
2018-11-11 19:09:58 +08:00
|
|
|
ClangdServer::Options Opts;
|
2017-10-26 18:03:11 +08:00
|
|
|
|
2017-10-26 18:07:04 +08:00
|
|
|
// Initialize and run ClangdLSPServer.
|
2019-04-04 22:08:35 +08:00
|
|
|
ClangdLSPServer LSPServer(*Transport, FS, CCOpts, llvm::None, false,
|
|
|
|
llvm::None, Opts);
|
2018-11-11 19:09:58 +08:00
|
|
|
LSPServer.run();
|
2017-10-26 18:03:11 +08:00
|
|
|
return 0;
|
|
|
|
}
|