mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-27 05:50:12 +00:00
[clangd] Fix clang-tidy warnings.
No functionality change intended. llvm-svn: 316832
This commit is contained in:
parent
d09c1ac20f
commit
5349eedfdd
@ -73,12 +73,6 @@ private:
|
||||
std::vector<clang::tooling::Replacement>
|
||||
getFixIts(StringRef File, const clangd::Diagnostic &D);
|
||||
|
||||
/// Function that will be called on a separate thread when diagnostics are
|
||||
/// ready. Sends the Dianostics to LSP client via Out.writeMessage and caches
|
||||
/// corresponding fixits in the FixItsMap.
|
||||
void consumeDiagnostics(PathRef File,
|
||||
std::vector<DiagWithFixIts> Diagnostics);
|
||||
|
||||
JSONOutput &Out;
|
||||
/// Used to indicate that the 'shutdown' request was received from the
|
||||
/// Language Server client.
|
||||
|
@ -166,8 +166,8 @@ std::future<void> ClangdServer::addDocument(PathRef File, StringRef Contents) {
|
||||
DocVersion Version = DraftMgr.updateDraft(File, Contents);
|
||||
|
||||
auto TaggedFS = FSProvider.getTaggedFileSystem(File);
|
||||
std::shared_ptr<CppFile> Resources = Units.getOrCreateFile(
|
||||
File, ResourceDir, CDB, PCHs, TaggedFS.Value, Logger);
|
||||
std::shared_ptr<CppFile> Resources =
|
||||
Units.getOrCreateFile(File, ResourceDir, CDB, PCHs, Logger);
|
||||
return scheduleReparseAndDiags(File, VersionedDraft{Version, Contents.str()},
|
||||
std::move(Resources), std::move(TaggedFS));
|
||||
}
|
||||
@ -184,8 +184,8 @@ std::future<void> ClangdServer::forceReparse(PathRef File) {
|
||||
"forceReparse() was called for non-added document");
|
||||
|
||||
auto TaggedFS = FSProvider.getTaggedFileSystem(File);
|
||||
auto Recreated = Units.recreateFileIfCompileCommandChanged(
|
||||
File, ResourceDir, CDB, PCHs, TaggedFS.Value, Logger);
|
||||
auto Recreated = Units.recreateFileIfCompileCommandChanged(File, ResourceDir,
|
||||
CDB, PCHs, Logger);
|
||||
|
||||
// Note that std::future from this cleanup action is ignored.
|
||||
scheduleCancelRebuild(std::move(Recreated.RemovedFile));
|
||||
|
@ -157,7 +157,7 @@ getOptionalParameters(const CodeCompletionString &CCS,
|
||||
return Result;
|
||||
}
|
||||
|
||||
llvm::Optional<DiagWithFixIts> toClangdDiag(StoredDiagnostic D) {
|
||||
llvm::Optional<DiagWithFixIts> toClangdDiag(const StoredDiagnostic &D) {
|
||||
auto Location = D.getLocation();
|
||||
if (!Location.isValid() || !Location.getManager().isInMainFile(Location))
|
||||
return llvm::None;
|
||||
@ -744,9 +744,9 @@ bool invokeCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
|
||||
Preamble = nullptr;
|
||||
}
|
||||
|
||||
auto Clang = prepareCompilerInstance(std::move(CI), Preamble,
|
||||
std::move(ContentsBuffer), PCHs, VFS,
|
||||
DummyDiagsConsumer);
|
||||
auto Clang = prepareCompilerInstance(
|
||||
std::move(CI), Preamble, std::move(ContentsBuffer), std::move(PCHs),
|
||||
std::move(VFS), DummyDiagsConsumer);
|
||||
auto &DiagOpts = Clang->getDiagnosticOpts();
|
||||
DiagOpts.IgnoreWarnings = true;
|
||||
|
||||
@ -804,7 +804,7 @@ clang::CodeCompleteOptions clangd::CodeCompleteOptions::getClangCompleteOpts() {
|
||||
}
|
||||
|
||||
std::vector<CompletionItem>
|
||||
clangd::codeComplete(PathRef FileName, tooling::CompileCommand Command,
|
||||
clangd::codeComplete(PathRef FileName, const tooling::CompileCommand &Command,
|
||||
PrecompiledPreamble const *Preamble, StringRef Contents,
|
||||
Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
|
||||
std::shared_ptr<PCHContainerOperations> PCHs,
|
||||
@ -826,7 +826,7 @@ clangd::codeComplete(PathRef FileName, tooling::CompileCommand Command,
|
||||
}
|
||||
|
||||
SignatureHelp
|
||||
clangd::signatureHelp(PathRef FileName, tooling::CompileCommand Command,
|
||||
clangd::signatureHelp(PathRef FileName, const tooling::CompileCommand &Command,
|
||||
PrecompiledPreamble const *Preamble, StringRef Contents,
|
||||
Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
|
||||
std::shared_ptr<PCHContainerOperations> PCHs,
|
||||
@ -859,9 +859,9 @@ ParsedAST::Build(std::unique_ptr<clang::CompilerInvocation> CI,
|
||||
std::vector<DiagWithFixIts> ASTDiags;
|
||||
StoreDiagsConsumer UnitDiagsConsumer(/*ref*/ ASTDiags);
|
||||
|
||||
auto Clang =
|
||||
prepareCompilerInstance(std::move(CI), Preamble, std::move(Buffer), PCHs,
|
||||
VFS, /*ref*/ UnitDiagsConsumer);
|
||||
auto Clang = prepareCompilerInstance(
|
||||
std::move(CI), Preamble, std::move(Buffer), std::move(PCHs),
|
||||
std::move(VFS), /*ref*/ UnitDiagsConsumer);
|
||||
|
||||
// Recover resources if we crash before exiting this method.
|
||||
llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> CICleanup(
|
||||
|
@ -289,14 +289,15 @@ struct CodeCompleteOptions {
|
||||
|
||||
/// Get code completions at a specified \p Pos in \p FileName.
|
||||
std::vector<CompletionItem>
|
||||
codeComplete(PathRef FileName, tooling::CompileCommand Command,
|
||||
codeComplete(PathRef FileName, const tooling::CompileCommand &Command,
|
||||
PrecompiledPreamble const *Preamble, StringRef Contents,
|
||||
Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
|
||||
std::shared_ptr<PCHContainerOperations> PCHs,
|
||||
clangd::CodeCompleteOptions Opts, clangd::Logger &Logger);
|
||||
|
||||
/// Get signature help at a specified \p Pos in \p FileName.
|
||||
SignatureHelp signatureHelp(PathRef FileName, tooling::CompileCommand Command,
|
||||
SignatureHelp signatureHelp(PathRef FileName,
|
||||
const tooling::CompileCommand &Command,
|
||||
PrecompiledPreamble const *Preamble,
|
||||
StringRef Contents, Position Pos,
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> VFS,
|
||||
|
@ -29,8 +29,7 @@ std::shared_ptr<CppFile> CppFileCollection::removeIfPresent(PathRef File) {
|
||||
CppFileCollection::RecreateResult
|
||||
CppFileCollection::recreateFileIfCompileCommandChanged(
|
||||
PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB,
|
||||
std::shared_ptr<PCHContainerOperations> PCHs,
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> VFS, clangd::Logger &Logger) {
|
||||
std::shared_ptr<PCHContainerOperations> PCHs, clangd::Logger &Logger) {
|
||||
auto NewCommand = getCompileCommand(CDB, File, ResourceDir);
|
||||
|
||||
std::lock_guard<std::mutex> Lock(Mutex);
|
||||
|
@ -27,8 +27,7 @@ class CppFileCollection {
|
||||
public:
|
||||
std::shared_ptr<CppFile> getOrCreateFile(
|
||||
PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB,
|
||||
std::shared_ptr<PCHContainerOperations> PCHs,
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> VFS, clangd::Logger &Logger) {
|
||||
std::shared_ptr<PCHContainerOperations> PCHs, clangd::Logger &Logger) {
|
||||
std::lock_guard<std::mutex> Lock(Mutex);
|
||||
|
||||
auto It = OpenedFiles.find(File);
|
||||
@ -59,8 +58,7 @@ public:
|
||||
/// will be returned in RecreateResult.RemovedFile.
|
||||
RecreateResult recreateFileIfCompileCommandChanged(
|
||||
PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB,
|
||||
std::shared_ptr<PCHContainerOperations> PCHs,
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> VFS, clangd::Logger &Logger);
|
||||
std::shared_ptr<PCHContainerOperations> PCHs, clangd::Logger &Logger);
|
||||
|
||||
std::shared_ptr<CppFile> getFile(PathRef File) {
|
||||
std::lock_guard<std::mutex> Lock(Mutex);
|
||||
|
@ -89,7 +89,6 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// If --compile-commands-dir arg was invoked, check value and override default
|
||||
// path.
|
||||
namespace path = llvm::sys::path;
|
||||
llvm::Optional<Path> CompileCommandsDirPath;
|
||||
|
||||
if (CompileCommandsDir.empty()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user