9#ifndef LLVM_CLANG_REWRITE_CORE_REWRITEBUFFER_H
10#define LLVM_CLANG_REWRITE_CORE_REWRITEBUFFER_H
15#include "llvm/ADT/StringRef.h"
39 unsigned size()
const {
return Buffer.
size(); }
43 void Initialize(
const char *BufStart,
const char *BufEnd) {
44 Buffer.
assign(BufStart, BufEnd);
57 raw_ostream &write(raw_ostream &Stream)
const;
60 void RemoveText(
unsigned OrigOffset,
unsigned Size,
61 bool removeLineIfEmpty =
false);
66 void InsertText(
unsigned OrigOffset, StringRef Str,
67 bool InsertAfter =
true);
88 void ReplaceText(
unsigned OrigOffset,
unsigned OrigLength,
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);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
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 Initialize(const char *BufStart, const char *BufEnd)
Initialize - Start this rewrite buffer out with a copy of the unmodified input buffer.
void InsertTextAfter(unsigned OrigOffset, StringRef Str)
InsertTextAfter - Insert some text at the specified point, where the offset in the buffer is specifie...
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...
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 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.
RewriteRope - A powerful string class.
RopePieceBTree::iterator const_iterator
void assign(const char *Start, const char *End)
Rewriter - This is the main interface to the rewrite buffers.
RopePieceBTreeIterator - This class provides read-only forward iteration over bytes that are in a Rop...
The JSON file list parser is used to communicate input to InstallAPI.