diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-11-05 20:49:23 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-11-05 20:49:23 +0000 |
commit | b8712eb9c712fcb88c626167e3b89d81341a58d1 (patch) | |
tree | 569f2caca953338a842910d7475134c4a086d94d | |
parent | 909f02a69786e94d34d34fc8d4ea3e160bcff775 (diff) |
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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43733 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/ASTContext.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp index f0b179bf39..2a12cdf7a6 100644 --- a/AST/ASTContext.cpp +++ b/AST/ASTContext.cpp @@ -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); |