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);
const FunctionDecl * Decl
bool IsAngled
true if this was an include with angle brackets
std::vector< HeaderHandle > Path
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
const std::vector< 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