[cfe-commits] r43733 - /cfe/trunk/AST/ASTContext.cpp

Ted Kremenek kremenek at apple.com
Mon Nov 5 12:49:23 PST 2007


Author: kremenek
Date: Mon Nov  5 14:49:23 2007
New Revision: 43733

URL: http://llvm.org/viewvc/llvm-project?rev=43733&view=rev
Log:
For serialization of ASTContext, added special-casing of serialization
of type sets when emitting complex types and pointer types that are
also considered builtins.  These types are automatically created in
the ctor of ASTContext, and thus should not be serialized (was
producing an error during deserialization).

Modified:
    cfe/trunk/AST/ASTContext.cpp

Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=43733&r1=43732&r2=43733&view=diff

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Mon Nov  5 14:49:23 2007
@@ -1407,8 +1407,39 @@
   EmitBuiltin(S,VoidPtrTy);
 
   // Emit the remaining types.
-  EmitSet(ComplexTypes, S);
-  EmitSet(PointerTypes, S);
+
+  assert (ComplexTypes.size() >= 3);
+  S.EmitInt(ComplexTypes.size() - 3);
+  
+  if (ComplexTypes.size() > 3) {
+    
+    for (llvm::FoldingSet<ComplexType>::const_iterator
+           I=ComplexTypes.begin(), E=ComplexTypes.end(); I!=E; ++I) {
+      
+      const ComplexType* T = &*I;
+    
+      if (T != FloatComplexTy.getTypePtr() &&
+          T != DoubleComplexTy.getTypePtr() &&
+          T != LongDoubleComplexTy.getTypePtr())
+        S.EmitOwnedPtr(&*I);
+    }
+  }
+  
+  assert (PointerTypes.size() >= 1);
+  S.EmitInt(PointerTypes.size() - 1);
+  
+  if (PointerTypes.size() > 1) {
+    
+    for (llvm::FoldingSet<PointerType>::const_iterator
+         I=PointerTypes.begin(), E=PointerTypes.end(); I!=E; ++I) {
+      
+      const PointerType* T = &*I;
+      
+      if (T != VoidPtrTy.getTypePtr())
+        S.EmitOwnedPtr(&*I);
+    }
+  }
+  
   EmitSet(ReferenceTypes, S);
   EmitSet(ConstantArrayTypes, S);
   EmitSet(IncompleteVariableArrayTypes, S);





More information about the cfe-commits mailing list