clang 20.0.0git
|
A tool to run refactorings. More...
#include "clang/Tooling/Refactoring.h"
Public Member Functions | |
RefactoringTool (const CompilationDatabase &Compilations, ArrayRef< std::string > SourcePaths, std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >()) | |
std::map< std::string, Replacements > & | getReplacements () |
Returns the file path to replacements map to which replacements should be added during the run of the tool. | |
int | runAndSave (FrontendActionFactory *ActionFactory) |
Call run(), apply all generated replacements, and immediately save the results to disk. | |
bool | applyAllReplacements (Rewriter &Rewrite) |
Apply all stored replacements to the given Rewriter. | |
Public Member Functions inherited from clang::tooling::ClangTool | |
ClangTool (const CompilationDatabase &Compilations, ArrayRef< std::string > SourcePaths, std::shared_ptr< PCHContainerOperations > PCHContainerOps=std::make_shared< PCHContainerOperations >(), IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS=llvm::vfs::getRealFileSystem(), IntrusiveRefCntPtr< FileManager > Files=nullptr) | |
Constructs a clang tool to run over a list of files. | |
~ClangTool () | |
void | setDiagnosticConsumer (DiagnosticConsumer *DiagConsumer) |
Set a DiagnosticConsumer to use during parsing. | |
void | mapVirtualFile (StringRef FilePath, StringRef Content) |
Map a virtual file to be used while running the tool. | |
void | appendArgumentsAdjuster (ArgumentsAdjuster Adjuster) |
Append a command line arguments adjuster to the adjuster chain. | |
void | clearArgumentsAdjusters () |
Clear the command line arguments adjuster chain. | |
int | run (ToolAction *Action) |
Runs an action over all files specified in the command line. | |
int | buildASTs (std::vector< std::unique_ptr< ASTUnit > > &ASTs) |
Create an AST for each file specified in the command line and append them to ASTs. | |
void | setPrintErrorMessage (bool PrintErrorMessage) |
Sets whether an error message should be printed out if an action fails. | |
FileManager & | getFiles () |
Returns the file manager used in the tool. | |
llvm::ArrayRef< std::string > | getSourcePaths () const |
A tool to run refactorings.
This is a refactoring specific version of
Definition at line 37 of file Refactoring.h.
clang::tooling::RefactoringTool::RefactoringTool | ( | const CompilationDatabase & | Compilations, |
ArrayRef< std::string > | SourcePaths, | ||
std::shared_ptr< PCHContainerOperations > | PCHContainerOps = std::make_shared<PCHContainerOperations>() |
||
) |
Definition at line 27 of file Refactoring.cpp.
Apply all stored replacements to the given Rewriter.
FileToReplaces will be deduplicated with groupReplacementsByFile
before application.
Replacement applications happen independently of the success of other applications.
Definition at line 57 of file Refactoring.cpp.
References clang::tooling::applyAllReplacements(), clang::tooling::groupReplacementsByFile(), clang::Result, and clang::Rewrite.
Referenced by runAndSave().
std::map< std::string, Replacements > & clang::tooling::RefactoringTool::getReplacements | ( | ) |
Returns the file path to replacements map to which replacements should be added during the run of the tool.
Definition at line 32 of file Refactoring.cpp.
int clang::tooling::RefactoringTool::runAndSave | ( | FrontendActionFactory * | ActionFactory | ) |
Call run(), apply all generated replacements, and immediately save the results to disk.
Definition at line 36 of file Refactoring.cpp.
References applyAllReplacements(), clang::tooling::ClangTool::getFiles(), clang::Result, clang::Rewrite, and clang::tooling::ClangTool::run().