diff options
| author | Douglas Gregor <dgregor@apple.com> | 2012-10-11 17:31:34 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2012-10-11 17:31:34 +0000 |
| commit | d2acff9c3e43c0a94fec166d48251a7809a893f7 (patch) | |
| tree | 2318ceb6d817a9b82b1fe30eb1351ac411097dac | |
| parent | 083189730e40a2da15e6b66e5b220b707febdb9e (diff) | |
| download | bcm5719-llvm-d2acff9c3e43c0a94fec166d48251a7809a893f7.tar.gz bcm5719-llvm-d2acff9c3e43c0a94fec166d48251a7809a893f7.zip | |
Make the deserialization of PendingMacroIDs deterministic.
llvm-svn: 165727
| -rw-r--r-- | clang/include/clang/Serialization/ASTReader.h | 8 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 20 |
2 files changed, 11 insertions, 17 deletions
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 3a938a24c75..2a9afc92e9b 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -495,8 +495,8 @@ private: /// global method pool for this selector. llvm::DenseMap<Selector, unsigned> SelectorGeneration; - typedef llvm::DenseMap<IdentifierInfo *, - llvm::SmallVector<serialization::MacroID, 2> > + typedef llvm::MapVector<IdentifierInfo *, + llvm::SmallVector<serialization::MacroID, 2> > PendingMacroIDsMap; /// \brief Mapping from identifiers that have a macro history to the global @@ -1606,10 +1606,6 @@ public: /// \brief Note that this identifier is up-to-date. void markIdentifierUpToDate(IdentifierInfo *II); - /// \brief Read the macro definition corresponding to this iterator - /// into the unread macro record offsets table. - void LoadMacroDefinition(PendingMacroIDsMap::iterator Pos); - /// \brief Load all external visible decls in the given DeclContext. void completeVisibleDeclsMap(const DeclContext *DC); diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 861d99ee64d..736f082d6f3 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1542,14 +1542,6 @@ void ASTReader::ReadDefinedMacros() { } } -void ASTReader::LoadMacroDefinition(PendingMacroIDsMap::iterator Pos) { - assert(Pos != PendingMacroIDs.end() && "Unknown macro definition"); - SmallVector<MacroID, 2> GlobalIDs = Pos->second; - PendingMacroIDs.erase(Pos); - for (unsigned I = 0, N = GlobalIDs.size(); I != N; ++I) - getMacro(GlobalIDs[I]); -} - namespace { /// \brief Visitor class used to look up identifirs in an AST file. class IdentifierLookupVisitor { @@ -6517,9 +6509,15 @@ void ASTReader::finishPendingActions() { PendingDeclChains.clear(); // Load any pending macro definitions. - // FIXME: Non-determinism here. - while (!PendingMacroIDs.empty()) - LoadMacroDefinition(PendingMacroIDs.begin()); + for (unsigned I = 0; I != PendingMacroIDs.size(); ++I) { + // FIXME: std::move here + SmallVector<MacroID, 2> GlobalIDs = PendingMacroIDs.begin()[I].second; + for (unsigned IDIdx = 0, NumIDs = GlobalIDs.size(); IDIdx != NumIDs; + ++IDIdx) { + getMacro(GlobalIDs[IDIdx]); + } + } + PendingMacroIDs.clear(); } // If we deserialized any C++ or Objective-C class definitions, any |

