[demangler] Make OutputBuffer non-copyable
In addressing the buffer ownership API, I discovered a rogue member function that returned by value rather than by reference. It clearly intended to return by reference, but because the copy ctor wasn't deleted this wasn't caught. It is not necessary to make this a move-only type, although that would be an alternative. Reviewed By: bruno Differential Revision: https://reviews.llvm.org/D120901
This commit is contained in:
parent
6afe035404
commit
64221645a8
@ -71,6 +71,10 @@ public:
|
||||
OutputBuffer(char *StartBuf, size_t Size)
|
||||
: Buffer(StartBuf), CurrentPosition(0), BufferCapacity(Size) {}
|
||||
OutputBuffer() = default;
|
||||
// Non-copyable
|
||||
OutputBuffer(const OutputBuffer &) = delete;
|
||||
OutputBuffer &operator=(const OutputBuffer &) = delete;
|
||||
|
||||
void reset(char *Buffer_, size_t BufferCapacity_) {
|
||||
CurrentPosition = 0;
|
||||
Buffer = Buffer_;
|
||||
@ -97,7 +101,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputBuffer prepend(StringView R) {
|
||||
OutputBuffer &prepend(StringView R) {
|
||||
size_t Size = R.size();
|
||||
|
||||
grow(Size);
|
||||
|
@ -71,6 +71,10 @@ public:
|
||||
OutputBuffer(char *StartBuf, size_t Size)
|
||||
: Buffer(StartBuf), CurrentPosition(0), BufferCapacity(Size) {}
|
||||
OutputBuffer() = default;
|
||||
// Non-copyable
|
||||
OutputBuffer(const OutputBuffer &) = delete;
|
||||
OutputBuffer &operator=(const OutputBuffer &) = delete;
|
||||
|
||||
void reset(char *Buffer_, size_t BufferCapacity_) {
|
||||
CurrentPosition = 0;
|
||||
Buffer = Buffer_;
|
||||
@ -97,7 +101,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputBuffer prepend(StringView R) {
|
||||
OutputBuffer &prepend(StringView R) {
|
||||
size_t Size = R.size();
|
||||
|
||||
grow(Size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user