[PATCH] D42942: [clangd] Collect definitions when indexing.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 5 18:05:31 PST 2018
sammccall created this revision.
sammccall added reviewers: ioeric, hokein.
Herald added subscribers: cfe-commits, jkorous-apple, ilya-biryukov, klimek.
(This isn't done! Needs new tests, and some random cleanups should be split out.
Looking for some early feedback.)
Within a TU:
- as now, collect a declaration from the first occurrence of a symbol (taking clang's canonical declaration)
- when we first see a definition occurrence, copy the symbol and add it
Across TUs/sources:
- mergeSymbol in Merge.h is responsible for combining matching Symbols. This covers dynamic/static merges and cross-TU merges in the static index.
- it prefers declarations from Symbols that have a definition.
- GlobalSymbolBuilderMain is modified to use mergeSymbol as a reduce step.
Random cleanups (can be pulled out):
- SymbolFromYAML -> SymbolsFromYAML, new singular SymbolFromYAML added
- avoid uninit'd SymbolLocations. Add an idiomatic way to check "absent".
- CanonicalDeclaration (as well as Definition) are mapped as optional in YAML.
- added operator<< for Symbol & SymbolLocation, for debugging
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D42942
Files:
clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp
clangd/index/Index.cpp
clangd/index/Index.h
clangd/index/Merge.cpp
clangd/index/SymbolCollector.cpp
clangd/index/SymbolCollector.h
clangd/index/SymbolYAML.cpp
clangd/index/SymbolYAML.h
clangd/tool/ClangdMain.cpp
unittests/clangd/SymbolCollectorTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42942.132927.patch
Type: text/x-patch
Size: 19446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180206/0baa0915/attachment-0001.bin>
More information about the cfe-commits
mailing list