]> granicus.if.org Git - clang/commitdiff
when an enum type is completed, only flush the type cache when
authorChris Lattner <sabre@nondot.org>
Sat, 9 Jul 2011 18:53:56 +0000 (18:53 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 9 Jul 2011 18:53:56 +0000 (18:53 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134841 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenTypes.cpp

index e0baf800fbf6a879666baed7ad3d98250829c450..93754104773d64410d112e0a60075033841ae782 100644 (file)
@@ -114,8 +114,10 @@ void CodeGenTypes::UpdateCompletedType(const TagDecl *TD) {
   // 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;
   }