9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_MOVE_CLANGMOVE_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_MOVE_CLANGMOVE_H
13 #include "clang/ASTMatchers/ASTMatchFinder.h"
14 #include "clang/Frontend/FrontendAction.h"
15 #include "clang/Tooling/Core/Replacement.h"
16 #include "clang/Tooling/Tooling.h"
17 #include "llvm/ADT/SmallPtrSet.h"
18 #include "llvm/ADT/StringMap.h"
19 #include "llvm/ADT/StringRef.h"
36 DeclarationList.emplace_back(DeclarationName,
Type, Templated);
53 return DeclarationList;
57 std::vector<Declaration> DeclarationList;
64 SmallVector<std::string, 4>
Names;
123 void run(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
139 llvm::StringRef SearchPath, llvm::StringRef
FileName,
140 clang::CharSourceRange IncludeFilenameRange,
141 const SourceManager &SM);
151 return UnremovedDeclsInOldHeader;
157 std::string makeAbsolutePath(StringRef
Path);
159 void removeDeclsInOldFiles();
160 void moveDeclsToNewFiles();
161 void moveAll(SourceManager& SM, StringRef OldFile, StringRef NewFile);
164 std::vector<std::unique_ptr<ast_matchers::MatchFinder::MatchCallback>>
170 std::vector<const NamedDecl *> MovedDecls;
172 std::vector<const NamedDecl *> RemovedDecls;
174 std::vector<std::string> HeaderIncludes;
176 std::vector<std::string> CCIncludes;
180 std::vector<const NamedDecl *> HelperDeclarations;
182 llvm::SmallPtrSet<const NamedDecl*, 8> UnremovedDeclsInOldHeader;
186 clang::CharSourceRange OldHeaderIncludeRangeInCC;
190 clang::CharSourceRange OldHeaderIncludeRangeInHeader;
193 llvm::StringMap<FileID> FilePathToFileID;
206 : MoveTool(Context, Reporter) {
212 std::unique_ptr<clang::ASTConsumer>
214 llvm::StringRef InFile)
override;
217 ast_matchers::MatchFinder MatchFinder;
225 : Context(Context), Reporter(Reporter) {}
227 std::unique_ptr<clang::FrontendAction>
create()
override {
228 return std::make_unique<ClangMoveAction>(Context, Reporter);
240 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_MOVE_CLANGMOVE_H