]> granicus.if.org Git - clang/commitdiff
Implemented serialization of TypedefDecls.
authorTed Kremenek <kremenek@apple.com>
Mon, 5 Nov 2007 21:49:34 +0000 (21:49 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 5 Nov 2007 21:49:34 +0000 (21:49 +0000)
Fixed infinite recursion in VarDecl::InternalRead.

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

AST/DeclSerialization.cpp

index a9819be1cca5ab810d7e1983c359906f949d0798..9ceb6adaef5d3ba18584e6c0ef715acb25251d49 100644 (file)
@@ -41,6 +41,10 @@ void Decl::Emit(llvm::Serializer& S) const {
     case Function:
       cast<FunctionDecl>(this)->Emit(S);
       break;
+      
+    case Typedef:
+      cast<TypedefDecl>(this)->Emit(S);
+      break;
   }
 }
 
@@ -82,7 +86,7 @@ void ValueDecl::InternalRead(llvm::Deserializer& D) {
 void VarDecl::InternalEmit(llvm::Serializer& S) const {
   S.EmitInt(SClass);
   S.EmitInt(objcDeclQualifier);
-  VarDecl::InternalEmit(S);
+  ValueDecl::InternalEmit(S);
   S.EmitOwnedPtr(Init);
 }
 
@@ -165,3 +169,17 @@ FunctionDecl* FunctionDecl::Materialize(llvm::Deserializer& D) {
   
   return decl;
 }
+
+void TypedefDecl::Emit(llvm::Serializer& S) const {
+  S.Emit(getLocation());
+  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);
+  return decl;
+}