This is an archive of the discontinued LLVM Phabricator instance.

[clangd] dump xrefs information in dexp tool.
ClosedPublic

Authored by hokein on Oct 9 2018, 3:42 AM.

Event Timeline

hokein created this revision.Oct 9 2018, 3:42 AM
sammccall added inline comments.Oct 9 2018, 6:21 AM
clangd/index/dex/dexp/Dexp.cpp
205

filter -> regular expression

224

you're requiring a full match, and matching the URI, which is going to confuse users who try to use a filter of /usr/include/.* or so.

Consider just using the URI path?

251

I'm not sure "by qualified name" is a good idea, at least as the only option:

  • if there are overloads, you can't choose the right one (possible fix: make this a named flag like refs --name foo::bar)
  • you can't search for refs for std::unique without getting std::unique_ptr (possible fix: postfilter by name)
  • it seems inconsistent with Lookup (possible fix: update both)
hokein updated this revision to Diff 168801.Oct 9 2018, 8:02 AM
hokein marked 3 inline comments as done.

Address review comments:

  • provide query by qualified name (with -name)
  • add -name support for Lookup.
hokein added inline comments.Oct 9 2018, 8:03 AM
clangd/index/dex/dexp/Dexp.cpp
251

Sounds fair enough. I think query the symbol by "qualified_name" would be more convenient and practical when we use the tool. ID is not quite straight-forward.

hokein updated this revision to Diff 168802.Oct 9 2018, 8:08 AM

Minor fix.

sammccall added inline comments.Oct 9 2018, 8:09 AM
clangd/index/dex/dexp/Dexp.cpp
64

I don't think this is reasonable behavior. I'd suggest either of:

  • processing all results (this function would return a vector)
  • treat this as an error, the error message should include the ID of each symbol so we can rerun the command in an unambiguous way
170

nit: just "id" with no dash

hokein updated this revision to Diff 169668.Oct 15 2018, 2:56 AM
hokein marked 2 inline comments as done.

Address review comments.

sammccall accepted this revision.Oct 15 2018, 3:32 AM
sammccall added inline comments.
clangd/index/dex/dexp/Dexp.cpp
60

Are you sure you want both foo to mean ::foo only, rather than accept any scope and the user can type ::foo for explicitly global scope?

63

stale comment

183

clang-format

187

(nit: why not just initialize in place above?)

This revision is now accepted and ready to land.Oct 15 2018, 3:32 AM
hokein updated this revision to Diff 169683.Oct 15 2018, 5:33 AM
hokein marked 3 inline comments as done.

Fix global scope, and clang-format.

hokein added inline comments.Oct 15 2018, 5:33 AM
clangd/index/dex/dexp/Dexp.cpp
60

Oops, this is not intended. "foo" and "::foo" are different.

187

In fact, Request.IDs and IDs are different types, and DenseSet is missing such constructor :(

This revision was automatically updated to reflect the committed changes.
sammccall added inline comments.Oct 15 2018, 5:42 AM
clangd/index/dex/dexp/Dexp.cpp
187

I meant, why does the local variable "IDs" exist at all? Why not just populate Request.IDs directly?