This is an archive of the discontinued LLVM Phabricator instance.

[refactor][rename] Use a single base class for class that finds a declaration at location and for class that searches for all occurrences of a specific declaration
ClosedPublic

Authored by arphaman on Jul 3 2017, 8:18 AM.

Details

Summary
  • Use single RecursiveSymbolVisitor class for both USRLocFindingASTVisitor and NamedDeclOccurrenceFindingVisitor to avoid duplicate visiting code.
  • Traverse nested name specifier locs in the new class and remove the separate matching step.
  • New class NamedDeclFindingVisitor handles search for a declaration by name. We don't have to visit each occurrence to find the declaration, so a simple NamedDecl search should be enough.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Jul 3 2017, 8:18 AM

This is meant to be NFC btw.

arphaman updated this revision to Diff 105084.Jul 3 2017, 8:31 AM

Small fixup.

This revision is now accepted and ready to land.Jul 12 2017, 7:19 AM
hokein accepted this revision.Jul 12 2017, 7:47 AM

LGTM.

include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
33 ↗(On Diff #105084)

nit: I'd add a private specifier for these private members, and put it after the public section.

arphaman marked an inline comment as done.Jul 13 2017, 3:36 AM
This revision was automatically updated to reflect the committed changes.