#include "Move.h"
#include "HelperDeclRefGraph.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Format/Format.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "clang/Tooling/Core/Replacement.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Path.h"
#define DEBUG_TYPE …
usingnamespaceclang::ast_matchers;
namespace clang {
namespace move {
namespace {
AST_MATCHER(VarDecl, isStaticDataMember) { … }
AST_MATCHER(NamedDecl, notInMacro) { … }
AST_MATCHER_P(Decl, hasOutermostEnclosingClass,
ast_matchers::internal::Matcher<Decl>, InnerMatcher) { … }
AST_MATCHER_P(CXXMethodDecl, ofOutermostEnclosingClass,
ast_matchers::internal::Matcher<CXXRecordDecl>, InnerMatcher) { … }
std::string CleanPath(StringRef PathRef) { … }
std::string MakeAbsolutePath(StringRef CurrentDir, StringRef Path) { … }
std::string MakeAbsolutePath(const SourceManager &SM, StringRef Path) { … }
AST_POLYMORPHIC_MATCHER_P(isExpansionInFile,
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc),
std::string, AbsoluteFilePath) { … }
class FindAllIncludes : public PPCallbacks { … };
void MoveDeclFromOldFileToNewFile(ClangMoveTool *MoveTool, const NamedDecl *D) { … }
class FunctionDeclarationMatch : public MatchFinder::MatchCallback { … };
class VarDeclarationMatch : public MatchFinder::MatchCallback { … };
class TypeAliasMatch : public MatchFinder::MatchCallback { … };
class EnumDeclarationMatch : public MatchFinder::MatchCallback { … };
class ClassDeclarationMatch : public MatchFinder::MatchCallback { … };
SourceLocation getLocForEndOfDecl(const Decl *D,
const LangOptions &LangOpts = LangOptions()) { … }
CharSourceRange getFullRange(const Decl *D,
const LangOptions &options = LangOptions()) { … }
std::string getDeclarationSourceText(const Decl *D) { … }
bool isInHeaderFile(const Decl *D, llvm::StringRef OriginalRunningDirectory,
llvm::StringRef OldHeader) { … }
std::vector<std::string> getNamespaces(const Decl *D) { … }
tooling::Replacements
createInsertedReplacements(const std::vector<std::string> &Includes,
const std::vector<const NamedDecl *> &Decls,
llvm::StringRef FileName, bool IsHeader = false,
StringRef OldHeaderInclude = "") { … }
llvm::DenseSet<const Decl *>
getUsedDecls(const HelperDeclRefGraph *RG,
const std::vector<const NamedDecl *> &Decls) { … }
}
std::unique_ptr<ASTConsumer>
ClangMoveAction::CreateASTConsumer(CompilerInstance &Compiler,
StringRef ) { … }
ClangMoveTool::ClangMoveTool(ClangMoveContext *const Context,
DeclarationReporter *const Reporter)
: … { … }
void ClangMoveTool::addRemovedDecl(const NamedDecl *Decl) { … }
void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) { … }
void ClangMoveTool::run(const ast_matchers::MatchFinder::MatchResult &Result) { … }
std::string ClangMoveTool::makeAbsolutePath(StringRef Path) { … }
void ClangMoveTool::addIncludes(llvm::StringRef IncludeHeader, bool IsAngled,
llvm::StringRef SearchPath,
llvm::StringRef FileName,
CharSourceRange IncludeFilenameRange,
const SourceManager &SM) { … }
void ClangMoveTool::removeDeclsInOldFiles() { … }
void ClangMoveTool::moveDeclsToNewFiles() { … }
void ClangMoveTool::moveAll(SourceManager &SM, StringRef OldFile,
StringRef NewFile) { … }
void ClangMoveTool::onEndOfTranslationUnit() { … }
}
}