[PATCH] D30210: [include-fixer] Add usage count to find-all-symbols.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 21 09:28:57 PST 2017


sammccall created this revision.

Add usage count to find-all-symbols.

FindAllSymbols now finds (most!) main-file usages of the discovered symbols.
The per-TU map output has NumUses=0 or 1 (only one use per file is counted).
The reducer aggregates these to find the number of files that use a symbol.

The NumOccurrences is now set to 1 in the mapper rather than being inferred by
the reducer, for consistency.

The idea here is to use NumUses for ranking: intuitively number of files that
use a symbol is more meaningful than number of files that include the header.


https://reviews.llvm.org/D30210

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/SymbolIndexManager.cpp
  include-fixer/find-all-symbols/FindAllSymbols.cpp
  include-fixer/find-all-symbols/SymbolInfo.cpp
  include-fixer/find-all-symbols/SymbolInfo.h
  include-fixer/find-all-symbols/SymbolReporter.h
  include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
  test/include-fixer/Inputs/fake_yaml_db.yaml
  test/include-fixer/Inputs/merge/a.yaml
  test/include-fixer/Inputs/merge/b.yaml
  test/include-fixer/merge.test
  unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30210.89234.patch
Type: text/x-patch
Size: 32335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170221/6e076f41/attachment-0001.bin>


More information about the cfe-commits mailing list