llvm::DeltaTree

B-tree mapping file indices to rewrite deltas with fast accumulated lookup.

Synopsis

Declared in <llvm/ADT/DeltaTree.h>

class DeltaTree;

Description

B-Trees are generally more memory and cache efficient than binary trees, because they store multiple keys/values in each node. This implements a key/value mapping from index to delta, and allows fast lookup on index. An added bonus is that it can also efficiently tell us the full accumulated delta for a specific file offset without traversing the whole tree.

Member Functions

NameDescription
DeltaTree [constructor]Constructors
~DeltaTree [destructor]Destroy the tree and free its nodes.
operator= [deleted]Assignment is deleted; DeltaTree is not copy-assignable.
AddDelta When a change is made that shifts around the text buffer, this method is used to record that info. It inserts a delta of 'Delta' into the current DeltaTree at offset FileIndex.
getDeltaAt Return the accumulated delta at the specified file offset. This includes all insertions or delections that occurred before the specified file index.