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);
55 std::vector<Declaration> DeclarationList;
62 SmallVector<std::string, 4>
Names;
121 void run(
const ast_matchers::MatchFinder::MatchResult &Result)
override;
136 void addIncludes(llvm::StringRef IncludeHeader,
bool IsAngled,
137 llvm::StringRef SearchPath, llvm::StringRef FileName,
138 clang::CharSourceRange IncludeFilenameRange,
139 const SourceManager &SM);
149 return UnremovedDeclsInOldHeader;
155 std::string makeAbsolutePath(StringRef Path);
157 void removeDeclsInOldFiles();
158 void moveDeclsToNewFiles();
159 void moveAll(SourceManager& SM, StringRef OldFile, StringRef NewFile);
162 std::vector<std::unique_ptr<ast_matchers::MatchFinder::MatchCallback>>
168 std::vector<const NamedDecl *> MovedDecls;
170 std::vector<const NamedDecl *> RemovedDecls;
172 std::vector<std::string> HeaderIncludes;
174 std::vector<std::string> CCIncludes;
178 std::vector<const NamedDecl *> HelperDeclarations;
180 llvm::SmallPtrSet<const NamedDecl*, 8> UnremovedDeclsInOldHeader;
184 clang::CharSourceRange OldHeaderIncludeRangeInCC;
188 clang::CharSourceRange OldHeaderIncludeRangeInHeader;
191 llvm::StringMap<FileID> FilePathToFileID;
204 : MoveTool(Context, Reporter) {
205 MoveTool.registerMatchers(&MatchFinder);
210 std::unique_ptr<clang::ASTConsumer>
212 llvm::StringRef InFile)
override;
215 ast_matchers::MatchFinder MatchFinder;
223 : Context(Context), Reporter(Reporter) {}
225 std::unique_ptr<clang::FrontendAction>
create()
override {
226 return std::make_unique<ClangMoveAction>(Context, Reporter);
ClangMoveActionFactory(ClangMoveContext *const Context, DeclarationReporter *const Reporter=nullptr)
std::unique_ptr< clang::FrontendAction > create() override
~ClangMoveAction() override=default
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &Compiler, llvm::StringRef InFile) override
ClangMoveAction(ClangMoveContext *const Context, DeclarationReporter *const Reporter)
~DeclarationReporter()=default
void reportDeclaration(llvm::StringRef DeclarationName, llvm::StringRef Type, bool Templated)
DeclarationReporter()=default
ArrayRef< Declaration > getDeclarationList() const
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::map< std::string, tooling::Replacements > & FileToReplacements
std::string FallbackStyle
std::string OriginalRunningDirectory
std::string QualifiedName
Declaration(llvm::StringRef QName, llvm::StringRef Kind, bool Templated)
friend bool operator==(const Declaration &LHS, const Declaration &RHS)
SmallVector< std::string, 4 > Names