[serialization] Fix another cursor-clobbering mistake.

When reading trailing records, make sure we don't go off and read something
else in the mean time...

Swift SVN r6518
This commit is contained in:
Jordan Rose
2013-07-23 23:10:02 +00:00
parent b619a125a1
commit 36138474d1

View File

@@ -1700,11 +1700,17 @@ Type ModuleFile::getType(TypeID TID) {
decls_block::BoundGenericTypeLayout::readRecord(scratch, declID, parentID,
rawArgumentIDs);
SmallVector<Type, 8> genericArgs;
for (TypeID type : rawArgumentIDs)
genericArgs.push_back(getType(type));
NominalTypeDecl *nominal;
Type parentTy;
{
BCOffsetRAII restoreOffset(DeclTypeCursor);
for (TypeID type : rawArgumentIDs)
genericArgs.push_back(getType(type));
nominal = cast<NominalTypeDecl>(getDecl(declID));
parentTy = getType(parentID);
}
auto boundTy = BoundGenericType::get(cast<NominalTypeDecl>(getDecl(declID)),
getType(parentID), genericArgs);
auto boundTy = BoundGenericType::get(nominal, parentTy, genericArgs);
typeOrOffset = boundTy;
// BoundGenericTypes get uniqued in the ASTContext, so it's possible this