[clangd] Selection: Prune gtest TEST()s earlier
When searching for AST nodes that may overlap the selection, mayHit() was only attempting to prune nodes whose begin/end are both in the main file. While failing to prune never gives wrong results, it hurts performance. In GTest unit-tests, `TEST()` macros at the top level declare classes. These were never pruned and we traversed *every* such class for any selection. We fix this by reasoning about what tokens such a node might claim. They must lie within its ultimate macro expansion range, so if this doesn't overlap with the selection, we can prune the node. Differential Revision: https://reviews.llvm.org/D116978
Loading
Please sign in to comment