LLVM 22.0.0git
llvm::DeltaTree Class Reference

DeltaTree - a multiway search tree (BTree) structure with some fancy features. More...

#include "llvm/ADT/DeltaTree.h"

Public Member Functions

LLVM_ABI DeltaTree ()
LLVM_ABI DeltaTree (const DeltaTree &RHS)
DeltaTreeoperator= (const DeltaTree &)=delete
LLVM_ABI ~DeltaTree ()
LLVM_ABI int getDeltaAt (unsigned FileIndex) const
 getDeltaAt - Return the accumulated delta at the specified file offset.
LLVM_ABI void AddDelta (unsigned FileIndex, int Delta)
 AddDelta - When a change is made that shifts around the text buffer, this method is used to record that info.

Detailed Description

DeltaTree - a multiway search tree (BTree) structure with some fancy features.

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. However, an added (important) bonus is that it can also efficiently tell us the full accumulated delta for a specific file offset as well, without traversing the whole tree.

Definition at line 27 of file DeltaTree.h.

Constructor & Destructor Documentation

◆ DeltaTree() [1/2]

DeltaTree::DeltaTree ( )

Definition at line 388 of file DeltaTree.cpp.

Referenced by DeltaTree(), and operator=().

◆ DeltaTree() [2/2]

DeltaTree::DeltaTree ( const DeltaTree & RHS)

Definition at line 390 of file DeltaTree.cpp.

References assert(), DeltaTree(), and getRoot().

◆ ~DeltaTree()

DeltaTree::~DeltaTree ( )

Definition at line 397 of file DeltaTree.cpp.

References getRoot().

Member Function Documentation

◆ AddDelta()

void DeltaTree::AddDelta ( unsigned FileIndex,
int Delta )

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.

Definition at line 450 of file DeltaTree.cpp.

References assert(), and getRoot().

◆ getDeltaAt()

int DeltaTree::getDeltaAt ( unsigned FileIndex) const

getDeltaAt - Return the accumulated delta at the specified file offset.

This includes all insertions or delections that occurred before the specified file index.

Definition at line 402 of file DeltaTree.cpp.

References llvm::dyn_cast(), and getRoot().

◆ operator=()

DeltaTree & llvm::DeltaTree::operator= ( const DeltaTree & )
delete

References DeltaTree(), and LLVM_ABI.


The documentation for this class was generated from the following files: