//===-- Move.h - Clang move ----------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_MOVE_CLANGMOVE_H #define LLVM_CLANG_TOOLS_EXTRA_CLANG_MOVE_CLANGMOVE_H #include "HelperDeclRefGraph.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Frontend/FrontendAction.h" #include "clang/Tooling/Core/Replacement.h" #include "clang/Tooling/Tooling.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include <map> #include <memory> #include <string> #include <vector> namespace clang { namespace move { // A reporter which collects and reports declarations in old header. class DeclarationReporter { … }; // Specify declarations being moved. It contains all information of the moved // declarations. struct MoveDefinitionSpec { … }; // A Context which contains extra options which are used in ClangMoveTool. struct ClangMoveContext { … }; // This tool is used to move class/function definitions from the given source // files (old.h/cc) to new files (new.h/cc). // The goal of this tool is to make the new/old files as compilable as possible. // // When moving a symbol,all used helper declarations (e.g. static // functions/variables definitions in global/named namespace, // functions/variables/classes definitions in anonymous namespace) used by the // moved symbol in old.cc are moved to the new.cc. In addition, all // using-declarations in old.cc are also moved to new.cc; forward class // declarations in old.h are also moved to new.h. // // The remaining helper declarations which are unused by non-moved symbols in // old.cc will be removed. // // Note: When all declarations in old header are being moved, all code in // old.h/cc will be moved, which means old.h/cc are empty. This ignores symbols // that are not supported (e.g. typedef and enum) so that we always move old // files to new files when all symbols produced from dump_decls are moved. class ClangMoveTool : public ast_matchers::MatchFinder::MatchCallback { … }; class ClangMoveAction : public clang::ASTFrontendAction { … }; class ClangMoveActionFactory : public tooling::FrontendActionFactory { … }; } // namespace move } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_MOVE_CLANGMOVE_H