[cfe-commits] r117238 - in /cfe/trunk: include/clang/Serialization/ASTWriter.h lib/Serialization/ASTWriter.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Sun Oct 24 10:26:46 PDT 2010


Author: akirtzidis
Date: Sun Oct 24 12:26:46 2010
New Revision: 117238

URL: http://llvm.org/viewvc/llvm-project?rev=117238&view=rev
Log:
Introduce a DeclsToRewrite field in ASTWrite, used for collecting the decls that will be replaced in the chained PCH.

Modified:
    cfe/trunk/include/clang/Serialization/ASTWriter.h
    cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=117238&r1=117237&r2=117238&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Sun Oct 24 12:26:46 2010
@@ -223,6 +223,10 @@
   /// to this set, so that we can write out lexical content updates for it.
   llvm::SmallPtrSet<const NamespaceDecl *, 16> UpdatedNamespaces;
 
+  typedef llvm::SmallPtrSet<const Decl *, 16> DeclsToRewriteTy;
+  /// \brief Decls that will be replaced in the current dependent AST file.
+  DeclsToRewriteTy DeclsToRewrite;
+
   /// \brief Decls that have been replaced in the current dependent AST file.
   ///
   /// When a decl changes fundamentally after being deserialized (this shouldn't

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=117238&r1=117237&r2=117238&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Sun Oct 24 12:26:46 2010
@@ -2410,6 +2410,10 @@
     else
       WriteDecl(Context, DOT.getDecl());
   }
+  for (DeclsToRewriteTy::iterator
+         I = DeclsToRewrite.begin(), E = DeclsToRewrite.end(); I != E; ++I) {
+    WriteDecl(Context, const_cast<Decl*>(*I));
+  }
   Stream.ExitBlock();
 
   WritePreprocessor(PP);
@@ -2720,6 +2724,9 @@
     const Decl *D = I->first;
     UpdateRecord &URec = I->second;
 
+    if (DeclsToRewrite.count(D))
+      continue; // The decl will be written completely,no need to store updates.
+
     uint64_t Offset = Stream.GetCurrentBitNo();
     Stream.EmitRecord(DECL_UPDATES, URec);
 





More information about the cfe-commits mailing list