diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-11-19 06:35:35 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-11-19 06:35:35 +0000 |
commit | 9d7c776d32c8a4d64b37a91c2d627629cf1498ef (patch) | |
tree | 92f96f6c5615bd64c6f734f1534a7aa29a47c67a /unittests/ExecutionEngine | |
parent | db56a39b56db896a1043f3c2b6e5baf82d28cb0e (diff) | |
download | external_llvm-9d7c776d32c8a4d64b37a91c2d627629cf1498ef.zip external_llvm-9d7c776d32c8a4d64b37a91c2d627629cf1498ef.tar.gz external_llvm-9d7c776d32c8a4d64b37a91c2d627629cf1498ef.tar.bz2 |
Merging r195092:
------------------------------------------------------------------------
r195092 | ributzka | 2013-11-18 19:08:35 -0800 (Mon, 18 Nov 2013) | 5 lines
[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/branches/release_34@195111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ExecutionEngine')
-rw-r--r-- | unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp | 21 | ||||
-rw-r--r-- | unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp | 10 | ||||
-rw-r--r-- | unittests/ExecutionEngine/MCJIT/MCJITTest.cpp | 12 |
3 files changed, 15 insertions, 28 deletions
diff --git a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp index 15c58c4..46d6d9b 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp @@ -59,6 +59,7 @@ static void roundTripDestroy(void *object) { delete static_cast<SectionMemoryManager*>(object); } +namespace { class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon { protected: MCJITCAPITest() { @@ -83,8 +84,14 @@ protected: UnsupportedOSs.push_back(Triple::Cygwin); } - virtual void SetUp(); - + virtual void SetUp() { + didCallAllocateCodeSection = false; + Module = 0; + Function = 0; + Engine = 0; + Error = 0; + } + virtual void TearDown() { if (Engine) LLVMDisposeExecutionEngine(Engine); @@ -150,15 +157,7 @@ protected: LLVMExecutionEngineRef Engine; char *Error; }; - -// Provide out-of-line definition to prevent weak vtable. -void MCJITCAPITest::SetUp() { - didCallAllocateCodeSection = false; - Module = 0; - Function = 0; - Engine = 0; - Error = 0; -} +} // end anonymous namespace TEST_F(MCJITCAPITest, simple_function) { SKIP_UNSUPPORTED_PLATFORM; diff --git a/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp index cea6274..7c3239e 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp @@ -18,16 +18,10 @@ using namespace llvm; -class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase { -public: - virtual ~MCJITMultipleModuleTest(); -}; - -// Provide out-of-line definition to prevent weak vtable. -MCJITMultipleModuleTest::~MCJITMultipleModuleTest() {} - namespace { +class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {}; + // FIXME: ExecutionEngine has no support empty modules /* TEST_F(MCJITMultipleModuleTest, multiple_empty_modules) { diff --git a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp index 9786bef..fab8155 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp @@ -18,19 +18,13 @@ using namespace llvm; +namespace { + class MCJITTest : public testing::Test, public MCJITTestBase { protected: - - virtual void SetUp(); + virtual void SetUp() { M.reset(createEmptyModule("<main>")); } }; -// Provide out-of-line definition to prevent weak vtable. -void MCJITTest::SetUp() { - M.reset(createEmptyModule("<main>")); -} - -namespace { - // FIXME: Ensure creating an execution engine does not crash when constructed // with a null module. /* |