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;
75 bool OldDependOnNew =
false;
78 bool NewDependOnOld =
false;
121 void registerMatchers(ast_matchers::MatchFinder *Finder);
123 void run(
const ast_matchers::MatchFinder::MatchResult &
Result)
override;
125 void onEndOfTranslationUnit()
override;
139 llvm::StringRef SearchPath, llvm::StringRef
FileName,
140 clang::CharSourceRange IncludeFilenameRange,
141 const SourceManager &SM);
148 void addRemovedDecl(
const NamedDecl *Decl);
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) {
207 MoveTool.registerMatchers(&MatchFinder);
212 std::unique_ptr<clang::ASTConsumer>
213 CreateASTConsumer(clang::CompilerInstance &Compiler,
214 llvm::StringRef InFile)
override;
217 ast_matchers::MatchFinder MatchFinder;
225 : Context(Context), Reporter(Reporter) {}
227 clang::FrontendAction *
create()
override {
240 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_MOVE_CLANGMOVE_H void reportDeclaration(llvm::StringRef DeclarationName, llvm::StringRef Type, bool Templated)
std::string OriginalRunningDirectory
clang::FrontendAction * create() override
SmallVector< std::string, 4 > Names
std::vector< HeaderHandle > Path
std::string FallbackStyle
Declaration(llvm::StringRef QName, llvm::StringRef Kind, bool Templated)
ClangMoveAction(ClangMoveContext *const Context, DeclarationReporter *const Reporter)
bool IsAngled
true if this was an include with angle brackets
std::string QualifiedName
const std::vector< Declaration > getDeclarationList() const
ClangMoveActionFactory(ClangMoveContext *const Context, DeclarationReporter *const Reporter=nullptr)
~DeclarationReporter()=default
std::map< std::string, tooling::Replacements > & FileToReplacements
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::string IncludeHeader
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
DeclarationReporter()=default
friend bool operator==(const Declaration &LHS, const Declaration &RHS)