This is useful for running in batch mode.
Getting the SymbolID from via getSymbolInfo may give SymbolID
of a symbol different from that located by LocateSymbolAt (they
have different semantics of choosing the symbol.)
Details
- Reviewers
sammccall - Commits
- rGd7cb2305a1e8: [clangd] Add SymbolID to LocatedSymbol.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LG, but can you amend the description a bit?
We do not have to both locate the symbol and also query the SymbolID (using getSymbolInfo).
IIRC this isn't really the reason, it's because getSymbolInfo and locateSymbolAt don't have the same semantics *for choosing symbols* and we want the ID of the symbol that matches the latter.
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
260 | note that this populates SymbolID even if there's no ID available, so it's incorrect if the type is Optional<SymbolID> | |
clang-tools-extra/clangd/XRefs.h | ||
51 | There are other cases too, maybe just "if available" | |
52 | SymbolID is already inherently optional (it has a zero value for a whil enow) | |
clang-tools-extra/clangd/unittests/XRefsTests.cpp | ||
923 | nit, just EXPECT_TRUE(Results[0].ID), and remove the matcher? |
There are other cases too, maybe just "if available"