clang-tools 19.0.0git
Namespaces | Functions | Variables
ApplyReplacements.cpp File Reference

This file provides the implementation for deduplicating, detecting conflicts in, and applying collections of Replacements. More...

#include "clang-apply-replacements/Tooling/ApplyReplacements.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Format/Format.h"
#include "clang/Lex/Lexer.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "clang/Tooling/Core/Diagnostic.h"
#include "clang/Tooling/DiagnosticsYaml.h"
#include "clang/Tooling/ReplacementsYaml.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <array>
#include <optional>

Go to the source code of this file.

Namespaces

namespace  clang
 ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
 
namespace  clang::replace
 
namespace  clang::replace::detail
 

Functions

static void eatDiagnostics (const SMDiagnostic &, void *)
 
template<typename TranslationUnits >
static std::error_code clang::replace::detail::collectReplacementsFromDirectory (const llvm::StringRef Directory, TranslationUnits &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics)
 
template<>
std::error_code clang::replace::collectReplacementsFromDirectory (const llvm::StringRef Directory, TUReplacements &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics)
 
template<>
std::error_code clang::replace::collectReplacementsFromDirectory (const llvm::StringRef Directory, TUDiagnostics &TUs, TUReplacementFiles &TUFiles, clang::DiagnosticsEngine &Diagnostics)
 
static llvm::DenseMap< FileEntryRef, std::vector< tooling::Replacement > > clang::replace::groupReplacements (const TUReplacements &TUs, const TUDiagnostics &TUDs, const clang::SourceManager &SM)
 Extract replacements from collected TranslationUnitReplacements and TranslationUnitDiagnostics and group them per file.
 
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.
 
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.
 
bool clang::replace::deleteReplacementFiles (const TUReplacementFiles &Files, clang::DiagnosticsEngine &Diagnostics)
 Delete the replacement files.
 

Variables

static constexpr std::array< StringRef, 2 > clang::replace::detail::AllowedExtensions = {".yaml", ".yml"}
 

Detailed Description

This file provides the implementation for deduplicating, detecting conflicts in, and applying collections of Replacements.

FIXME: Use Diagnostics for output instead of llvm::errs().

Definition in file ApplyReplacements.cpp.

Function Documentation

◆ eatDiagnostics()

static void eatDiagnostics ( const SMDiagnostic &  ,
void *   
)
static