Fix a use after free bug.

llvm-svn: 214281
This commit is contained in:
Rafael Espindola 2014-07-30 02:37:26 +00:00
parent d2aac5795e
commit e122ee1fab
1 changed files with 7 additions and 4 deletions

View File

@ -1432,11 +1432,14 @@ bool ASTContext::isAlignmentRequired(QualType T) const {
}
TypeInfo ASTContext::getTypeInfo(const Type *T) const {
TypeInfo &TI = MemoizedTypeInfo[T];
if (!TI.Align)
TI = getTypeInfoImpl(T);
TypeInfo TI = MemoizedTypeInfo[T];
if (TI.Align)
return TI;
return TI;
// This call can invalidate TI, so we need a second lookup.
TypeInfo Temp = getTypeInfoImpl(T);
MemoizedTypeInfo[T] = Temp;
return Temp;
}
/// getTypeInfoImpl - Return the size of the specified type, in bits. This