This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Attach more information about Sema completion to traces
ClosedPublic

Authored by ilya-biryukov on Feb 16 2018, 2:31 AM.

Diff Detail

Event Timeline

ilya-biryukov created this revision.Feb 16 2018, 2:31 AM

Technically this is NFC, but it has a huge toString helper and I'm not sure if I chose the appropriate place for logging the filename.

This looks really useful! Main suggestion is to drop the added span and attach kind to the main span instead. (It's relevant to index too, not just to sema)

clangd/CodeComplete.cpp
429

hmm, this really looks like it belongs next to CodeCompletionContext::Kind?

453

I think this span is going to be tiny (hard to see in some UIs!) and generally not add a lot of value itself.
The nicest thing would be to just grab the kind out of the CCcontext and attach it to the span in CodeCompleteFlow::run()

My instinct is that the #items can be dropped entirely - we already log the number of items from Sema considered (before Limit) so all we'd be losing is the number hidden/ineligible/destructor completions we drop here, which seems uninteresting for tracing purposes.
(But exposing that from the recorder is another option)

454

sema_results_prefilter?
the filtering is the only difference between this and sema_results logged below

867

FWIW, I have a (delayed, sorry) patch to add a span to all actions run by TUscheduler, which would log the filename. If that lands, *maybe* we don't want it in both places (it'd be the parent span of this one)? But not sure.

ilya-biryukov marked 2 inline comments as done.
  • Attach completion kind in CodeCompleteFlow::run().
  • Move printCompletionKind closer to CompletionContext::Kind.
  • Added FIXME to remove tracing of filename.
ilya-biryukov marked an inline comment as done.Feb 16 2018, 3:27 AM
ilya-biryukov added inline comments.
clangd/CodeComplete.cpp
453

You're right, they shouldn't be too important, completion kind is quite useful information, though.
I've moved attaching of the completion kind to CodeCompleteFlow::run()

454

Removed this altogether.

867

LGTM to logging this in TUScheduler. I've added a FIXME to this patch.

  • Rename usage of printCompletionKind to getCompletionKindString
  • Remove tracing of the filename, TUScheduler now provides those traces
sammccall accepted this revision.Feb 19 2018, 4:29 AM
This revision is now accepted and ready to land.Feb 19 2018, 4:29 AM