Add an assert and use a range loop. NFC.

llvm-svn: 222922
This commit is contained in:
Rafael Espindola 2014-11-28 16:26:14 +00:00
parent 93cd657cf0
commit 3d0974105a
1 changed files with 4 additions and 2 deletions

View File

@ -94,13 +94,15 @@ private:
}
void TypeMapTy::addTypeMapping(Type *DstTy, Type *SrcTy) {
assert(SpeculativeTypes.empty());
// Check to see if these types are recursively isomorphic and establish a
// mapping between them if so.
if (!areTypesIsomorphic(DstTy, SrcTy)) {
// Oops, they aren't isomorphic. Just discard this request by rolling out
// any speculative mappings we've established.
for (unsigned i = 0, e = SpeculativeTypes.size(); i != e; ++i)
MappedTypes.erase(SpeculativeTypes[i]);
for (Type *Ty : SpeculativeTypes)
MappedTypes.erase(Ty);
}
SpeculativeTypes.clear();
}