mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
[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
This commit is contained in:
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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.
|
||||
/*
|
||||
|
Reference in New Issue
Block a user