[cfe-commits] r134841 - /cfe/trunk/lib/CodeGen/CodeGenTypes.cpp

Chris Lattner sabre at nondot.org
Sat Jul 9 11:53:56 PDT 2011


Author: lattner
Date: Sat Jul  9 13:53:56 2011
New Revision: 134841

URL: http://llvm.org/viewvc/llvm-project?rev=134841&view=rev
Log:
when an enum type is completed, only flush the type cache when
the enum has already been converted.  If not, there cannot be any types
built on top of it, so there is no need to flush the cache.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=134841&r1=134840&r2=134841&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Sat Jul  9 13:53:56 2011
@@ -114,8 +114,10 @@
   // If this is an enum being completed, then we flush all non-struct types from
   // the cache.  This allows function types and other things that may be derived
   // from the enum to be recomputed.
-  if (isa<EnumDecl>(TD)) {
-    TypeCache.clear();
+  if (const EnumDecl *ED = dyn_cast<EnumDecl>(TD)) {
+    // Only flush the cache if we've actually already converted this type.
+    if (TypeCache.count(ED->getTypeForDecl()))
+      TypeCache.clear();
     return;
   }
   





More information about the cfe-commits mailing list