[cfe-commits] r54428 - /cfe/trunk/lib/AST/StmtSerialization.cpp

Ted Kremenek kremenek at apple.com
Wed Aug 6 15:17:30 PDT 2008


Author: kremenek
Date: Wed Aug  6 17:17:30 2008
New Revision: 54428

URL: http://llvm.org/viewvc/llvm-project?rev=54428&view=rev
Log:
Fix serialization of DeclStmt.

Modified:
    cfe/trunk/lib/AST/StmtSerialization.cpp

Modified: cfe/trunk/lib/AST/StmtSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtSerialization.cpp?rev=54428&r1=54427&r2=54428&view=diff

==============================================================================
--- cfe/trunk/lib/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/lib/AST/StmtSerialization.cpp Wed Aug  6 17:17:30 2008
@@ -472,31 +472,15 @@
 void DeclStmt::EmitImpl(Serializer& S) const {
   S.Emit(StartLoc);
   S.Emit(EndLoc);
-
-  // FIXME: Clean up ownership of the Decl.
-  const ScopedDecl* d = getDecl();
-  
-  if (!S.isRegistered(d)) {
-    S.EmitBool(true);
-    S.EmitOwnedPtr(d);
-  }
-  else {
-    S.EmitBool(false);
-    S.EmitPtr(d);
-  }
+  S.EmitOwnedPtr(getDecl());
 }
     
 DeclStmt* DeclStmt::CreateImpl(Deserializer& D, ASTContext& C) {
   SourceLocation StartLoc = SourceLocation::ReadVal(D);
-  SourceLocation EndLoc = SourceLocation::ReadVal(D);
-  
-  bool OwnsDecl = D.ReadBool();  
-  ScopedDecl* decl = cast<ScopedDecl>(OwnsDecl ? D.ReadOwnedPtr<Decl>(C)
-                                               : D.ReadPtr<Decl>());
-  
+  SourceLocation EndLoc = SourceLocation::ReadVal(D);  
+  ScopedDecl* decl = cast<ScopedDecl>(D.ReadOwnedPtr<Decl>(C));  
   return new DeclStmt(decl, StartLoc, EndLoc);
 }
-    
 
 void DeclRefExpr::EmitImpl(Serializer& S) const {
   S.Emit(Loc);





More information about the cfe-commits mailing list