clang-tools 20.0.0git
|
Namespaces | |
namespace | detail |
Typedefs | |
typedef std::vector< clang::tooling::TranslationUnitReplacements > | TUReplacements |
Collection of TranslationUnitReplacements. | |
typedef std::vector< std::string > | TUReplacementFiles |
Collection of TranslationUnitReplacement files. | |
typedef std::vector< clang::tooling::TranslationUnitDiagnostics > | TUDiagnostics |
Collection of TranslationUniDiagnostics. | |
using | FileToChangesMap = llvm::DenseMap< clang::FileEntryRef, std::vector< tooling::AtomicChange > > |
Map mapping file name to a set of AtomicChange targeting that file. | |
Functions | |
template<typename TranslationUnits > | |
std::error_code | collectReplacementsFromDirectory (const llvm::StringRef Directory, TranslationUnits &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics)=delete |
Recursively descends through a directory structure rooted at Directory and attempts to deserialize *.yaml files as TranslationUnitReplacements. | |
template<> | |
std::error_code | collectReplacementsFromDirectory (const llvm::StringRef Directory, TUReplacements &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics) |
template<> | |
std::error_code | collectReplacementsFromDirectory (const llvm::StringRef Directory, TUDiagnostics &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics) |
bool | mergeAndDeduplicate (const TUReplacements &TUs, const TUDiagnostics &TUDs, FileToChangesMap &FileChanges, clang::SourceManager &SM, bool IgnoreInsertConflict=false) |
Deduplicate, check for conflicts, and extract all Replacements stored in TUs . | |
llvm::Expected< std::string > | applyChanges (StringRef File, const std::vector< tooling::AtomicChange > &Changes, const tooling::ApplyChangesSpec &Spec, DiagnosticsEngine &Diagnostics) |
Apply AtomicChange on File and rewrite it. | |
bool | deleteReplacementFiles (const TUReplacementFiles &Files, clang::DiagnosticsEngine &Diagnostics) |
Delete the replacement files. | |
template<> | |
std::error_code | collectReplacementsFromDirectory (const llvm::StringRef Directory, TUReplacements &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics) |
template<> | |
std::error_code | collectReplacementsFromDirectory (const llvm::StringRef Directory, TUDiagnostics &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics) |
static llvm::DenseMap< FileEntryRef, std::vector< tooling::Replacement > > | groupReplacements (const TUReplacements &TUs, const TUDiagnostics &TUDs, const clang::SourceManager &SM) |
Extract replacements from collected TranslationUnitReplacements and TranslationUnitDiagnostics and group them per file. | |
using clang::replace::FileToChangesMap = typedef llvm::DenseMap<clang::FileEntryRef, std::vector<tooling::AtomicChange> > |
Map mapping file name to a set of AtomicChange targeting that file.
Definition at line 43 of file ApplyReplacements.h.
typedef std::vector<clang::tooling::TranslationUnitDiagnostics> clang::replace::TUDiagnostics |
Collection of TranslationUniDiagnostics.
Definition at line 40 of file ApplyReplacements.h.
typedef std::vector<std::string> clang::replace::TUReplacementFiles |
Collection of TranslationUnitReplacement files.
Definition at line 37 of file ApplyReplacements.h.
typedef std::vector<clang::tooling::TranslationUnitReplacements> clang::replace::TUReplacements |
Collection of TranslationUnitReplacements.
Definition at line 34 of file ApplyReplacements.h.
llvm::Expected< std::string > clang::replace::applyChanges | ( | StringRef | File, |
const std::vector< tooling::AtomicChange > & | Changes, | ||
const tooling::ApplyChangesSpec & | Spec, | ||
DiagnosticsEngine & | Diagnostics | ||
) |
Apply AtomicChange
on File and rewrite it.
[in] | File | Path of the file where to apply AtomicChange. |
[in] | Changes | to apply. |
[in] | Spec | For code cleanup and formatting. |
[in] | Diagnostics | DiagnosticsEngine used for error output. |
Definition at line 246 of file ApplyReplacements.cpp.
References Changes, and Diagnostics.
Referenced by main().
|
delete |
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 or TranslationUnitDiagnostics. |
[out] | TUs | Collection of all found and deserialized TranslationUnitReplacements or TranslationUnitDiagnostics. |
[out] | TUFiles | Collection of all TranslationUnitReplacement or TranslationUnitDiagnostics files found in Directory . |
[in] | Diagnostics | DiagnosticsEngine used for error output. |
Referenced by main().
std::error_code clang::replace::collectReplacementsFromDirectory | ( | const llvm::StringRef | Directory, |
TUDiagnostics & | TUs, | ||
TUReplacementFiles & | TUFiles, | ||
clang::DiagnosticsEngine & | Diagnostics | ||
) |
Definition at line 103 of file ApplyReplacements.cpp.
References clang::replace::detail::collectReplacementsFromDirectory(), Diagnostics, and Directory.
std::error_code clang::replace::collectReplacementsFromDirectory | ( | const llvm::StringRef | Directory, |
TUDiagnostics & | TUs, | ||
TUReplacementFiles & | TUFiles, | ||
clang::DiagnosticsEngine & | Diagnostics | ||
) |
Definition at line 103 of file ApplyReplacements.cpp.
References clang::replace::detail::collectReplacementsFromDirectory(), Diagnostics, and Directory.
std::error_code clang::replace::collectReplacementsFromDirectory | ( | const llvm::StringRef | Directory, |
TUReplacements & | TUs, | ||
TUReplacementFiles & | TUFiles, | ||
clang::DiagnosticsEngine & | Diagnostics | ||
) |
Definition at line 95 of file ApplyReplacements.cpp.
References clang::replace::detail::collectReplacementsFromDirectory(), Diagnostics, and Directory.
std::error_code clang::replace::collectReplacementsFromDirectory | ( | const llvm::StringRef | Directory, |
TUReplacements & | TUs, | ||
TUReplacementFiles & | TUFiles, | ||
clang::DiagnosticsEngine & | Diagnostics | ||
) |
Definition at line 95 of file ApplyReplacements.cpp.
References clang::replace::detail::collectReplacementsFromDirectory(), Diagnostics, and Directory.
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 260 of file ApplyReplacements.cpp.
|
static |
Extract replacements from collected TranslationUnitReplacements and TranslationUnitDiagnostics and group them per file.
Identical replacements from diagnostics are deduplicated.
[in] | TUs | Collection of all found and deserialized TranslationUnitReplacements. |
[in] | TUDs | Collection of all found and deserialized TranslationUnitDiagnostics. |
[in] | SM | Used to deduplicate paths. |
Definition at line 123 of file ApplyReplacements.cpp.
References BuildDir, Fix(), Path, and Replaces.
Referenced by mergeAndDeduplicate().
bool clang::replace::mergeAndDeduplicate | ( | const TUReplacements & | TUs, |
const TUDiagnostics & | TUDs, | ||
FileToChangesMap & | FileChanges, | ||
clang::SourceManager & | SM, | ||
bool | IgnoreInsertConflict = false |
||
) |
Deduplicate, check for conflicts, and extract all Replacements stored in TUs
.
Conflicting replacements are skipped.
[in] | TUs | Collection of TranslationUnitReplacements or TranslationUnitDiagnostics to merge, deduplicate, and test for conflicts. |
[out] | FileChanges | Container grouping all changes by the file they target. Only non conflicting replacements are kept into FileChanges. |
[in] | SM | SourceManager required for conflict reporting. |
Definition at line 187 of file ApplyReplacements.cpp.
References groupReplacements(), and IgnoreInsertConflict().
Referenced by main().