[PATCH] D30720: [include-fixer] Add fuzzy SymbolIndex, where identifier needn't match exactly.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 7 14:14:07 PST 2017


sammccall created this revision.
Herald added a subscriber: mgorny.

Add fuzzy SymbolIndex, where identifier needn't match exactly.

The purpose for this is global autocomplete in clangd. The query will be a
partial identifier up to the cursor, and the results will be suggestions.

It's in include-fixer because:

- it handles SymbolInfos, actually SymbolIndex is exactly the right interface
- it's a good harness for lit testing the fuzzy YAML index
- (Laziness: we can't unit test clangd until reorganizing with a tool/ dir)

Other questionable choices:

- FuzzySymbolIndex, which just refines the contract of SymbolIndex. This is an interface to allow extension to large monorepos (*cough*)
- an always-true safety check that Identifier == Name is removed from SymbolIndexManager, as it's not true for fuzzy matching
- exposing -db=fuzzyYaml from include-fixer is not a very useful feature, and a non-orthogonal ui (fuzziness vs data source). -db=fixed is similar though.


https://reviews.llvm.org/D30720

Files:
  include-fixer/CMakeLists.txt
  include-fixer/FuzzySymbolIndex.cpp
  include-fixer/FuzzySymbolIndex.h
  include-fixer/SymbolIndexManager.cpp
  include-fixer/tool/ClangIncludeFixer.cpp
  test/include-fixer/Inputs/fake_yaml_db.yaml
  test/include-fixer/yaml_fuzzy.cpp
  unittests/include-fixer/CMakeLists.txt
  unittests/include-fixer/FuzzySymbolIndexTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30720.90939.patch
Type: text/x-patch
Size: 16578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170307/6aa31f86/attachment-0001.bin>


More information about the cfe-commits mailing list