15#ifndef LLVM_CLANG_APPLYREPLACEMENTS_H
16#define LLVM_CLANG_APPLYREPLACEMENTS_H
18#include "clang/Tooling/Core/Diagnostic.h"
19#include "clang/Tooling/Refactoring.h"
20#include "clang/Tooling/Refactoring/AtomicChange.h"
21#include "llvm/ADT/StringMap.h"
22#include "llvm/ADT/StringRef.h"
24#include <system_error>
29class DiagnosticsEngine;
34typedef std::vector<clang::tooling::TranslationUnitReplacements>
TUReplacements;
40typedef std::vector<clang::tooling::TranslationUnitDiagnostics>
TUDiagnostics;
43typedef llvm::DenseMap<
const clang::FileEntry *,
44 std::vector<tooling::AtomicChange>>
90 clang::SourceManager &SM,
102llvm::Expected<std::string>
104 const tooling::ApplyChangesSpec &Spec,
static cl::opt< bool > IgnoreInsertConflict("ignore-insert-conflict", cl::desc("Ignore insert conflict and keep running to fix."), cl::init(false), cl::cat(ReplacementCategory))
llvm::StringRef Directory
WantDiagnostics 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.
bool deleteReplacementFiles(const TUReplacementFiles &Files, clang::DiagnosticsEngine &Diagnostics)
Delete the replacement files.
std::vector< clang::tooling::TranslationUnitReplacements > TUReplacements
Collection of TranslationUnitReplacements.
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.
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 *....
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::vector< clang::tooling::TranslationUnitDiagnostics > TUDiagnostics
Collection of TranslationUniDiagnostics.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//