Fix issue with Tpi Stream hash map.

Part of the patch to not build the hash map eagerly was omitted
due to a merge conflict.  Add it back, which should fix the failing
tests.

llvm-svn: 348166
This commit is contained in:
Zachary Turner 2018-12-03 19:05:12 +00:00
parent b77711e297
commit 1e0cce796c
1 changed files with 6 additions and 0 deletions

View File

@ -160,6 +160,9 @@ void TpiStream::buildHashMap() {
}
std::vector<TypeIndex> TpiStream::findRecordsByName(StringRef Name) const {
if (!supportsTypeLookup())
const_cast<TpiStream*>(this)->buildHashMap();
uint32_t Bucket = hashStringV1(Name) % Header->NumHashBuckets;
if (Bucket > HashMap.size())
return {};
@ -177,6 +180,9 @@ bool TpiStream::supportsTypeLookup() const { return !HashMap.empty(); }
Expected<TypeIndex>
TpiStream::findFullDeclForForwardRef(TypeIndex ForwardRefTI) const {
if (!supportsTypeLookup())
const_cast<TpiStream*>(this)->buildHashMap();
CVType F = Types->getType(ForwardRefTI);
if (!isUdtForwardRef(F))
return ForwardRefTI;