llvm.org GIT mirror llvm / 1340804
[Support] Remove unnecessary MemoryBuffer::anchor (where the destructor serves as the key function) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338175 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 2 years ago
3 changed file(s) with 4 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
4242 const char *BufferStart; // Start of the buffer.
4343 const char *BufferEnd; // End of the buffer.
4444
45
4645 protected:
4746 MemoryBuffer() = default;
4847
147146 virtual BufferKind getBufferKind() const = 0;
148147
149148 MemoryBufferRef getMemBufferRef() const;
150
151 private:
152 virtual void anchor();
153149 };
154150
155151 /// This class is an extension of MemoryBuffer, which allows copy-on-write
4848 init(this->SV.begin(), this->SV.end(), false);
4949 }
5050
51 // Key function.
52 ~SmallVectorMemoryBuffer() override;
53
5154 StringRef getBufferIdentifier() const override { return BufferName; }
5255
5356 BufferKind getBufferKind() const override { return MemoryBuffer_Malloc; }
5558 private:
5659 SmallVector SV;
5760 std::string BufferName;
58 void anchor() override;
5961 };
6062
6163 } // namespace llvm
532532 return MemoryBufferRef(Data, Identifier);
533533 }
534534
535 void MemoryBuffer::anchor() {}
536 void SmallVectorMemoryBuffer::anchor() {}
535 SmallVectorMemoryBuffer::~SmallVectorMemoryBuffer() {}