]> granicus.if.org Git - clang/commitdiff
For serialization of ASTContext, added special-casing of serialization
authorTed Kremenek <kremenek@apple.com>
Mon, 5 Nov 2007 20:49:23 +0000 (20:49 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 5 Nov 2007 20:49:23 +0000 (20:49 +0000)
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).

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

AST/ASTContext.cpp

index f0b179bf397628aefa34a01eb8228887e849d614..2a12cdf7a6545c2758ae74f7ed397b88c11aa498 100644 (file)
@@ -1407,8 +1407,39 @@ void ASTContext::Emit(llvm::Serializer& S) const {
   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);