llvm::RewriteBuffer

Buffer holding rewritten source text and original-to-rewritten offset maps.

Synopsis

Declared in <llvm/ADT/RewriteBuffer.h>

class RewriteBuffer;

Description

As code is rewritten, SourceBuffers from the original input with modifications get a RewriteBuffer associated with them. The RewriteBuffer captures the modified text itself as well as information used to map between SourceLocations in the original input and offsets in the RewriteBuffer. For example, if text is inserted into the buffer, any locations after the insertion point have to be mapped.

Type Aliases

NameDescription
iterator Const iterator over characters in the rewritten buffer.

Member Functions

NameDescription
Initialize Initialize overloads
InsertText Insert text at an offset relative to the original SourceBuffer.
InsertTextAfter Insert Str after original offset OrigOffset.
InsertTextBefore Insert Str before original offset OrigOffset.
RemoveText Remove the specified text from the buffer.
ReplaceText Replace a range of characters in the input buffer with a new string.
begin Iterator to the first character of the rewritten text.
end Iterator one past the last character of the rewritten text.
size Number of characters currently stored in the rewritten buffer.
write Write to Stream the result of applying all changes to the original buffer.

Friends

NameDescription
clang::Rewriter