10 #ifndef LLVM_CLANG_REWRITE_CORE_REWRITEBUFFER_H 11 #define LLVM_CLANG_REWRITE_CORE_REWRITEBUFFER_H 16 #include "llvm/ADT/StringRef.h" 40 unsigned size()
const {
return Buffer.
size(); }
44 void Initialize(
const char *BufStart,
const char *BufEnd) {
45 Buffer.
assign(BufStart, BufEnd);
58 raw_ostream &
write(raw_ostream &Stream)
const;
61 void RemoveText(
unsigned OrigOffset,
unsigned Size,
62 bool removeLineIfEmpty =
false);
67 void InsertText(
unsigned OrigOffset, StringRef Str,
68 bool InsertAfter =
true);
89 void ReplaceText(
unsigned OrigOffset,
unsigned OrigLength,
98 unsigned getMappedOffset(
unsigned OrigOffset,
99 bool AfterInserts =
false)
const{
100 return Deltas.
getDeltaAt(2*OrigOffset+AfterInserts)+OrigOffset;
105 void AddInsertDelta(
unsigned OrigOffset,
int Change) {
106 return Deltas.
AddDelta(2*OrigOffset, Change);
111 void AddReplaceDelta(
unsigned OrigOffset,
int Change) {
112 return Deltas.
AddDelta(2*OrigOffset+1, Change);
118 #endif // LLVM_CLANG_REWRITE_CORE_REWRITEBUFFER_H 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...
void Initialize(StringRef Input)
RewriteRope - A powerful string class.
void Initialize(const char *BufStart, const char *BufEnd)
Initialize - Start this rewrite buffer out with a copy of the unmodified input buffer.
RewriteBuffer - As code is rewritten, SourceBuffer's from the original input with modifications get a...
RopePieceBTree::iterator const_iterator
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
void InsertTextAfter(unsigned OrigOffset, StringRef Str)
InsertTextAfter - Insert some text at the specified point, where the offset in the buffer is specifie...
int getDeltaAt(unsigned FileIndex) const
getDeltaAt - Return the accumulated delta at the specified file offset.
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...
DeltaTree - a multiway search tree (BTree) structure with some fancy features.
void ReplaceText(unsigned OrigOffset, unsigned OrigLength, StringRef NewStr)
ReplaceText - This method replaces a range of characters in the input buffer with a new string...
raw_ostream & write(raw_ostream &Stream) const
Write to Stream the result of applying all changes to the original buffer.
void RemoveText(unsigned OrigOffset, unsigned Size, bool removeLineIfEmpty=false)
RemoveText - Remove the specified text.
void InsertTextBefore(unsigned OrigOffset, StringRef Str)
InsertTextBefore - Insert some text before the specified point, where the offset in the buffer is spe...
Dataflow Directional Tag Classes.
RopePieceBTreeIterator - This class provides read-only forward iteration over bytes that are in a Rop...
void assign(const char *Start, const char *End)
Rewriter - This is the main interface to the rewrite buffers.