diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-28 14:20:37 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-28 14:20:37 +0000 |
commit | dc5c9586025a12bf46080782d96026a8e4b56bf0 (patch) | |
tree | 356b5437ba0a98ba9f8ce54b12a0c44d296c3645 /clang/lib/Serialization/ASTReader.cpp | |
parent | dea551c59aff1d7bcc4b863cf439da5637a74b05 (diff) | |
download | bcm5719-llvm-dc5c9586025a12bf46080782d96026a8e4b56bf0.tar.gz bcm5719-llvm-dc5c9586025a12bf46080782d96026a8e4b56bf0.zip |
Make Sema::LocallyScopedExternalDecls lazily deserialized. In theory,
we could turn this into an on-disk hash table so we don't load the
whole thing the first time we need it. However, it tends to be very,
very small (i.e., empty) for most precompiled headers, so it isn't all
that interesting.
llvm-svn: 136352
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 6883f448802..4b4432e46d5 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2062,7 +2062,7 @@ ASTReader::ReadASTBlock(Module &F) { &F, /* No visible information */ 0, reinterpret_cast<const KindDeclIDPair *>(BlobStart), - BlobLen / sizeof(KindDeclIDPair) + static_cast<unsigned int>(BlobLen / sizeof(KindDeclIDPair)) }; DeclContextOffsets[Context ? Context->getTranslationUnitDecl() : 0] .push_back(Info); @@ -4349,14 +4349,6 @@ void ASTReader::InitializeSema(Sema &S) { } PreloadedDecls.clear(); - // If there were any locally-scoped external declarations, - // deserialize them and add them to Sema's table of locally-scoped - // external declarations. - for (unsigned I = 0, N = LocallyScopedExternalDecls.size(); I != N; ++I) { - NamedDecl *D = cast<NamedDecl>(GetDecl(LocallyScopedExternalDecls[I])); - SemaObj->LocallyScopedExternalDecls[D->getDeclName()] = D; - } - // FIXME: Do VTable uses and dynamic classes deserialize too much ? // Can we cut them down before writing them ? @@ -4616,6 +4608,17 @@ void ASTReader::ReadDynamicClasses(SmallVectorImpl<CXXRecordDecl *> &Decls) { DynamicClasses.clear(); } +void +ASTReader::ReadLocallyScopedExternalDecls(SmallVectorImpl<NamedDecl *> &Decls) { + for (unsigned I = 0, N = LocallyScopedExternalDecls.size(); I != N; ++I) { + NamedDecl *D + = dyn_cast_or_null<NamedDecl>(GetDecl(LocallyScopedExternalDecls[I])); + if (D) + Decls.push_back(D); + } + LocallyScopedExternalDecls.clear(); +} + void ASTReader::LoadSelector(Selector Sel) { // It would be complicated to avoid reading the methods anyway. So don't. ReadMethodPool(Sel); |