r214286 - Simplify the code.

Rafael Espindola rafael.espindola at gmail.com
Tue Jul 29 21:40:23 PDT 2014


Author: rafael
Date: Tue Jul 29 23:40:23 2014
New Revision: 214286

URL: http://llvm.org/viewvc/llvm-project?rev=214286&view=rev
Log:
Simplify the code.

Thanks to David Balkie for the suggestion.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=214286&r1=214285&r2=214286&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Jul 29 23:40:23 2014
@@ -1433,13 +1433,12 @@ bool ASTContext::isAlignmentRequired(Qua
 
 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





More information about the cfe-commits mailing list