9#ifndef LLVM_ADT_REWRITEBUFFER_H
10#define LLVM_ADT_REWRITEBUFFER_H
45 unsigned size()
const {
return Buffer.size(); }
49 void Initialize(
const char *BufStart,
const char *BufEnd) {
50 Buffer.assign(BufStart, BufEnd);
65 bool removeLineIfEmpty =
false);
71 bool InsertAfter =
true);
100 unsigned getMappedOffset(
unsigned OrigOffset,
101 bool AfterInserts =
false)
const {
102 return Deltas.
getDeltaAt(2 * OrigOffset + AfterInserts) + OrigOffset;
107 void AddInsertDelta(
unsigned OrigOffset,
int Change) {
108 return Deltas.
AddDelta(2 * OrigOffset, Change);
113 void AddReplaceDelta(
unsigned OrigOffset,
int Change) {
114 return Deltas.AddDelta(2 * OrigOffset + 1, Change);
DeltaTree - a multiway search tree (BTree) structure with some fancy features.
LLVM_ABI void AddDelta(unsigned FileIndex, int Delta)
AddDelta - When a change is made that shifts around the text buffer, this method is used to record th...
LLVM_ABI int getDeltaAt(unsigned FileIndex) const
getDeltaAt - Return the accumulated delta at the specified file offset.
RewriteBuffer - As code is rewritten, SourceBuffer's from the original input with modifications get a...
LLVM_ABI void RemoveText(unsigned OrigOffset, unsigned Size, bool removeLineIfEmpty=false)
RemoveText - Remove the specified text.
LLVM_ABI raw_ostream & write(raw_ostream &Stream) const
Write to Stream the result of applying all changes to the original buffer.
LLVM_ABI void InsertText(unsigned OrigOffset, StringRef Str, bool InsertAfter=true)
InsertText - Insert some text at the specified point, where the offset in the buffer is specified rel...
void InsertTextBefore(unsigned OrigOffset, StringRef Str)
InsertTextBefore - Insert some text before the specified point, where the offset in the buffer is spe...
friend class clang::Rewriter
void Initialize(const char *BufStart, const char *BufEnd)
Initialize - Start this rewrite buffer out with a copy of the unmodified input buffer.
RewriteRope::const_iterator iterator
void Initialize(StringRef Input)
LLVM_ABI void ReplaceText(unsigned OrigOffset, unsigned OrigLength, StringRef NewStr)
ReplaceText - This method replaces a range of characters in the input buffer with a new string.
void InsertTextAfter(unsigned OrigOffset, StringRef Str)
InsertTextAfter - Insert some text at the specified point, where the offset in the buffer is specifie...
RewriteRope - A powerful string class.
RopePieceBTree::iterator const_iterator
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.