summaryrefslogtreecommitdiff
path: root/unittests/ADT/IntrusiveRefCntPtrTest.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2013-11-19 03:08:35 +0000
committerJuergen Ributzka <juergen@apple.com>2013-11-19 03:08:35 +0000
commitba0f991a78706068cc2e6a1c4ef4b0d8f7ce748b (patch)
tree92f96f6c5615bd64c6f734f1534a7aa29a47c67a /unittests/ADT/IntrusiveRefCntPtrTest.cpp
parent36c7806f4eacd676932ba630246f88e0e37b1cd4 (diff)
downloadllvm-ba0f991a78706068cc2e6a1c4ef4b0d8f7ce748b.tar.gz
llvm-ba0f991a78706068cc2e6a1c4ef4b0d8f7ce748b.tar.bz2
llvm-ba0f991a78706068cc2e6a1c4ef4b0d8f7ce748b.tar.xz
[weak vtables] Place class definitions into anonymous namespaces to prevent weak vtables.
This patch places class definitions in implementation files into anonymous namespaces to prevent weak vtables. This eliminates the need of providing an out-of-line definition to pin the vtable explicitly to the file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ADT/IntrusiveRefCntPtrTest.cpp')
-rw-r--r--unittests/ADT/IntrusiveRefCntPtrTest.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/unittests/ADT/IntrusiveRefCntPtrTest.cpp b/unittests/ADT/IntrusiveRefCntPtrTest.cpp
index a74e05e7b2..c67ec13091 100644
--- a/unittests/ADT/IntrusiveRefCntPtrTest.cpp
+++ b/unittests/ADT/IntrusiveRefCntPtrTest.cpp
@@ -10,14 +10,13 @@
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "gtest/gtest.h"
-namespace llvm {
-
-struct VirtualRefCounted : public RefCountedBaseVPTR {
- virtual void f();
+namespace {
+struct VirtualRefCounted : public llvm::RefCountedBaseVPTR {
+ virtual void f() {}
};
+}
-// Provide out-of-line definition to prevent weak vtable.
-void VirtualRefCounted::f() {}
+namespace llvm {
// Run this test with valgrind to detect memory leaks.
TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) {