clang 20.0.0git
Namespaces | Functions | Variables
Replacement.cpp File Reference
#include "clang/Tooling/Core/Replacement.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/RewriteBuffer.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <limits>
#include <map>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
 
namespace  clang::tooling
 

Functions

bool clang::tooling::operator< (const Replacement &LHS, const Replacement &RHS)
 Less-than operator between two Replacements.
 
bool clang::tooling::operator== (const Replacement &LHS, const Replacement &RHS)
 Equal-to operator between two Replacements.
 
static int getRangeSize (const SourceManager &Sources, const CharSourceRange &Range, const LangOptions &LangOpts)
 
static std::string getReplacementErrString (replacement_error Err)
 
static std::vector< RangecombineAndSortRanges (std::vector< Range > Ranges)
 
std::vector< Rangeclang::tooling::calculateRangesAfterReplacements (const Replacements &Replaces, const std::vector< Range > &Ranges)
 Calculates the new ranges after Replaces are applied.
 
bool clang::tooling::applyAllReplacements (const Replacements &Replaces, Rewriter &Rewrite)
 Apply all replacements in Replaces to the Rewriter Rewrite.
 
llvm::Expected< std::string > clang::tooling::applyAllReplacements (StringRef Code, const Replacements &Replaces)
 Applies all replacements in Replaces to Code.
 
std::map< std::string, Replacementsclang::tooling::groupReplacementsByFile (FileManager &FileMgr, const std::map< std::string, Replacements > &FileToReplaces)
 If there are multiple <File, Replacements> pairs with the same file entry, we only keep one pair and discard the rest.
 

Variables

static const char *const InvalidLocation = ""
 

Function Documentation

◆ combineAndSortRanges()

static std::vector< Range > combineAndSortRanges ( std::vector< Range Ranges)
static

◆ getRangeSize()

static int getRangeSize ( const SourceManager Sources,
const CharSourceRange Range,
const LangOptions LangOpts 
)
static

◆ getReplacementErrString()

static std::string getReplacementErrString ( replacement_error  Err)
static

Variable Documentation

◆ InvalidLocation

const char* const InvalidLocation = ""
static

Definition at line 43 of file Replacement.cpp.

Referenced by clang::tooling::Replacement::isApplicable().