[PATCH] D72041: [clangd] Handle go-to-definition in macro invocations where the target appears in the expansion multiple times

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 14 13:38:12 PST 2020


nridge added a comment.

In D72041#1800189 <https://reviews.llvm.org/D72041#1800189>, @sammccall wrote:

> - the allSelectedNodes API on SelectionTree feels non-orthogonal: it's only meaningful here because the input happened to be a point and thus touches a single token and therefore node. If the input was a range, then this API doesn't help, because it loses the sense of "topmost" node.


Good point!

> - maybe the function we want walks down the tree as if finding the common ancestor, but may descend to return the roots of multiple subtrees if they are located in distinct expansions of the same macro arg
> - or maybe we just want to treat non-first expansions as not-selected? That would about this issue I think

I'm thinking of going with the second suggestion, because it doesn't require changes to the SelectionTree API, and therefore addresses this concern:

> - it seems unfortunate to solve this mostly in xrefs rather than mostly in SelectionTree. All the other clients potentially want this behavior.

without touching all the clients of SelectionTree.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72041





More information about the cfe-commits mailing list