Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks! This seems totally complete now, though I bet there's another case possible somehow!
clang-tools-extra/clangd/FindSymbols.cpp | ||
---|---|---|
157 | Hmm... the common file-location case takes a pretty weird path here: both NameLoc and FallbackNameLoc end up set to Loc, and hopefully we never hit the !contains condition (but if we did, we'd just calculate it twice and then hit the second fallback) Maybe clearer, though a little longer, to handle explicitly like SourceLocation NameLoc = ND.getLocation(); SourceLocation FallbackNameLoc; if (NameLoc.isMacroLocation()) { if (spelled in source) { NameLoc = getSpelling FallbackNameLoc = getExpanson } else { NameLoc = getExpansion } } up to you | |
clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp | ||
636 | nit: despite the "contains" relation being critical, I think it's worth asserting the exact range |
Hmm... the common file-location case takes a pretty weird path here: both NameLoc and FallbackNameLoc end up set to Loc, and hopefully we never hit the !contains condition (but if we did, we'd just calculate it twice and then hit the second fallback)
Maybe clearer, though a little longer, to handle explicitly like
up to you