[PATCH] D76451: [clangd] Enable textual fallback for go-to-definition on dependent names

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 23:18:40 PDT 2020


nridge added inline comments.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:569
       ASTResults = locateASTReferent(NearbyIdent->location(), NearbyIdent, AST,
-                                     *MainFilePath, Index);
+                                     *MainFilePath, Index, &IsDependentName);
       if (!ASTResults.empty())
----------------
sammccall wrote:
> the way the two (possible!) writes get combined is not obvious here.
> 
> I'd suggest using two different variables and writing `IsDependent || IsNearbyIdentDependent` in the usage below, if that's the intent.
Good catch. There's actually no point letting this second `locateASTReferent()` call set `IsDependentName`, because `IsDependentName` only changes the outcome if the original location was an expanded token, but `findNearbyIdentifier()` bails in that case. So now I just pass nullptr instead.

(We could work harder and make "comment referencing nearby dependent name" work, but I think that's enough of an edge that I didn't bother.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76451





More information about the cfe-commits mailing list