#include "clang/Tooling/Refactoring/Rename/RenamingAction.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/FileManager.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Refactoring.h"
#include "clang/Tooling/Refactoring/RefactoringAction.h"
#include "clang/Tooling/Refactoring/RefactoringDiagnostic.h"
#include "clang/Tooling/Refactoring/RefactoringOptions.h"
#include "clang/Tooling/Refactoring/Rename/SymbolName.h"
#include "clang/Tooling/Refactoring/Rename/USRFinder.h"
#include "clang/Tooling/Refactoring/Rename/USRFindingAction.h"
#include "clang/Tooling/Refactoring/Rename/USRLocFinder.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include <string>
#include <vector>
usingnamespacellvm;
namespace clang {
namespace tooling {
namespace {
Expected<SymbolOccurrences>
findSymbolOccurrences(const NamedDecl *ND, RefactoringRuleContext &Context) { … }
}
const RefactoringDescriptor &RenameOccurrences::describe() { … }
Expected<RenameOccurrences>
RenameOccurrences::initiate(RefactoringRuleContext &Context,
SourceRange SelectionRange, std::string NewName) { … }
const NamedDecl *RenameOccurrences::getRenameDecl() const { … }
Expected<AtomicChanges>
RenameOccurrences::createSourceReplacements(RefactoringRuleContext &Context) { … }
Expected<QualifiedRenameRule>
QualifiedRenameRule::initiate(RefactoringRuleContext &Context,
std::string OldQualifiedName,
std::string NewQualifiedName) { … }
const RefactoringDescriptor &QualifiedRenameRule::describe() { … }
Expected<AtomicChanges>
QualifiedRenameRule::createSourceReplacements(RefactoringRuleContext &Context) { … }
Expected<std::vector<AtomicChange>>
createRenameReplacements(const SymbolOccurrences &Occurrences,
const SourceManager &SM, const SymbolName &NewName) { … }
static void convertChangesToFileReplacements(
ArrayRef<AtomicChange> AtomicChanges,
std::map<std::string, tooling::Replacements> *FileToReplaces) { … }
class RenamingASTConsumer : public ASTConsumer { … };
class USRSymbolRenamer : public ASTConsumer { … };
std::unique_ptr<ASTConsumer> RenamingAction::newASTConsumer() { … }
std::unique_ptr<ASTConsumer> QualifiedRenamingAction::newASTConsumer() { … }
}
}