From 5a364c5561ec04e33a6f5d52c14f1bac6f247ea0 Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Fri, 15 Nov 2013 22:34:48 +0000 Subject: [weak vtables] Remove a bunch of weak vtables This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ExecutionEngine/ObjectBuffer.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/llvm/ExecutionEngine/ObjectBuffer.h') diff --git a/include/llvm/ExecutionEngine/ObjectBuffer.h b/include/llvm/ExecutionEngine/ObjectBuffer.h index 32de40464a..51051c9d18 100644 --- a/include/llvm/ExecutionEngine/ObjectBuffer.h +++ b/include/llvm/ExecutionEngine/ObjectBuffer.h @@ -33,7 +33,6 @@ class ObjectBuffer { public: ObjectBuffer() {} ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {} - virtual ~ObjectBuffer() {} /// getMemBuffer - Like MemoryBuffer::getMemBuffer() this function /// returns a pointer to an object that is owned by the caller. However, @@ -58,7 +57,6 @@ protected: class ObjectBufferStream : public ObjectBuffer { public: ObjectBufferStream() : OS(SV) {} - virtual ~ObjectBufferStream() {} raw_ostream &getOStream() { return OS; } void flush() -- cgit v1.2.3 From b21ab43cfc3fa0dacf5c95f04e58b6d804b59a16 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Mon, 18 Nov 2013 09:31:53 +0000 Subject: Revert r194865 and r194874. This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194997 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ExecutionEngine/ObjectBuffer.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/llvm/ExecutionEngine/ObjectBuffer.h') diff --git a/include/llvm/ExecutionEngine/ObjectBuffer.h b/include/llvm/ExecutionEngine/ObjectBuffer.h index 51051c9d18..32de40464a 100644 --- a/include/llvm/ExecutionEngine/ObjectBuffer.h +++ b/include/llvm/ExecutionEngine/ObjectBuffer.h @@ -33,6 +33,7 @@ class ObjectBuffer { public: ObjectBuffer() {} ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {} + virtual ~ObjectBuffer() {} /// getMemBuffer - Like MemoryBuffer::getMemBuffer() this function /// returns a pointer to an object that is owned by the caller. However, @@ -57,6 +58,7 @@ protected: class ObjectBufferStream : public ObjectBuffer { public: ObjectBufferStream() : OS(SV) {} + virtual ~ObjectBufferStream() {} raw_ostream &getOStream() { return OS; } void flush() -- cgit v1.2.3 From 354362524a72b3fa43a6c09380b7ae3b2380cbba Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Tue, 19 Nov 2013 00:57:56 +0000 Subject: [weak vtables] Remove a bunch of weak vtables This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195064 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ExecutionEngine/ObjectBuffer.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/llvm/ExecutionEngine/ObjectBuffer.h') diff --git a/include/llvm/ExecutionEngine/ObjectBuffer.h b/include/llvm/ExecutionEngine/ObjectBuffer.h index 32de40464a..af2a9263ff 100644 --- a/include/llvm/ExecutionEngine/ObjectBuffer.h +++ b/include/llvm/ExecutionEngine/ObjectBuffer.h @@ -30,6 +30,7 @@ namespace llvm { /// ObjectFile) as needed, but the MemoryBuffer instance returned does not own the /// actual memory it points to. class ObjectBuffer { + virtual void anchor(); public: ObjectBuffer() {} ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {} @@ -56,6 +57,7 @@ protected: /// while providing a common ObjectBuffer interface for access to the /// memory once the object has been generated. class ObjectBufferStream : public ObjectBuffer { + virtual void anchor(); public: ObjectBufferStream() : OS(SV) {} virtual ~ObjectBufferStream() {} -- cgit v1.2.3