[cfe-commits] r50976 - /cfe/trunk/lib/AST/DeclSerialization.cpp

Ted Kremenek kremenek at apple.com
Mon May 12 10:29:35 PDT 2008


Author: kremenek
Date: Mon May 12 12:29:34 2008
New Revision: 50976

URL: http://llvm.org/viewvc/llvm-project?rev=50976&view=rev
Log:
When reading in the DeclCtx during deserialization, register the DeclCtx of the
ScopedDecl with the backpatcher, and *not* a local variable on the stack. The
value of DeclCtx gets filled in *later* by the backpatcher.

This fixes: http://llvm.org/bugs/show_bug.cgi?id=2308

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

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

==============================================================================
--- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/lib/AST/DeclSerialization.cpp Mon May 12 12:29:34 2008
@@ -116,9 +116,10 @@
 void ScopedDecl::ReadInRec(Deserializer& D, ASTContext& C) {
   NamedDecl::ReadInRec(D, C);
   D.ReadPtr(Next);                                  // From ScopedDecl.
-  Decl *TmpD;
-  D.ReadPtr(TmpD);                                  // From ScopedDecl.
-  DeclCtx = cast_or_null<DeclContext>(TmpD);
+  
+  DeclCtx = 0;            // Allow back-patching.  Observe that we register
+  D.ReadPtr(DeclCtx);     // the variable of the *object* for back-patching.
+                          // It's actual value will get filled in later.
 }
     
   //===------------------------------------------------------------===//





More information about the cfe-commits mailing list