[PATCH] D40489: [clangd] Changed tracing interfaces

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 03:25:38 PST 2017


sammccall added inline comments.


================
Comment at: clangd/Trace.cpp:138
     return;
-  if (!Args)
-    Args = llvm::make_unique<json::obj>();
-  T->event(Ctx, "E",
-           Args ? json::obj{{"args", std::move(*Args)}} : json::obj{});
+  assert(Args && "Args can't be null at this point");
+  T->end_event(Ctx, Name, std::move(*Args));
----------------
ilya-biryukov wrote:
> sammccall wrote:
> > why not?
> Because `T` must outlive the `Span`, so we can't really have `if (!T)` evaluate to different things in constructor and destructor.
> Am I missing something?
I was being disingenuous, I agree with you.
But can you change the message to "Changed tracer during a span"?

assert(Args) and "Args can't be null at this point" are basically synonyms :-)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D40489





More information about the cfe-commits mailing list