[PATCH] D53019: [clangd] dump xrefs information in dexp tool.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 9 06:21:14 PDT 2018


sammccall added inline comments.


================
Comment at: clangd/index/dex/dexp/Dexp.cpp:172
+      "filter", cl::init(".*"),
+      cl::desc("Print all results from files matching this filter."),
+  };
----------------
filter -> regular expression


================
Comment at: clangd/index/dex/dexp/Dexp.cpp:191
+    Index->refs(RefRequest, [&RegexFilter](const clang::clangd::Ref &R) {
+      if (RegexFilter.match(R.Location.FileURI))
+        llvm::outs() << R << "\n";
----------------
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?


================
Comment at: clangd/index/dex/dexp/Dexp.cpp:204
     {"lookup", "Dump symbol details by ID", llvm::make_unique<Lookup>},
+    {"refs", "Find references by qualified name", llvm::make_unique<Refs>},
 };
----------------
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)




Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53019





More information about the cfe-commits mailing list