This revision was automatically updated to reflect the committed changes. Closed by commit rCTE327550: [clangd] Use Contents from inputs in codeComplete and signatureHelp (authored by simark, committed by ).
Changed prior to commit: https://reviews.llvm.org/D44484?vs=138417&id=138424#toc Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44484 Files: clangd/ClangdServer.cpp Index: clangd/ClangdServer.cpp =================================================================== --- clangd/ClangdServer.cpp +++ clangd/ClangdServer.cpp @@ -154,23 +154,22 @@ // Copy PCHs to avoid accessing this->PCHs concurrently std::shared_ptr<PCHContainerOperations> PCHs = this->PCHs; auto FS = FSProvider.getFileSystem(); - auto Task = [PCHs, Pos, FS, CodeCompleteOpts]( - std::string Contents, Path File, Callback<CompletionList> CB, - llvm::Expected<InputsAndPreamble> IP) { + auto Task = [PCHs, Pos, FS, + CodeCompleteOpts](Path File, Callback<CompletionList> CB, + llvm::Expected<InputsAndPreamble> IP) { assert(IP && "error when trying to read preamble for codeComplete"); auto PreambleData = IP->Preamble; // FIXME(ibiryukov): even if Preamble is non-null, we may want to check // both the old and the new version in case only one of them matches. CompletionList Result = clangd::codeComplete( File, IP->Command, PreambleData ? &PreambleData->Preamble : nullptr, - Contents, Pos, FS, PCHs, CodeCompleteOpts); + IP->Contents, Pos, FS, PCHs, CodeCompleteOpts); CB(std::move(Result)); }; - WorkScheduler.runWithPreamble( - "CodeComplete", File, - Bind(Task, std::move(*Latest.Draft), File.str(), std::move(CB))); + WorkScheduler.runWithPreamble("CodeComplete", File, + Bind(Task, File.str(), std::move(CB))); } void ClangdServer::signatureHelp(PathRef File, Position Pos, @@ -183,21 +182,19 @@ auto PCHs = this->PCHs; auto FS = FSProvider.getFileSystem(); - auto Action = [Pos, FS, PCHs](std::string Contents, Path File, - Callback<SignatureHelp> CB, + auto Action = [Pos, FS, PCHs](Path File, Callback<SignatureHelp> CB, llvm::Expected<InputsAndPreamble> IP) { if (!IP) return CB(IP.takeError()); auto PreambleData = IP->Preamble; CB(clangd::signatureHelp(File, IP->Command, PreambleData ? &PreambleData->Preamble : nullptr, - Contents, Pos, FS, PCHs)); + IP->Contents, Pos, FS, PCHs)); }; - WorkScheduler.runWithPreamble( - "SignatureHelp", File, - Bind(Action, std::move(*Latest.Draft), File.str(), std::move(CB))); + WorkScheduler.runWithPreamble("SignatureHelp", File, + Bind(Action, File.str(), std::move(CB))); } llvm::Expected<tooling::Replacements>
Index: clangd/ClangdServer.cpp =================================================================== --- clangd/ClangdServer.cpp +++ clangd/ClangdServer.cpp @@ -154,23 +154,22 @@ // Copy PCHs to avoid accessing this->PCHs concurrently std::shared_ptr<PCHContainerOperations> PCHs = this->PCHs; auto FS = FSProvider.getFileSystem(); - auto Task = [PCHs, Pos, FS, CodeCompleteOpts]( - std::string Contents, Path File, Callback<CompletionList> CB, - llvm::Expected<InputsAndPreamble> IP) { + auto Task = [PCHs, Pos, FS, + CodeCompleteOpts](Path File, Callback<CompletionList> CB, + llvm::Expected<InputsAndPreamble> IP) { assert(IP && "error when trying to read preamble for codeComplete"); auto PreambleData = IP->Preamble; // FIXME(ibiryukov): even if Preamble is non-null, we may want to check // both the old and the new version in case only one of them matches. CompletionList Result = clangd::codeComplete( File, IP->Command, PreambleData ? &PreambleData->Preamble : nullptr, - Contents, Pos, FS, PCHs, CodeCompleteOpts); + IP->Contents, Pos, FS, PCHs, CodeCompleteOpts); CB(std::move(Result)); }; - WorkScheduler.runWithPreamble( - "CodeComplete", File, - Bind(Task, std::move(*Latest.Draft), File.str(), std::move(CB))); + WorkScheduler.runWithPreamble("CodeComplete", File, + Bind(Task, File.str(), std::move(CB))); } void ClangdServer::signatureHelp(PathRef File, Position Pos, @@ -183,21 +182,19 @@ auto PCHs = this->PCHs; auto FS = FSProvider.getFileSystem(); - auto Action = [Pos, FS, PCHs](std::string Contents, Path File, - Callback<SignatureHelp> CB, + auto Action = [Pos, FS, PCHs](Path File, Callback<SignatureHelp> CB, llvm::Expected<InputsAndPreamble> IP) { if (!IP) return CB(IP.takeError()); auto PreambleData = IP->Preamble; CB(clangd::signatureHelp(File, IP->Command, PreambleData ? &PreambleData->Preamble : nullptr, - Contents, Pos, FS, PCHs)); + IP->Contents, Pos, FS, PCHs)); }; - WorkScheduler.runWithPreamble( - "SignatureHelp", File, - Bind(Action, std::move(*Latest.Draft), File.str(), std::move(CB))); + WorkScheduler.runWithPreamble("SignatureHelp", File, + Bind(Action, File.str(), std::move(CB))); } llvm::Expected<tooling::Replacements>
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits