[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
diff --git a/clang-tools-extra/clangd/ProtocolHandlers.cpp b/clang-tools-extra/clangd/ProtocolHandlers.cpp
index 9f6f335..7d905bc 100644
--- a/clang-tools-extra/clangd/ProtocolHandlers.cpp
+++ b/clang-tools-extra/clangd/ProtocolHandlers.cpp
@@ -25,17 +25,16 @@
struct HandlerRegisterer {
template <typename Param>
void operator()(StringRef Method,
- void (ProtocolCallbacks::*Handler)(RequestContext, Param)) {
+ void (ProtocolCallbacks::*Handler)(Context, Param)) {
// Capture pointers by value, as the lambda will outlive this object.
- auto *Out = this->Out;
auto *Callbacks = this->Callbacks;
Dispatcher.registerHandler(
- Method, [=](RequestContext C, const json::Expr &RawParams) {
+ Method, [=](Context C, const json::Expr &RawParams) {
typename std::remove_reference<Param>::type P;
if (fromJSON(RawParams, P)) {
(Callbacks->*Handler)(std::move(C), P);
} else {
- Out->log("Failed to decode " + Method + " request.");
+ log(C, "Failed to decode " + Method + " request.");
}
});
}