Skip to content

Commit 2e97236

Browse files
ljmf00dwblaikie
authored andcommitted
[Demangle] Rename OutputStream to OutputString
This patch is a refactor to implement prepend afterwards. Since this changes a lot of files and to conform with guidelines, I will separate this from the implementation of prepend. Related to the discussion in https://reviews.llvm.org/D111414 , so please read it for more context. Reviewed By: #libc_abi, dblaikie, ldionne Differential Revision: https://reviews.llvm.org/D111947
1 parent 08f4b56 commit 2e97236

File tree

12 files changed

+1422
-1447
lines changed

12 files changed

+1422
-1447
lines changed

libcxxabi/src/demangle/ItaniumDemangle.h

Lines changed: 512 additions & 525 deletions
Large diffs are not rendered by default.

libcxxabi/src/demangle/Utility.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ DEMANGLE_NAMESPACE_BEGIN
2424

2525
// Stream that AST nodes write their string representation into after the AST
2626
// has been parsed.
27-
class OutputStream {
27+
class OutputBuffer {
2828
char *Buffer = nullptr;
2929
size_t CurrentPosition = 0;
3030
size_t BufferCapacity = 0;
@@ -63,9 +63,9 @@ class OutputStream {
6363
}
6464

6565
public:
66-
OutputStream(char *StartBuf, size_t Size)
66+
OutputBuffer(char *StartBuf, size_t Size)
6767
: Buffer(StartBuf), CurrentPosition(0), BufferCapacity(Size) {}
68-
OutputStream() = default;
68+
OutputBuffer() = default;
6969
void reset(char *Buffer_, size_t BufferCapacity_) {
7070
CurrentPosition = 0;
7171
Buffer = Buffer_;
@@ -77,7 +77,7 @@ class OutputStream {
7777
unsigned CurrentPackIndex = std::numeric_limits<unsigned>::max();
7878
unsigned CurrentPackMax = std::numeric_limits<unsigned>::max();
7979

80-
OutputStream &operator+=(StringView R) {
80+
OutputBuffer &operator+=(StringView R) {
8181
size_t Size = R.size();
8282
if (Size == 0)
8383
return *this;
@@ -87,42 +87,42 @@ class OutputStream {
8787
return *this;
8888
}
8989

90-
OutputStream &operator+=(char C) {
90+
OutputBuffer &operator+=(char C) {
9191
grow(1);
9292
Buffer[CurrentPosition++] = C;
9393
return *this;
9494
}
9595

96-
OutputStream &operator<<(StringView R) { return (*this += R); }
96+
OutputBuffer &operator<<(StringView R) { return (*this += R); }
9797

98-
OutputStream &operator<<(char C) { return (*this += C); }
98+
OutputBuffer &operator<<(char C) { return (*this += C); }
9999

100-
OutputStream &operator<<(long long N) {
100+
OutputBuffer &operator<<(long long N) {
101101
if (N < 0)
102102
writeUnsigned(static_cast<unsigned long long>(-N), true);
103103
else
104104
writeUnsigned(static_cast<unsigned long long>(N));
105105
return *this;
106106
}
107107

108-
OutputStream &operator<<(unsigned long long N) {
108+
OutputBuffer &operator<<(unsigned long long N) {
109109
writeUnsigned(N, false);
110110
return *this;
111111
}
112112

113-
OutputStream &operator<<(long N) {
113+
OutputBuffer &operator<<(long N) {
114114
return this->operator<<(static_cast<long long>(N));
115115
}
116116

117-
OutputStream &operator<<(unsigned long N) {
117+
OutputBuffer &operator<<(unsigned long N) {
118118
return this->operator<<(static_cast<unsigned long long>(N));
119119
}
120120

121-
OutputStream &operator<<(int N) {
121+
OutputBuffer &operator<<(int N) {
122122
return this->operator<<(static_cast<long long>(N));
123123
}
124124

125-
OutputStream &operator<<(unsigned int N) {
125+
OutputBuffer &operator<<(unsigned int N) {
126126
return this->operator<<(static_cast<unsigned long long>(N));
127127
}
128128

@@ -181,7 +181,7 @@ template <class T> class SwapAndRestore {
181181
SwapAndRestore &operator=(const SwapAndRestore &) = delete;
182182
};
183183

184-
inline bool initializeOutputStream(char *Buf, size_t *N, OutputStream &S,
184+
inline bool initializeOutputBuffer(char *Buf, size_t *N, OutputBuffer &OB,
185185
size_t InitSize) {
186186
size_t BufferSize;
187187
if (Buf == nullptr) {
@@ -192,7 +192,7 @@ inline bool initializeOutputStream(char *Buf, size_t *N, OutputStream &S,
192192
} else
193193
BufferSize = *N;
194194

195-
S.reset(Buf, BufferSize);
195+
OB.reset(Buf, BufferSize);
196196
return true;
197197
}
198198

0 commit comments

Comments
 (0)