summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-17 23:38:30 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-17 23:38:30 +0000
commit05f10357a93cb892d630c71a8b4a94c4eec3558e (patch)
treeaef1f01e6c53d1f74f452c762e1127835c82f732 /clang/lib/Sema/SemaLookup.cpp
parent1fc603e516ff62b8e069d463781fccded66ae24a (diff)
downloadbcm5719-llvm-05f10357a93cb892d630c71a8b4a94c4eec3558e.tar.gz
bcm5719-llvm-05f10357a93cb892d630c71a8b4a94c4eec3558e.zip
Completely re-implement (de-)serialization of declaration
chains. The previous implementation relied heavily on the declaration chain being stored as a (circular) linked list on disk, as it is in memory. However, when deserializing from multiple modules, the different chains could get mixed up, leading to broken declaration chains. The new solution keeps track of the first and last declarations in the chain for each module file. When we load a declaration, we search all of the module files for redeclarations of that declaration, then splice together all of the lists into a coherent whole (along with any redeclarations that were actually parsed). As a drive-by fix, (de-)serialize the redeclaration chains of TypedefNameDecls, which had somehow gotten missed previously. Add a test of this serialization. This new scheme creates a redeclaration table that is fairly large in the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The table is mmap'd in and searched via a binary search, but it's still quite large. A future tweak will eliminate entries for declarations that have no redeclarations anywhere, and should drastically reduce the size of this table. llvm-svn: 146841
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index a1713ee6850..bc1cb3fca63 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -1063,6 +1063,8 @@ static NamedDecl *getPreviousDeclaration(NamedDecl *D) {
return FD->getPreviousDeclaration();
if (RedeclarableTemplateDecl *RTD = dyn_cast<RedeclarableTemplateDecl>(D))
return RTD->getPreviousDeclaration();
+ if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D))
+ return TD->getPreviousDeclaration();
if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D))
return ID->getPreviousDeclaration();
OpenPOWER on IntegriCloud