summaryrefslogtreecommitdiffstats
path: root/test/PCH/chain-cxx.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
commita1be278c4f3a234ff61f04018d26c6beecde1654 (patch)
tree417374c22b99d713e9c7dbe093ec987d65cb7374 /test/PCH/chain-cxx.cpp
parent79cbbdc8affe52591f7ee487a789639aa38331ec (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH/chain-cxx.cpp')
-rw-r--r--test/PCH/chain-cxx.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/PCH/chain-cxx.cpp b/test/PCH/chain-cxx.cpp
index af0a23afea..c42ee7d39e 100644
--- a/test/PCH/chain-cxx.cpp
+++ b/test/PCH/chain-cxx.cpp
@@ -44,6 +44,8 @@ const int TS3<T>::value;
// Instantiate struct, but not value.
struct instantiate : TS3<int> {};
+// Typedef
+typedef int Integer;
//===----------------------------------------------------------------------===//
#elif not defined(HEADER2)
@@ -97,6 +99,9 @@ struct B : A { };
// Instantiate TS3's member.
static const int ts3m1 = TS3<int>::value;
+// Redefinition of typedef
+typedef int Integer;
+
//===----------------------------------------------------------------------===//
#else
//===----------------------------------------------------------------------===//
@@ -122,6 +127,7 @@ void test() {
TS2int ts2;
B b;
+ Integer i = 17;
}
// Should have remembered that there is a definition.