#include "llvm/ExecutionEngine/Interpreter.h"
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/LLVMContext.h"
Engine.reset(EngineBuilder(std::move(Owner)).setErrorStr(&Error).create());
}
- virtual void SetUp() {
+ void SetUp() override {
ASSERT_TRUE(Engine.get() != nullptr) << "EngineBuilder returned error: '"
<< Error << "'";
}
int32_t Mem1 = 3;
Engine->addGlobalMapping(G1, &Mem1);
EXPECT_EQ(&Mem1, Engine->getPointerToGlobalIfAvailable(G1));
+ EXPECT_EQ(&Mem1, Engine->getPointerToGlobalIfAvailable("Global1"));
int32_t Mem2 = 4;
Engine->updateGlobalMapping(G1, &Mem2);
EXPECT_EQ(&Mem2, Engine->getPointerToGlobalIfAvailable(G1));
// Demonstrate that getSymbolAddress accepts mangled names and always strips
// the leading underscore.
- EXPECT_EQ(reinterpret_cast<uint64_t>(&x), getSymbolAddress("_x"));
+ EXPECT_EQ(reinterpret_cast<uint64_t>(&x),
+ RTDyldMemoryManager::getSymbolAddressInProcess("_x"));
}
TEST_F(ExecutionEngineTest, LookupWithMangledAndDemangledSymbol) {
// Lookup the demangled name first, even if there's a demangled symbol that
// matches the input already.
- EXPECT_EQ(reinterpret_cast<uint64_t>(&x), getSymbolAddress("_x"));
+ EXPECT_EQ(reinterpret_cast<uint64_t>(&x),
+ RTDyldMemoryManager::getSymbolAddressInProcess("_x"));
}
TEST_F(ExecutionEngineTest, LookupwithDemangledName) {
llvm::sys::DynamicLibrary::AddSymbol("_x", &_x);
// But do fallback to looking up a demangled name if there's no ambiguity
- EXPECT_EQ(reinterpret_cast<uint64_t>(&_x), getSymbolAddress("_x"));
+ EXPECT_EQ(reinterpret_cast<uint64_t>(&_x),
+ RTDyldMemoryManager::getSymbolAddressInProcess("_x"));
}
}