[orc-rt] Hold const void* rather than void* in ControllerInterface. (#186954)
We only care about addresses in ControllerInterface, not the underlying memory.
This commit is contained in:
parent
33cfc6ba61
commit
f1b16eaedd
@ -26,7 +26,7 @@ namespace orc_rt {
|
||||
/// duplicates with an error.
|
||||
class ControllerInterface {
|
||||
public:
|
||||
using SymbolTable = std::unordered_map<std::string, void *>;
|
||||
using SymbolTable = std::unordered_map<std::string, const void *>;
|
||||
using iterator = SymbolTable::const_iterator;
|
||||
|
||||
bool empty() const noexcept { return Symbols.empty(); }
|
||||
|
||||
@ -41,6 +41,18 @@ TEST(ControllerInterfaceTest, AddSymbolsUnique) {
|
||||
EXPECT_EQ(CI.at("orc_rt_B"), &Y);
|
||||
}
|
||||
|
||||
TEST(ControllerInterfaceTest, AddConstPointers) {
|
||||
ControllerInterface CI;
|
||||
const int X = 42;
|
||||
const int Y = 7;
|
||||
std::pair<const char *, const void *> Syms[] = {{"orc_rt_A", &X},
|
||||
{"orc_rt_B", &Y}};
|
||||
cantFail(CI.addSymbolsUnique(Syms));
|
||||
|
||||
EXPECT_EQ(CI.at("orc_rt_A"), &X);
|
||||
EXPECT_EQ(CI.at("orc_rt_B"), &Y);
|
||||
}
|
||||
|
||||
TEST(ControllerInterfaceTest, AddSymbolsUniqueMultipleCalls) {
|
||||
ControllerInterface CI;
|
||||
int X = 0, Y = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user