Index: cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp =================================================================== --- cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp +++ cfe/trunk/lib/Tooling/Refactoring/Rename/RenamingAction.cpp @@ -43,22 +43,14 @@ namespace { -class OccurrenceFinder final : public FindSymbolOccurrencesRefactoringRule { -public: - OccurrenceFinder(const NamedDecl *ND) : ND(ND) {} - - Expected - findSymbolOccurrences(RefactoringRuleContext &Context) override { - std::vector USRs = - getUSRsForDeclaration(ND, Context.getASTContext()); - std::string PrevName = ND->getNameAsString(); - return getOccurrencesOfUSRs( - USRs, PrevName, Context.getASTContext().getTranslationUnitDecl()); - } - -private: - const NamedDecl *ND; -}; +Expected +findSymbolOccurrences(const NamedDecl *ND, RefactoringRuleContext &Context) { + std::vector USRs = + getUSRsForDeclaration(ND, Context.getASTContext()); + std::string PrevName = ND->getNameAsString(); + return getOccurrencesOfUSRs(USRs, PrevName, + Context.getASTContext().getTranslationUnitDecl()); +} } // end anonymous namespace @@ -85,8 +77,7 @@ Expected RenameOccurrences::createSourceReplacements(RefactoringRuleContext &Context) { - Expected Occurrences = - OccurrenceFinder(ND).findSymbolOccurrences(Context); + Expected Occurrences = findSymbolOccurrences(ND, Context); if (!Occurrences) return Occurrences.takeError(); // FIXME: Verify that the new name is valid.