[ORC] Add dereference operator to SymbolStringPtr.

Dereference yields a StringRef.

llvm-svn: 321836
This commit is contained in:
Lang Hames 2018-01-05 00:04:13 +00:00
parent 8040e5047b
commit 183a059f76
2 changed files with 8 additions and 0 deletions

View File

@ -92,6 +92,8 @@ public:
return S->getValue() < Other.S->getValue();
}
StringRef operator*() const { return S->first(); }
private:
SymbolStringPtr(SymbolStringPool::PoolMapEntry *S)

View File

@ -34,6 +34,12 @@ TEST(SymbolStringPool, UniquingAndComparisons) {
(void)(P1 < P3);
}
TEST(SymbolStringPool, Dereference) {
SymbolStringPool SP;
auto Foo = SP.intern("foo");
EXPECT_EQ(*Foo, "foo") << "Equality on dereferenced string failed";
}
TEST(SymbolStringPool, ClearDeadEntries) {
SymbolStringPool SP;
{