9#ifndef LLVM_ADT_REWRITEBUFFER_H
10#define LLVM_ADT_REWRITEBUFFER_H
44 unsigned size()
const {
return Buffer.
size(); }
48 void Initialize(
const char *BufStart,
const char *BufEnd) {
49 Buffer.
assign(BufStart, BufEnd);
64 bool removeLineIfEmpty =
false);
97 unsigned getMappedOffset(
unsigned OrigOffset,
98 bool AfterInserts =
false)
const {
99 return Deltas.
getDeltaAt(2 * OrigOffset + AfterInserts) + OrigOffset;
104 void AddInsertDelta(
unsigned OrigOffset,
int Change) {
105 return Deltas.
AddDelta(2 * OrigOffset, Change);
110 void AddReplaceDelta(
unsigned OrigOffset,
int Change) {
111 return Deltas.
AddDelta(2 * OrigOffset + 1, Change);
Virtual Register Rewriter
DeltaTree - a multiway search tree (BTree) structure with some fancy features.
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...
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...
void RemoveText(unsigned OrigOffset, unsigned Size, bool removeLineIfEmpty=false)
RemoveText - Remove the specified text.
raw_ostream & write(raw_ostream &Stream) const
Write to Stream the result of applying all changes to the original buffer.
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.
void Initialize(StringRef Input)
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
void assign(const char *Start, const char *End)
RopePieceBTreeIterator - This class provides read-only forward iteration over bytes that are in a Rop...
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.