clang-tools
6.0.0
|
This file provides the main function for the clang-apply-replacements tool. More...
#include "clang-apply-replacements/Tooling/ApplyReplacements.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Version.h"
#include "clang/Format/Format.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/CommandLine.h"
Go to the source code of this file.
Functions | |
static cl::opt< std::string > | Directory (cl::Positional, cl::Required, cl::desc("<Search Root Directory>")) |
static cl::OptionCategory | ReplacementCategory ("Replacement Options") |
static cl::OptionCategory | FormattingCategory ("Formatting Options") |
static cl::opt< bool > | RemoveTUReplacementFiles ("remove-change-desc-files", cl::desc("Remove the change description files regardless of successful\ "merging/replacing."), cl::init(false), cl::cat(ReplacementCategory)) |
static cl::opt< bool > | DoFormat ("format", cl::desc("Enable formatting of code changed by applying replacements.\ "Use -style to choose formatting style.\"), cl::cat(FormattingCategory)) |
static cl::opt< std::string > | FormatStyleConfig ("style-config", cl::desc("Path to a directory containing a .clang-format file\ "describing a formatting style to use for formatting\" "code when -style=file.\"), cl::init(""), cl::cat(FormattingCategory)) |
static cl::opt< std::string > | FormatStyleOpt ("style", cl::desc(format::StyleOptionHelpDescription), cl::init("LLVM"), cl::cat(FormattingCategory)) |
static void | printVersion (raw_ostream &OS) |
static bool | getRewrittenData (const std::vector< tooling::Replacement > &Replacements, Rewriter &Rewrites, std::string &Result) |
Convenience function to get rewritten content for Filename from Rewrites . More... | |
static bool | applyReplacements (const std::vector< tooling::Replacement > &Replacements, std::string &Result, DiagnosticsEngine &Diagnostics) |
Apply Replacements and return the new file contents. More... | |
static bool | applyFormatting (const std::vector< tooling::Replacement > &Replacements, const StringRef FileData, std::string &FormattedFileData, const format::FormatStyle &FormatStyle, DiagnosticsEngine &Diagnostics) |
Apply code formatting to all places where replacements were made. More... | |
int | main (int argc, char **argv) |
Variables | |
const cl::OptionCategory * | VisibleCategories [] |
This file provides the main function for the clang-apply-replacements tool.
Definition in file ClangApplyReplacementsMain.cpp.
|
static |
Apply code formatting to all places where replacements were made.
[in] | Replacements | Replacements that were made to the file. Provided to indicate where changes were made. |
[in] | FileData | The contents of the file after Replacements have been applied. |
[out] | FormattedFileData | The contents of the file after reformatting. |
[in] | FormatStyle | Style to apply. |
[in] | Diagnostics | For diagnostic output. |
Definition at line 168 of file ClangApplyReplacementsMain.cpp.
References clang::replace::calculateChangedRanges().
|
static |
Apply Replacements
and return the new file contents.
[in] | Replacements | Replacements to apply. |
[out] | Result | Contents of the file after applying replacements if replacements were provided. |
[in] | Diagnostics | For diagnostic output. |
Definition at line 140 of file ClangApplyReplacementsMain.cpp.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Convenience function to get rewritten content for Filename
from Rewrites
.
[in] | Replacements | Replacements to apply |
[in] | Rewrites | Rewriter to use to apply replacements. |
[out] | Result | Contents of the file after applying replacements if replacements were provided. |
Definition at line 104 of file ClangApplyReplacementsMain.cpp.
References clang::replace::applyAllReplacements().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 199 of file ClangApplyReplacementsMain.cpp.
References printVersion().
|
static |
Definition at line 85 of file ClangApplyReplacementsMain.cpp.
Referenced by main().
|
static |
|
static |
const cl::OptionCategory* VisibleCategories[] |
Definition at line 37 of file ClangApplyReplacementsMain.cpp.