From: Douglas Gregor Date: Tue, 9 Oct 2012 17:50:23 +0000 (+0000) Subject: Make the order of visitation of the pending bodies in the AST reader X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce12d2f8863588d408897602089d17c4d3c3d0e5;p=clang Make the order of visitation of the pending bodies in the AST reader deterministic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165515 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 5136113f79..5875a5052b 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -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 PendingDefinitions; + typedef llvm::MapVector, + llvm::SmallVector, 4> > + PendingBodiesMap; + /// \brief Functions or methods that have bodies that will be attached. - llvm::SmallDenseMap PendingBodies; + PendingBodiesMap PendingBodies; /// \brief Read the records that describe the contents of declcontexts. bool ReadDeclContextStorage(ModuleFile &M, diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index b37f8c2363..b7266ebbba 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -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::iterator - PB = PendingBodies.begin(), PBEnd = PendingBodies.end(); + for (PendingBodiesMap::iterator PB = PendingBodies.begin(), + PBEnd = PendingBodies.end(); PB != PBEnd; ++PB) { if (FunctionDecl *FD = dyn_cast(PB->first)) { // FIXME: Check for =delete/=default?