]> granicus.if.org Git - clang/commitdiff
Introduce a DeclsToRewrite field in ASTWrite, used for collecting the decls that...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 24 Oct 2010 17:26:46 +0000 (17:26 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 24 Oct 2010 17:26:46 +0000 (17:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117238 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Serialization/ASTWriter.h
lib/Serialization/ASTWriter.cpp

index 71d20dda5ee2292753369aa0dcf0c7a431cadcce..d6b146757695c73037689ef7cc90b9ef3a14ae03 100644 (file)
@@ -223,6 +223,10 @@ private:
   /// 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
index 7636f02bdf0420fc41d1f6dc5b23af8ee2d8f296..c6df2dd95d33a785eb0699ab6bc45b66ede22d92 100644 (file)
@@ -2410,6 +2410,10 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
     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 @@ void ASTWriter::WriteDeclUpdatesBlocks() {
     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);