[PATCH] D40486: [clangd] Implemented logging using Context
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 7 01:34:30 PST 2017
sammccall added inline comments.
================
Comment at: clangd/JSONRPCDispatcher.cpp:23
+namespace {
+static Key<std::unique_ptr<trace::Span>> TracerKey;
+static Key<json::Expr> IDKey;
----------------
sammccall wrote:
> RequestTracer?
actually, RequestSpan I think - "tracer" is pretty confusing at global scope
================
Comment at: clangd/JSONRPCDispatcher.cpp:70
+
+ SPAN_ATTACH(*Ctx->getExisting(TracerKey), "Reply", Result);
+ Ctx->getPtr(OutKey)->writeMessage(json::obj{
----------------
Depending on a span tracer existing seems needlessly brittle. What about
if (auto *Tracer = Ctx->get(TracerKey))
SPAN_ATTACH(*Tracer, ...)
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D40486
More information about the cfe-commits
mailing list