[cfe-commits] r165727 - in /cfe/trunk: include/clang/Serialization/ASTReader.h lib/Serialization/ASTReader.cpp
Douglas Gregor
dgregor at apple.com
Thu Oct 11 10:31:34 PDT 2012
Author: dgregor
Date: Thu Oct 11 12:31:34 2012
New Revision: 165727
URL: http://llvm.org/viewvc/llvm-project?rev=165727&view=rev
Log:
Make the deserialization of PendingMacroIDs deterministic.
Modified:
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=165727&r1=165726&r2=165727&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Thu Oct 11 12:31:34 2012
@@ -495,8 +495,8 @@
/// 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 @@
/// \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);
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=165727&r1=165726&r2=165727&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Oct 11 12:31:34 2012
@@ -1542,14 +1542,6 @@
}
}
-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 @@
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
More information about the cfe-commits
mailing list