clang-tools
4.0.0
|
Typedefs | |
typedef std::vector < clang::tooling::Range > | RangeVector |
Collection of source ranges. More... | |
typedef std::vector < clang::tooling::TranslationUnitReplacements > | TUReplacements |
Collection of TranslationUnitReplacements. More... | |
typedef std::vector< std::string > | TUReplacementFiles |
Collection of TranslationUnitReplacement files. More... | |
typedef std::vector < clang::tooling::TranslationUnitDiagnostics > | TUDiagnostics |
Collection of TranslationUniDiagnostics. More... | |
typedef llvm::DenseMap< const clang::FileEntry *, std::vector < clang::tooling::Replacement > > | FileToReplacementsMap |
Map mapping file name to Replacements targeting that file. More... | |
Functions | |
std::error_code | collectReplacementsFromDirectory (const llvm::StringRef Directory, TUReplacements &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics) |
Recursively descends through a directory structure rooted at Directory and attempts to deserialize *.yaml files as TranslationUnitReplacements. More... | |
std::error_code | collectReplacementsFromDirectory (const llvm::StringRef Directory, TUDiagnostics &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics) |
bool | mergeAndDeduplicate (const TUReplacements &TUs, FileToReplacementsMap &GroupedReplacements, clang::SourceManager &SM) |
Deduplicate, check for conflicts, and apply all Replacements stored in TUs . More... | |
bool | mergeAndDeduplicate (const TUDiagnostics &TUs, FileToReplacementsMap &GroupedReplacements, clang::SourceManager &SM) |
bool | applyAllReplacements (const std::vector< tooling::Replacement > &Replaces, Rewriter &Rewrite) |
bool | applyReplacements (const FileToReplacementsMap &GroupedReplacements, clang::Rewriter &Rewrites) |
Apply all replacements in GroupedReplacements . More... | |
RangeVector | calculateChangedRanges (const std::vector< clang::tooling::Replacement > &Replacements) |
Given a collection of Replacements for a single file, produces a list of source ranges that enclose those Replacements. More... | |
bool | writeFiles (const clang::Rewriter &Rewrites) |
Write the contents of FileContents to disk. More... | |
bool | deleteReplacementFiles (const TUReplacementFiles &Files, clang::DiagnosticsEngine &Diagnostics) |
Delete the replacement files. More... | |
static void | reportConflict (const FileEntry *File, const llvm::ArrayRef< clang::tooling::Replacement > ConflictingReplacements, SourceManager &SM) |
Dumps information for a sequence of conflicting Replacements. More... | |
static void | deduplicate (std::vector< tooling::Replacement > &Replaces, std::vector< tooling::Range > &Conflicts) |
static bool | deduplicateAndDetectConflicts (FileToReplacementsMap &Replacements, SourceManager &SM) |
Deduplicates and tests for conflicts among the replacements for each file in Replacements . More... | |
typedef llvm::DenseMap<const clang::FileEntry *, std::vector<clang::tooling::Replacement> > clang::replace::FileToReplacementsMap |
Map mapping file name to Replacements targeting that file.
Definition at line 53 of file ApplyReplacements.h.
typedef std::vector<clang::tooling::Range> clang::replace::RangeVector |
Collection of source ranges.
Definition at line 39 of file ApplyReplacements.h.
typedef std::vector<clang::tooling::TranslationUnitDiagnostics> clang::replace::TUDiagnostics |
Collection of TranslationUniDiagnostics.
Definition at line 48 of file ApplyReplacements.h.
typedef std::vector<std::string> clang::replace::TUReplacementFiles |
Collection of TranslationUnitReplacement files.
Definition at line 45 of file ApplyReplacements.h.
typedef std::vector<clang::tooling::TranslationUnitReplacements> clang::replace::TUReplacements |
Collection of TranslationUnitReplacements.
Definition at line 42 of file ApplyReplacements.h.
bool clang::replace::applyAllReplacements | ( | const std::vector< tooling::Replacement > & | Replaces, |
Rewriter & | Rewrite | ||
) |
Definition at line 170 of file ApplyReplacements.cpp.
References Result.
Referenced by applyReplacements(), and getRewrittenData().
bool clang::replace::applyReplacements | ( | const FileToReplacementsMap & | GroupedReplacements, |
clang::Rewriter & | Rewrites | ||
) |
Apply all replacements in GroupedReplacements
.
[in] | GroupedReplacements | Deduplicated and conflict free Replacements to apply. |
[out] | Rewrites | The results of applying replacements will be applied to this Rewriter. |
Definition at line 333 of file ApplyReplacements.cpp.
References applyAllReplacements().
RangeVector clang::replace::calculateChangedRanges | ( | const std::vector< clang::tooling::Replacement > & | Replacements | ) |
Given a collection of Replacements for a single file, produces a list of source ranges that enclose those Replacements.
[in] | Replacements | Replacements from a single file. |
Definition at line 350 of file ApplyReplacements.cpp.
References Range.
Referenced by applyFormatting().
std::error_code clang::replace::collectReplacementsFromDirectory | ( | const llvm::StringRef | Directory, |
TUReplacements & | TUs, | ||
TUReplacementFiles & | TUFiles, | ||
clang::DiagnosticsEngine & | Diagnostics | ||
) |
Recursively descends through a directory structure rooted at Directory
and attempts to deserialize *.yaml files as TranslationUnitReplacements.
All docs that successfully deserialize are added to TUs
.
Directories starting with '.' are ignored during traversal.
[in] | Directory | Directory to begin search for serialized TranslationUnitReplacements. |
[out] | TUs | Collection of all found and deserialized TranslationUnitReplacements or TranslationUnitDiagnostics. |
[out] | TUFiles | Collection of all TranslationUnitReplacement files found in Directory . |
[in] | Diagnostics | DiagnosticsEngine used for error output. |
Definition at line 39 of file ApplyReplacements.cpp.
References eatDiagnostics(), and Input().
Referenced by main().
std::error_code clang::replace::collectReplacementsFromDirectory | ( | const llvm::StringRef | Directory, |
TUDiagnostics & | TUs, | ||
TUReplacementFiles & | TUFiles, | ||
clang::DiagnosticsEngine & | Diagnostics | ||
) |
Definition at line 84 of file ApplyReplacements.cpp.
References eatDiagnostics(), and Input().
|
static |
Definition at line 185 of file ApplyReplacements.cpp.
References Range.
Referenced by deduplicateAndDetectConflicts().
|
static |
Deduplicates and tests for conflicts among the replacements for each file in Replacements
.
Any conflicts found are reported.
[in,out] | Replacements | Container of all replacements grouped by file to be deduplicated and checked for conflicts. |
[in] | SM | SourceManager required for conflict reporting. |
Definition at line 252 of file ApplyReplacements.cpp.
References deduplicate(), Range, and reportConflict().
Referenced by mergeAndDeduplicate().
bool clang::replace::deleteReplacementFiles | ( | const TUReplacementFiles & | Files, |
clang::DiagnosticsEngine & | Diagnostics | ||
) |
Delete the replacement files.
[in] | Files | Replacement files to delete. |
[in] | Diagnostics | DiagnosticsEngine used for error output. |
Definition at line 385 of file ApplyReplacements.cpp.
References Filename.
bool clang::replace::mergeAndDeduplicate | ( | const TUReplacements & | TUs, |
FileToReplacementsMap & | GroupedReplacements, | ||
clang::SourceManager & | SM | ||
) |
Deduplicate, check for conflicts, and apply all Replacements stored in TUs
.
If conflicts occur, no Replacements are applied.
[in] | TUs | Collection of TranslationUnitReplacements or TranslationUnitDiagnostics to merge, deduplicate, and test for conflicts. |
[out] | GroupedReplacements | Container grouping all Replacements by the file they target. |
[in] | SM | SourceManager required for conflict reporting. |
Definition at line 281 of file ApplyReplacements.cpp.
References deduplicateAndDetectConflicts().
Referenced by main().
bool clang::replace::mergeAndDeduplicate | ( | const TUDiagnostics & | TUs, |
FileToReplacementsMap & | GroupedReplacements, | ||
clang::SourceManager & | SM | ||
) |
Definition at line 305 of file ApplyReplacements.cpp.
References deduplicateAndDetectConflicts(), and Fix().
|
static |
Dumps information for a sequence of conflicting Replacements.
[in] | File | FileEntry for the file the conflicting Replacements are for. |
[in] | ConflictingReplacements | List of conflicting Replacements. |
[in] | SM | SourceManager used for reporting. |
Definition at line 134 of file ApplyReplacements.cpp.
Referenced by deduplicateAndDetectConflicts().
bool clang::replace::writeFiles | ( | const clang::Rewriter & | Rewrites | ) |
Write the contents of FileContents
to disk.
Keys of the map are filenames and values are the new contents for those files.
[in] | Rewrites | Rewriter containing written files to write to disk. |
Definition at line 366 of file ApplyReplacements.cpp.