}
StringRef val() const { return StringRef(P, Size); }
+ uint32_t size() const { return Size; }
uint32_t hash() const { return Hash; }
};
/// \brief Add a string to the builder. Returns the position of S in the
/// table. The position will be changed if finalize is used.
/// Can only be used before the table is finalized.
- size_t add(StringRef S);
+ size_t add(CachedHashString S);
+ size_t add(StringRef S) { return add(CachedHashString(S)); }
/// \brief Analyze the strings and build the final table. No more strings can
/// be added after this point.
/// \brief Get the offest of a string in the string table. Can only be used
/// after the table is finalized.
- size_t getOffset(StringRef S) const;
+ size_t getOffset(CachedHashString S) const;
+ size_t getOffset(StringRef S) const { return getOffset(CachedHashString(S)); }
size_t getSize() const { return Size; }
void clear();
StringIndexMap.clear();
}
-size_t StringTableBuilder::getOffset(StringRef S) const {
+size_t StringTableBuilder::getOffset(CachedHashString S) const {
assert(isFinalized());
auto I = StringIndexMap.find(S);
assert(I != StringIndexMap.end() && "String is not in table!");
return I->second;
}
-size_t StringTableBuilder::add(StringRef S) {
+size_t StringTableBuilder::add(CachedHashString S) {
if (K == WinCOFF)
assert(S.size() > COFF::NameSize && "Short string in COFF string table!");