diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2017-12-13 12:51:22 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2017-12-13 12:51:22 +0000 |
commit | 940901e8b169b6d797762e8188e96d7d0446cc3d (patch) | |
tree | 8894fb8dd512ee03f9f682a2f115ace6850ab0a7 /clang-tools-extra/clangd/CodeComplete.cpp | |
parent | 845e5dce835d24a30d876411fa3153115141ae89 (diff) | |
download | bcm5719-llvm-940901e8b169b6d797762e8188e96d7d0446cc3d.tar.gz bcm5719-llvm-940901e8b169b6d797762e8188e96d7d0446cc3d.zip |
[clangd] Implemented logging using Context
Reviewers: sammccall, ioeric, hokein
Reviewed By: sammccall
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D40486
llvm-svn: 320576
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.cpp')
-rw-r--r-- | clang-tools-extra/clangd/CodeComplete.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index a8203b5005a..66bce09bd78 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -584,14 +584,14 @@ private: }; // SignatureHelpCollector -bool invokeCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer, +bool invokeCodeComplete(const Context &Ctx, + std::unique_ptr<CodeCompleteConsumer> Consumer, const clang::CodeCompleteOptions &Options, PathRef FileName, const tooling::CompileCommand &Command, PrecompiledPreamble const *Preamble, StringRef Contents, Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS, - std::shared_ptr<PCHContainerOperations> PCHs, - Logger &Logger) { + std::shared_ptr<PCHContainerOperations> PCHs) { std::vector<const char *> ArgStrs; for (const auto &S : Command.CommandLine) ArgStrs.push_back(S.c_str()); @@ -634,12 +634,12 @@ bool invokeCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer, SyntaxOnlyAction Action; if (!Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) { - Logger.log("BeginSourceFile() failed when running codeComplete for " + - FileName); + log(Ctx, + "BeginSourceFile() failed when running codeComplete for " + FileName); return false; } if (!Action.Execute()) { - Logger.log("Execute() failed when running codeComplete for " + FileName); + log(Ctx, "Execute() failed when running codeComplete for " + FileName); return false; } @@ -660,13 +660,13 @@ clang::CodeCompleteOptions CodeCompleteOptions::getClangCompleteOpts() const { return Result; } -CompletionList codeComplete(PathRef FileName, +CompletionList codeComplete(const Context &Ctx, PathRef FileName, const tooling::CompileCommand &Command, PrecompiledPreamble const *Preamble, StringRef Contents, Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS, std::shared_ptr<PCHContainerOperations> PCHs, - CodeCompleteOptions Opts, Logger &Logger) { + CodeCompleteOptions Opts) { CompletionList Results; std::unique_ptr<CodeCompleteConsumer> Consumer; if (Opts.EnableSnippets) { @@ -676,26 +676,28 @@ CompletionList codeComplete(PathRef FileName, Consumer = llvm::make_unique<PlainTextCompletionItemsCollector>(Opts, Results); } - invokeCodeComplete(std::move(Consumer), Opts.getClangCompleteOpts(), FileName, - Command, Preamble, Contents, Pos, std::move(VFS), - std::move(PCHs), Logger); + invokeCodeComplete(Ctx, std::move(Consumer), Opts.getClangCompleteOpts(), + FileName, Command, Preamble, Contents, Pos, std::move(VFS), + std::move(PCHs)); return Results; } -SignatureHelp -signatureHelp(PathRef FileName, const tooling::CompileCommand &Command, - PrecompiledPreamble const *Preamble, StringRef Contents, - Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS, - std::shared_ptr<PCHContainerOperations> PCHs, Logger &Logger) { +SignatureHelp signatureHelp(const Context &Ctx, PathRef FileName, + const tooling::CompileCommand &Command, + PrecompiledPreamble const *Preamble, + StringRef Contents, Position Pos, + IntrusiveRefCntPtr<vfs::FileSystem> VFS, + std::shared_ptr<PCHContainerOperations> PCHs) { SignatureHelp Result; clang::CodeCompleteOptions Options; Options.IncludeGlobals = false; Options.IncludeMacros = false; Options.IncludeCodePatterns = false; Options.IncludeBriefComments = true; - invokeCodeComplete(llvm::make_unique<SignatureHelpCollector>(Options, Result), + invokeCodeComplete(Ctx, + llvm::make_unique<SignatureHelpCollector>(Options, Result), Options, FileName, Command, Preamble, Contents, Pos, - std::move(VFS), std::move(PCHs), Logger); + std::move(VFS), std::move(PCHs)); return Result; } |