]> granicus.if.org Git - clang/commitdiff
Make the order of visitation of the pending bodies in the AST reader
authorDouglas Gregor <dgregor@apple.com>
Tue, 9 Oct 2012 17:50:23 +0000 (17:50 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 9 Oct 2012 17:50:23 +0000 (17:50 +0000)
deterministic.

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

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

index 5136113f7920c13bb003b105ff31b9a421d480f7..5875a5052bbc02d27158ff04e2479cc029bad3f0 100644 (file)
@@ -33,6 +33,7 @@
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallSet.h"
@@ -342,8 +343,13 @@ private:
   /// declarations that have not yet been linked to their definitions.
   llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
 
+  typedef llvm::MapVector<Decl *, uint64_t,
+                          llvm::SmallDenseMap<Decl *, unsigned, 4>,
+                          llvm::SmallVector<std::pair<Decl *, uint64_t>, 4> >
+    PendingBodiesMap;
+
   /// \brief Functions or methods that have bodies that will be attached.
-  llvm::SmallDenseMap<Decl *, uint64_t, 4> PendingBodies;
+  PendingBodiesMap PendingBodies;
 
   /// \brief Read the records that describe the contents of declcontexts.
   bool ReadDeclContextStorage(ModuleFile &M,
index b37f8c23631896cbfb99678e4589f32a9e5d1113..b7266ebbba5b6f69ef07cb7b8cf251d76df6be56 100644 (file)
@@ -6484,8 +6484,8 @@ void ASTReader::finishPendingActions() {
   // Load the bodies of any functions or methods we've encountered. We do
   // this now (delayed) so that we can be sure that the declaration chains
   // have been fully wired up.
-  for (llvm::SmallDenseMap<Decl *, uint64_t, 4>::iterator
-         PB = PendingBodies.begin(), PBEnd = PendingBodies.end();
+  for (PendingBodiesMap::iterator PB = PendingBodies.begin(),
+                               PBEnd = PendingBodies.end();
        PB != PBEnd; ++PB) {
     if (FunctionDecl *FD = dyn_cast<FunctionDecl>(PB->first)) {
       // FIXME: Check for =delete/=default?