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;
44 llvm::DenseMap<clang::FileEntryRef, std::vector<tooling::AtomicChange>>;
63template <
typename TranslationUnits>
65 const llvm::StringRef
Directory, TranslationUnits &TUs,
97 clang::SourceManager &SM,
109llvm::Expected<std::string>
111 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
llvm::DenseMap< clang::FileEntryRef, std::vector< tooling::AtomicChange > > FileToChangesMap
Map mapping file name to a set of AtomicChange targeting that file.
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::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 *....
std::vector< clang::tooling::TranslationUnitReplacements > TUReplacements
Collection of TranslationUnitReplacements.
std::vector< std::string > TUReplacementFiles
Collection of TranslationUnitReplacement files.
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++ -*-===//