[cfe-commits] r43774 - in /cfe/trunk/AST: ASTContext.cpp DeclSerialization.cpp
Ted Kremenek
kremenek at apple.com
Tue Nov 6 11:51:48 PST 2007
Author: kremenek
Date: Tue Nov 6 13:51:47 2007
New Revision: 43774
URL: http://llvm.org/viewvc/llvm-project?rev=43774&view=rev
Log:
Misc. serialization changes to ASTContext and Decls. Serialization
for ASTContext is still rapidly evolving.
Modified:
cfe/trunk/AST/ASTContext.cpp
cfe/trunk/AST/DeclSerialization.cpp
Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=43774&r1=43773&r2=43774&view=diff
==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Tue Nov 6 13:51:47 2007
@@ -1425,7 +1425,7 @@
}
}
- assert (PointerTypes.size() >= 1);
+ assert (PointerTypes.size() >= 1);
S.EmitInt(PointerTypes.size() - 1);
if (PointerTypes.size() > 1) {
@@ -1450,13 +1450,13 @@
// FIXME: EmitSet(ObjcQualifiedInterfaceTypes,S);
S.Emit(BuiltinVaListType);
- S.Emit(ObjcIdType);
- S.EmitPtr(IdStructType);
- S.Emit(ObjcProtoType);
- S.EmitPtr(ProtoStructType);
- S.Emit(ObjcClassType);
- S.EmitPtr(ClassStructType);
- S.Emit(ObjcConstantStringType);
+// FIXME: S.Emit(ObjcIdType);
+// FIXME: S.EmitPtr(IdStructType);
+// FIXME: S.Emit(ObjcProtoType);
+ // FIXME: S.EmitPtr(ProtoStructType);
+ // FIXME: S.Emit(ObjcClassType);
+// FIXME: S.EmitPtr(ClassStructType);
+// FIXME: S.Emit(ObjcConstantStringType);
// FIXME: S.EmitOwnedPtr(CFConstantStringTypeDecl);
}
@@ -1505,13 +1505,13 @@
// ReadSet(A->ObjcQualifiedInterfaceTypes,D);
D.Read(A->BuiltinVaListType);
- D.Read(A->ObjcIdType);
- D.ReadPtr(A->IdStructType);
- D.Read(A->ObjcProtoType);
- D.ReadPtr(A->ProtoStructType);
- D.Read(A->ObjcClassType);
- D.ReadPtr(A->ClassStructType);
- D.Read(A->ObjcConstantStringType);
+// FIXME: D.Read(A->ObjcIdType);
+// FIXME: D.ReadPtr(A->IdStructType);
+// FIXME: D.Read(A->ObjcProtoType);
+// FIXME: D.ReadPtr(A->ProtoStructType);
+// FIXME: D.Read(A->ObjcClassType);
+// FIXME: D.ReadPtr(A->ClassStructType);
+// FIXME: D.Read(A->ObjcConstantStringType);
// FIXME: A->CFConstantStringTypeDecl = D.ReadOwnedPtr<RecordDecl>();
return A;
Modified: cfe/trunk/AST/DeclSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/DeclSerialization.cpp?rev=43774&r1=43773&r2=43774&view=diff
==============================================================================
--- cfe/trunk/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/AST/DeclSerialization.cpp Tue Nov 6 13:51:47 2007
@@ -49,8 +49,28 @@
}
Decl* Decl::Materialize(llvm::Deserializer& D) {
- assert (false && "FIXME: not implemented.");
- return NULL;
+ Kind k = static_cast<Kind>(D.ReadInt());
+
+ switch (k) {
+ default:
+ assert (false && "Not implemented.");
+ break;
+
+ case BlockVar:
+ return BlockVarDecl::Materialize(D);
+
+ case FileVar:
+ return FileVarDecl::Materialize(D);
+
+ case ParmVar:
+ return ParmVarDecl::Materialize(D);
+
+ case Function:
+ return FunctionDecl::Materialize(D);
+
+ case Typedef:
+ return TypedefDecl::Materialize(D);
+ }
}
void NamedDecl::InternalEmit(llvm::Serializer& S) const {
@@ -70,7 +90,7 @@
void ScopedDecl::InternalRead(llvm::Deserializer& D) {
NamedDecl::InternalRead(D);
D.ReadPtr(Next);
- NextDeclarator = cast<ScopedDecl>(D.ReadOwnedPtr<Decl>());
+ NextDeclarator = cast_or_null<ScopedDecl>(D.ReadOwnedPtr<Decl>());
}
void ValueDecl::InternalEmit(llvm::Serializer& S) const {
@@ -93,7 +113,7 @@
void VarDecl::InternalRead(llvm::Deserializer& D) {
SClass = D.ReadInt();
objcDeclQualifier = static_cast<ObjcDeclQualifier>(D.ReadInt());
- VarDecl::InternalRead(D);
+ ValueDecl::InternalRead(D);
D.ReadOwnedPtr(Init);
}
@@ -172,14 +192,14 @@
void TypedefDecl::Emit(llvm::Serializer& S) const {
S.Emit(getLocation());
+ S.Emit(UnderlyingType);
InternalEmit(S);
- S.Emit(UnderlyingType);
}
TypedefDecl* TypedefDecl::Materialize(llvm::Deserializer& D) {
SourceLocation L = SourceLocation::ReadVal(D);
TypedefDecl* decl = new TypedefDecl(L,NULL,QualType(),NULL);
- decl->InternalRead(D);
D.Read(decl->UnderlyingType);
+ decl->InternalRead(D);
return decl;
}
More information about the cfe-commits
mailing list