LLVM: include/llvm/ADT/RewriteBuffer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_ADT_REWRITEBUFFER_H

10#define LLVM_ADT_REWRITEBUFFER_H

11

16

20

21namespace llvm {

22

23class raw_ostream;

24

25

26

27

28

29

30

33

34

35

37

39

40public:

42

45 unsigned size() const { return Buffer.size(); }

46

47

48

49 void Initialize(const char *BufStart, const char *BufEnd) {

50 Buffer.assign(BufStart, BufEnd);

51 }

53

54

55

56

57

58

59

60

62

63

65 bool removeLineIfEmpty = false);

66

67

68

69

71 bool InsertAfter = true);

72

73

74

75

76

80

81

82

83

87

88

89

90

93

94private:

95

96

97

98

99

100 unsigned getMappedOffset(unsigned OrigOffset,

101 bool AfterInserts = false) const {

102 return Deltas.getDeltaAt(2 * OrigOffset + AfterInserts) + OrigOffset;

103 }

104

105

106

107 void AddInsertDelta(unsigned OrigOffset, int Change) {

108 return Deltas.AddDelta(2 * OrigOffset, Change);

109 }

110

111

112

113 void AddReplaceDelta(unsigned OrigOffset, int Change) {

114 return Deltas.AddDelta(2 * OrigOffset + 1, Change);

115 }

116};

117

118}

119

120#endif

The Input class is used to parse a yaml document into in-memory structs and vectors.

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

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 th...

LLVM_ABI 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...

Definition RewriteBuffer.h:31

LLVM_ABI void RemoveText(unsigned OrigOffset, unsigned Size, bool removeLineIfEmpty=false)

RemoveText - Remove the specified text.

LLVM_ABI raw_ostream & write(raw_ostream &Stream) const

Write to Stream the result of applying all changes to the original buffer.

iterator end() const

Definition RewriteBuffer.h:44

LLVM_ABI 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...

unsigned size() const

Definition RewriteBuffer.h:45

void InsertTextBefore(unsigned OrigOffset, StringRef Str)

InsertTextBefore - Insert some text before the specified point, where the offset in the buffer is spe...

Definition RewriteBuffer.h:77

friend class clang::Rewriter

Definition RewriteBuffer.h:32

iterator begin() const

Definition RewriteBuffer.h:43

void Initialize(const char *BufStart, const char *BufEnd)

Initialize - Start this rewrite buffer out with a copy of the unmodified input buffer.

Definition RewriteBuffer.h:49

RewriteRope::const_iterator iterator

Definition RewriteBuffer.h:41

void Initialize(StringRef Input)

Definition RewriteBuffer.h:52

LLVM_ABI void ReplaceText(unsigned OrigOffset, unsigned OrigLength, StringRef NewStr)

ReplaceText - This method replaces a range of characters in the input buffer with a new string.

void InsertTextAfter(unsigned OrigOffset, StringRef Str)

InsertTextAfter - Insert some text at the specified point, where the offset in the buffer is specifie...

Definition RewriteBuffer.h:84

RewriteRope - A powerful string class.

RopePieceBTree::iterator const_iterator

StringRef - Represent a constant reference to a string, i.e.

This class implements an extremely fast bulk output stream that can only output to a stream.

Definition RewriteBuffer.h:17

This is an optimization pass for GlobalISel generic memory operations.