Page MenuHomePhabricator

[indexer] Expose the logic for indexing local symbols through c-index-test and add tests for it
ClosedPublic

Authored by nathawes on Feb 23 2017, 10:17 AM.

Details

Reviewers
akyrtzi
Summary

The indexer has an option to index function-local symbols (IndexFunctionLocals in IndexingOptions) but it's not exposed through c-index-test. This patch:

  • updates c-index-test core -print-source-symbols to additionally take a -include-locals option to turn this on
  • adds a 'Local' symbol property to distinguish function-local symbols from the rest
  • adds a 'Parameter' symbol subkind to distinguish params from regular variables
  • updates the tests to cover the above

Diff Detail

Repository
rL LLVM

Event Timeline

nathawes created this revision.Feb 23 2017, 10:17 AM
akyrtzi accepted this revision.Feb 25 2017, 9:56 PM

Committed in r296282 with a couple of changes:

  • Made it so that parameter definitions have a 'child' relation with their function/method (instead of 'containedBy'). This allows looking up parameters of a function by looking up their children.
  • Given that parameters show up in parent-child hierarchies, I think it is a bit better to make them to a separate 'SymbolKind' instead of a sub-kind. This preserves the property that 'variable' symbol kind does not ever enter a parent-child hierarchy.
This revision is now accepted and ready to land.Feb 25 2017, 9:56 PM
akyrtzi closed this revision.Feb 25 2017, 9:57 PM