[Support] Remove unnecessary MemoryBuffer::anchor (where the destructor serves as the key function)

llvm-svn: 338175
This commit is contained in:
Fangrui Song 2018-07-27 23:12:11 +00:00
parent c3e11bf3f7
commit c39ea92359
3 changed files with 4 additions and 7 deletions

View File

@ -43,7 +43,6 @@ class MemoryBuffer {
const char *BufferStart; // Start of the buffer.
const char *BufferEnd; // End of the buffer.
protected:
MemoryBuffer() = default;
@ -148,9 +147,6 @@ public:
virtual BufferKind getBufferKind() const = 0;
MemoryBufferRef getMemBufferRef() const;
private:
virtual void anchor();
};
/// This class is an extension of MemoryBuffer, which allows copy-on-write

View File

@ -49,6 +49,9 @@ public:
init(this->SV.begin(), this->SV.end(), false);
}
// Key function.
~SmallVectorMemoryBuffer() override;
StringRef getBufferIdentifier() const override { return BufferName; }
BufferKind getBufferKind() const override { return MemoryBuffer_Malloc; }
@ -56,7 +59,6 @@ public:
private:
SmallVector<char, 0> SV;
std::string BufferName;
void anchor() override;
};
} // namespace llvm

View File

@ -533,5 +533,4 @@ MemoryBufferRef MemoryBuffer::getMemBufferRef() const {
return MemoryBufferRef(Data, Identifier);
}
void MemoryBuffer::anchor() {}
void SmallVectorMemoryBuffer::anchor() {}
SmallVectorMemoryBuffer::~SmallVectorMemoryBuffer() {}