forked from OSchip/llvm-project
AST: Simplify some code
Iterator invalidation issues already force us to do one lookup and one insert. Don't use the particular bit-pattern of the 'Align' field to determine whether or not we have already inserted into the TypeInfo DenseMap; instead ask for an iterator to the TypeInfo entry. llvm-svn: 214293
This commit is contained in:
parent
b0042c414e
commit
f8d3864dbe
|
@ -1432,12 +1432,13 @@ bool ASTContext::isAlignmentRequired(QualType T) const {
|
|||
}
|
||||
|
||||
TypeInfo ASTContext::getTypeInfo(const Type *T) const {
|
||||
TypeInfo TI = MemoizedTypeInfo[T];
|
||||
if (!TI.Align) {
|
||||
// This call can invalidate MemoizedTypeInfo[T], so we need a second lookup.
|
||||
TI = getTypeInfoImpl(T);
|
||||
MemoizedTypeInfo[T] = TI;
|
||||
}
|
||||
TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
|
||||
if (I != MemoizedTypeInfo.end())
|
||||
return I->second;
|
||||
|
||||
// This call can invalidate MemoizedTypeInfo[T], so we need a second lookup.
|
||||
TypeInfo TI = getTypeInfoImpl(T);
|
||||
MemoizedTypeInfo[T] = TI;
|
||||
return TI;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue