[PATCH] D68977: [clangd] Report declaration references in findExplicitReferences.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 02:56:11 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:495
   struct Visitor : TypeLocVisitor<Visitor> {
-    llvm::Optional<ReferenceLoc> Ref;
+    llvm::SmallVector<ReferenceLoc, 2> Refs;
 
----------------
Could we keep an `llvm::Optional<>` here in the visitor?
The logic in `VisitElaboratedTypeLoc` looks cheesy if there's more than 1 reference stored...

The function can keep returning `SmallVector`, that's totally fine.


================
Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:603
            "0: targets = {ns}\n"
-           "1: targets = {ns::global}, qualifier = 'ns::'\n"},
+           "1: targets = {ns::global}, qualifier = 'ns::', decl\n"},
           // Simple types.
----------------
Similar to `using namespace`, this should be a non-decl reference.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68977/new/

https://reviews.llvm.org/D68977





More information about the cfe-commits mailing list