Completely re-implement (de-)serialization of redeclaration

chains, again. The prior implementation was very linked-list oriented, and
the list-splicing logic was both fairly convoluted (when loading from
multiple modules) and failed to preserve a reasonable ordering for the
redeclaration chains.

This new implementation uses a simpler strategy, where we store the
ordered redeclaration chains in an array-like structure (indexed based
on the first declaration), and use that ordering to add individual
deserialized declarations to the end of the existing chain. That way,
the chain mimics the ordering from its modules, and a bug somewhere is
far less likely to result in a broken linked list.

llvm-svn: 148222
This commit is contained in:
Douglas Gregor
2012-01-15 16:58:34 +00:00
parent 83369b3377
commit 358cd44170
9 changed files with 186 additions and 155 deletions

View File

@@ -35,7 +35,7 @@ ModuleFile::ModuleFile(ModuleKind Kind)
SelectorLookupTableData(0), SelectorLookupTable(0), LocalNumDecls(0),
DeclOffsets(0), BaseDeclID(0),
LocalNumCXXBaseSpecifiers(0), CXXBaseSpecifiersOffsets(0),
FileSortedDecls(0), RedeclarationsInfo(0), LocalNumRedeclarationsInfos(0),
FileSortedDecls(0), RedeclarationsMap(0), LocalNumRedeclarationsInMap(0),
LocalNumTypes(0), TypeOffsets(0), BaseTypeIndex(0), StatCache(0)
{}