16 #ifndef LLVM_CLANG_APPLYREPLACEMENTS_H 17 #define LLVM_CLANG_APPLYREPLACEMENTS_H 19 #include "clang/Tooling/Core/Diagnostic.h" 20 #include "clang/Tooling/Refactoring.h" 21 #include "clang/Tooling/Refactoring/AtomicChange.h" 22 #include "llvm/ADT/StringMap.h" 23 #include "llvm/ADT/StringRef.h" 25 #include <system_error> 30 class DiagnosticsEngine;
36 typedef std::vector<clang::tooling::TranslationUnitReplacements>
TUReplacements;
42 typedef std::vector<clang::tooling::TranslationUnitDiagnostics>
TUDiagnostics;
45 typedef llvm::DenseMap<
const clang::FileEntry *,
46 std::vector<tooling::AtomicChange>>
67 const llvm::StringRef
Directory, TUReplacements &TUs,
68 TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics);
71 const llvm::StringRef
Directory, TUDiagnostics &TUs,
72 TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics);
92 clang::SourceManager &SM);
103 llvm::Expected<std::string>
104 applyChanges(StringRef File,
const std::vector<tooling::AtomicChange> &Changes,
105 const tooling::ApplyChangesSpec &Spec,
106 DiagnosticsEngine &Diagnostics);
118 clang::DiagnosticsEngine &Diagnostics);
123 #endif // LLVM_CLANG_APPLYREPLACEMENTS_H bool deleteReplacementFiles(const TUReplacementFiles &Files, clang::DiagnosticsEngine &Diagnostics)
Delete the replacement files.
std::vector< clang::tooling::TranslationUnitReplacements > TUReplacements
Collection of TranslationUnitReplacements.
static cl::opt< std::string > Directory(cl::Positional, cl::Required, cl::desc("<Search Root Directory>"))
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.
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 *...
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
bool mergeAndDeduplicate(const TUReplacements &TUs, const TUDiagnostics &TUDs, FileToChangesMap &FileChanges, clang::SourceManager &SM)
Deduplicate, check for conflicts, and extract all Replacements stored in TUs.
std::vector< clang::tooling::TranslationUnitDiagnostics > TUDiagnostics
Collection of TranslationUniDiagnostics.
std::vector< std::string > TUReplacementFiles
Collection of TranslationUnitReplacement files.
llvm::DenseMap< const clang::FileEntry *, std::vector< tooling::AtomicChange > > FileToChangesMap
Map mapping file name to a set of AtomicChange targeting that file.