summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclSerialization.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-09 19:42:16 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-09 19:42:16 +0000
commit020713e308b1fac0e9e27a6071fb4f1303120637 (patch)
tree9a3b5c9e0c7d053227512b06d873a7c41d78fa10 /clang/lib/AST/DeclSerialization.cpp
parent06b9ee567b4dacc0f97fcac2923fa3cc1da947c9 (diff)
downloadbcm5719-llvm-020713e308b1fac0e9e27a6071fb4f1303120637.tar.gz
bcm5719-llvm-020713e308b1fac0e9e27a6071fb4f1303120637.zip
Replace DeclContext's vector of ScopedDecl pointers with a linked list
of ScopedDecls (using the new ScopedDecl::NextDeclInScope pointer). Performance-wise: - It's a net win in memory utilization, since DeclContext is now one pointer smaller than it used to be (std::vectors are typically 3 pointers; we now use 2 pointers) and - Parsing Cocoa.h with -fsyntax-only (with a Release-Asserts Clang) is about 1.9% faster than before, most likely because we no longer have the memory allocations and copying associated with the std::vector. I'll re-enable serialization of DeclContexts once I've sorted out the NextDeclarator/NextDeclInScope question. llvm-svn: 62001
Diffstat (limited to 'clang/lib/AST/DeclSerialization.cpp')
-rw-r--r--clang/lib/AST/DeclSerialization.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclSerialization.cpp b/clang/lib/AST/DeclSerialization.cpp
index 38af4620918..11577cd6dc2 100644
--- a/clang/lib/AST/DeclSerialization.cpp
+++ b/clang/lib/AST/DeclSerialization.cpp
@@ -124,6 +124,9 @@ void Decl::ReadInRec(Deserializer& D, ASTContext& C) {
//===----------------------------------------------------------------------===//
void DeclContext::EmitOutRec(Serializer& S) const {
+#if 0
+ // FIXME: it would be far easier to just serialize FirstDecl and let
+ // ScopedDecl do the work of serializing NextDeclInScope.
S.EmitInt(Decls.size());
for (decl_iterator D = decls_begin(); D != decls_end(); ++D) {
bool Owned = ((*D)->getLexicalDeclContext() == this &&
@@ -135,9 +138,12 @@ void DeclContext::EmitOutRec(Serializer& S) const {
else
S.EmitPtr(*D);
}
+#endif
}
void DeclContext::ReadOutRec(Deserializer& D, ASTContext& C) {
+#if 0
+ // FIXME: See comment in DeclContext::EmitOutRec
unsigned NumDecls = D.ReadInt();
Decls.resize(NumDecls);
for (unsigned Idx = 0; Idx < NumDecls; ++Idx) {
@@ -147,6 +153,7 @@ void DeclContext::ReadOutRec(Deserializer& D, ASTContext& C) {
else
D.ReadPtr<ScopedDecl>(Decls[Idx]);
}
+#endif
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud