Revert 94484. Re-disable unittests that need RTTI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94569 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson 2010-01-26 19:04:37 +00:00
parent d044612489
commit 8dd0ab074a
4 changed files with 22 additions and 5 deletions

View File

@ -25,6 +25,7 @@ using namespace llvm;
int dummy; int dummy;
#if 0
namespace { namespace {
struct FunctionEmittedEvent { struct FunctionEmittedEvent {
@ -237,3 +238,4 @@ testing::Environment* const jit_env =
testing::AddGlobalTestEnvironment(new JITEnvironment); testing::AddGlobalTestEnvironment(new JITEnvironment);
} // anonymous namespace } // anonymous namespace
#endif

View File

@ -58,6 +58,7 @@ std::string DumpFunction(const Function *F) {
return Result; return Result;
} }
#if 0
class RecordingJITMemoryManager : public JITMemoryManager { class RecordingJITMemoryManager : public JITMemoryManager {
const OwningPtr<JITMemoryManager> Base; const OwningPtr<JITMemoryManager> Base;
public: public:
@ -178,6 +179,7 @@ public:
return Base->endExceptionTable(F, TableStart, TableEnd, FrameRegister); return Base->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
} }
}; };
#endif
bool LoadAssemblyInto(Module *M, const char *assembly) { bool LoadAssemblyInto(Module *M, const char *assembly) {
SMDiagnostic Error; SMDiagnostic Error;
@ -195,11 +197,15 @@ class JITTest : public testing::Test {
virtual void SetUp() { virtual void SetUp() {
M = new Module("<main>", Context); M = new Module("<main>", Context);
MP = new ExistingModuleProvider(M); MP = new ExistingModuleProvider(M);
#if 0
RJMM = new RecordingJITMemoryManager; RJMM = new RecordingJITMemoryManager;
RJMM->setPoisonMemory(true); RJMM->setPoisonMemory(true);
#endif
std::string Error; std::string Error;
TheJIT.reset(EngineBuilder(MP).setEngineKind(EngineKind::JIT) TheJIT.reset(EngineBuilder(MP).setEngineKind(EngineKind::JIT)
#if 0
.setJITMemoryManager(RJMM) .setJITMemoryManager(RJMM)
#endif
.setErrorStr(&Error).create()); .setErrorStr(&Error).create());
ASSERT_TRUE(TheJIT.get() != NULL) << Error; ASSERT_TRUE(TheJIT.get() != NULL) << Error;
} }
@ -211,7 +217,9 @@ class JITTest : public testing::Test {
LLVMContext Context; LLVMContext Context;
Module *M; // Owned by MP. Module *M; // Owned by MP.
ModuleProvider *MP; // Owned by ExecutionEngine. ModuleProvider *MP; // Owned by ExecutionEngine.
#if 0
RecordingJITMemoryManager *RJMM; RecordingJITMemoryManager *RJMM;
#endif
OwningPtr<ExecutionEngine> TheJIT; OwningPtr<ExecutionEngine> TheJIT;
}; };
@ -430,6 +438,7 @@ TEST_F(JITTest, ModuleDeletion) {
TheJIT->getPointerToFunction(func); TheJIT->getPointerToFunction(func);
TheJIT->deleteModuleProvider(MP); TheJIT->deleteModuleProvider(MP);
#if 0
SmallPtrSet<const void*, 2> FunctionsDeallocated; SmallPtrSet<const void*, 2> FunctionsDeallocated;
for (unsigned i = 0, e = RJMM->deallocateFunctionBodyCalls.size(); for (unsigned i = 0, e = RJMM->deallocateFunctionBodyCalls.size();
i != e; ++i) { i != e; ++i) {
@ -463,6 +472,7 @@ TEST_F(JITTest, ModuleDeletion) {
} }
EXPECT_EQ(RJMM->startExceptionTableCalls.size(), EXPECT_EQ(RJMM->startExceptionTableCalls.size(),
NumTablesDeallocated); NumTablesDeallocated);
#endif
} }
// ARM and PPC still emit stubs for calls since the target may be too far away // ARM and PPC still emit stubs for calls since the target may be too far away
@ -497,14 +507,18 @@ TEST_F(JITTest, NoStubs) {
// We should now allocate no more stubs, we have the code to foo // We should now allocate no more stubs, we have the code to foo
// and the existing stub for bar. // and the existing stub for bar.
#if 0
int stubsBefore = RJMM->stubsAllocated; int stubsBefore = RJMM->stubsAllocated;
#endif
Function *func = M->getFunction("main"); Function *func = M->getFunction("main");
TheJIT->getPointerToFunction(func); TheJIT->getPointerToFunction(func);
Function *bar = M->getFunction("bar"); Function *bar = M->getFunction("bar");
TheJIT->getPointerToFunction(bar); TheJIT->getPointerToFunction(bar);
#if 0
ASSERT_EQ(stubsBefore, RJMM->stubsAllocated); ASSERT_EQ(stubsBefore, RJMM->stubsAllocated);
#endif
} }
#endif // !ARM && !PPC #endif // !ARM && !PPC

View File

@ -14,11 +14,7 @@
# Set up variables for building a unit test. # Set up variables for building a unit test.
ifdef TESTNAME ifdef TESTNAME
CXXFLAGS += -DGTEST_HAS_RTTI=0 REQUIRES_RTTI = 1
# gcc's TR1 <tuple> header depends on RTTI, so force googletest to use
# its own tuple implementation. When we import googletest >=1.4.0, we
# can drop this line.
CXXFLAGS += -DGTEST_HAS_TR1_TUPLE=0
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common

View File

@ -32,6 +32,10 @@
#include "llvm/Assembly/PrintModulePass.h" #include "llvm/Assembly/PrintModulePass.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
int dummy;
#if 0
namespace llvm { namespace llvm {
namespace { namespace {
// ND = no deps // ND = no deps
@ -525,3 +529,4 @@ namespace llvm {
} }
} }
#endif