From eaa88c1eee7211826bed26953808e08447cf89e4 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 30 Jul 2014 04:40:23 +0000 Subject: [PATCH] Simplify the code. Thanks to David Balkie for the suggestion. llvm-svn: 214286 --- clang/lib/AST/ASTContext.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ea18d56..a9d606c 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1433,13 +1433,12 @@ bool ASTContext::isAlignmentRequired(QualType T) const { TypeInfo ASTContext::getTypeInfo(const Type *T) const { TypeInfo TI = MemoizedTypeInfo[T]; - if (TI.Align) - return TI; - - // This call can invalidate TI, so we need a second lookup. - TypeInfo Temp = getTypeInfoImpl(T); - MemoizedTypeInfo[T] = Temp; - return Temp; + if (!TI.Align) { + // This call can invalidate MemoizedTypeInfo[T], so we need a second lookup. + TI = getTypeInfoImpl(T); + MemoizedTypeInfo[T] = TI; + } + return TI; } /// getTypeInfoImpl - Return the size of the specified type, in bits. This -- 2.7.4