aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-19 20:51:16 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-19 20:51:16 +0000
commit21cf08b7e0c03266f37f436c2afd8521c643b31a (patch)
treeb5227a85e581b7b6472a791395b38138b87adb87
parentaad21d74aaf74bfbd3f8356ab0fea2c1f759efea (diff)
Remove ASTReader's PendingForwardRefs, which is now handled by the
(more general) fix-up of definition data pointers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146903 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Serialization/ASTReader.h9
-rw-r--r--lib/Serialization/ASTReader.cpp3
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp62
3 files changed, 8 insertions, 66 deletions
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 507b75f33c..bbeacb4f22 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -328,16 +328,7 @@ private:
/// \brief Updates to the visible declarations of declaration contexts that
/// haven't been loaded yet.
DeclContextVisibleUpdatesPending PendingVisibleUpdates;
-
- typedef SmallVector<Decl *, 4> ForwardRefs;
- typedef llvm::DenseMap<const Decl *, ForwardRefs>
- PendingForwardRefsMap;
- /// \brief Forward references that have a definition but the definition decl
- /// is still initializing. When the definition gets read it will update
- /// the DefinitionData pointer of all pending references.
- PendingForwardRefsMap PendingForwardRefs;
-
/// \brief The set of C++ or Objective-C classes that have forward
/// declarations that have not yet been linked to their definitions.
llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 2b417522bc..bc4fa668b3 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -6149,9 +6149,6 @@ void ASTReader::FinishedDeserializing() {
finishPendingActions();
PendingDeclChainsKnown.clear();
-
- assert(PendingForwardRefs.size() == 0 &&
- "Some forward refs did not get linked to the definition!");
}
--NumCurrentElementsDeserializing;
}
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index bd6a5a5e06..77ea318dc0 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -615,32 +615,10 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
// We will rebuild this list lazily.
ID->setIvarList(0);
- // If there are any pending forward references, make their definition data
- // pointers point at the newly-allocated data.
- ASTReader::PendingForwardRefsMap::iterator
- FindI = Reader.PendingForwardRefs.find(ID);
- if (FindI != Reader.PendingForwardRefs.end()) {
- ASTReader::ForwardRefs &Refs = FindI->second;
- for (ASTReader::ForwardRefs::iterator I = Refs.begin(),
- E = Refs.end();
- I != E; ++I)
- cast<ObjCInterfaceDecl>(*I)->Data = ID->Data;
-#ifndef NDEBUG
- // We later check whether PendingForwardRefs is empty to make sure all
- // pending references were linked.
- Reader.PendingForwardRefs.erase(ID);
-#endif
-
- // Note that we have deserialized a definition.
- Reader.PendingDefinitions.insert(ID);
- }
- } else if (Def) {
- if (Def->Data) {
- ID->Data = Def->Data;
- } else {
- // The definition is still initializing.
- Reader.PendingForwardRefs[Def].push_back(ID);
- }
+ // Note that we have deserialized a definition.
+ Reader.PendingDefinitions.insert(ID);
+ } else if (Def && Def->Data) {
+ ID->Data = Def->Data;
}
}
@@ -1018,31 +996,11 @@ void ASTDeclReader::InitializeCXXDefinitionData(CXXRecordDecl *D,
if (D == DefinitionDecl) {
D->DefinitionData = new (C) struct CXXRecordDecl::DefinitionData(D);
ReadCXXDefinitionData(*D->DefinitionData, Record, Idx);
- // We read the definition info. Check if there are pending forward
- // references that need to point to this DefinitionData pointer.
- ASTReader::PendingForwardRefsMap::iterator
- FindI = Reader.PendingForwardRefs.find(D);
- if (FindI != Reader.PendingForwardRefs.end()) {
- ASTReader::ForwardRefs &Refs = FindI->second;
- for (ASTReader::ForwardRefs::iterator
- I = Refs.begin(), E = Refs.end(); I != E; ++I)
- cast<CXXRecordDecl>(*I)->DefinitionData = D->DefinitionData;
-#ifndef NDEBUG
- // We later check whether PendingForwardRefs is empty to make sure all
- // pending references were linked.
- Reader.PendingForwardRefs.erase(D);
-#endif
- }
-
+
// Note that we have deserialized a definition.
Reader.PendingDefinitions.insert(D);
- } else if (DefinitionDecl) {
- if (DefinitionDecl->DefinitionData) {
- D->DefinitionData = DefinitionDecl->DefinitionData;
- } else {
- // The definition is still initializing.
- Reader.PendingForwardRefs[DefinitionDecl].push_back(D);
- }
+ } else if (DefinitionDecl && DefinitionDecl->DefinitionData) {
+ D->DefinitionData = DefinitionDecl->DefinitionData;
}
}
@@ -2244,12 +2202,8 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile,
ObjCInterfaceDecl *ID = cast<ObjCInterfaceDecl>(D);
ObjCInterfaceDecl *Def
= Reader.ReadDeclAs<ObjCInterfaceDecl>(ModuleFile, Record, Idx);
- if (Def->Data) {
+ if (Def->Data)
ID->Data = Def->Data;
- } else {
- // The definition is still initializing.
- Reader.PendingForwardRefs[Def].push_back(ID);
- }
break;
}
}