[PATCH] D75166: [clangd] Clean-up XRefs.cpp from Lexer usages and unnecessary SourceLoc transformations

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 08:14:34 PST 2020


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:432
   auto References = findRefs(
-      getDeclAtPosition(AST,
-                        SM.getMacroArgExpandedLocation(getBeginningOfIdentifier(
-                            Pos, SM, AST.getLangOpts())),
-                        Relations),
-      AST);
+      getDeclAtPosition(AST, IdentifierAtCursor->location(), Relations), AST);
 
----------------
kadircet wrote:
> sammccall wrote:
> > apparently we don't have tests for non-identifier cases, but they did work. let's keep them working for now :) CurLoc here
> also get rid of the bail-out when no tokens were touched. (which means we can now possibly trigger on `^~Foo()`.)
can I bother you to add a test for this (or some non-identifier case, assuming any works)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75166





More information about the cfe-commits mailing list