summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-16 06:12:59 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-16 06:12:59 +0000
commitf634c9006977fcbed5f55eaee831852e453fdf76 (patch)
tree2e80d52e126b0eb2e43e1521d66b868764e9535e /clang/lib/Serialization/ASTWriter.cpp
parentb37fc13a364c113c5ea6ff35d5a0686c0028cca7 (diff)
downloadbcm5719-llvm-f634c9006977fcbed5f55eaee831852e453fdf76.tar.gz
bcm5719-llvm-f634c9006977fcbed5f55eaee831852e453fdf76.zip
Fix Objective-C compilation-time performance regression introduced in r152608.
Reintroduce lazy name lookup table building, ensuring that the lazy building step produces the same lookup table that would be built by the eager step. Avoid building a lookup table for the translation unit outside C++, even in cases where we can't recover the contents of the table from the declaration chain on the translation unit, since we're not going to perform qualified lookup into it anyway. Continue to support lazily building such lookup tables for now, though, since ASTMerge uses them. In my tests, this performs very similarly to ToT with r152608 backed out, for C, Obj-C and C++, and does not suffer from PR10447. llvm-svn: 152905
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index a6cccbf4b54..b746cff76e2 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -2798,7 +2798,7 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context,
// followed by a size, followed by references to the visible
// declarations that have that name.
uint64_t Offset = Stream.GetCurrentBitNo();
- StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(DC->getLookupPtr());
+ StoredDeclsMap *Map = DC->buildLookup();
if (!Map || Map->empty())
return 0;
@@ -2863,7 +2863,8 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context,
///
/// UPDATE_VISIBLE blocks contain the declarations that are added to an existing
/// DeclContext in a dependent AST file. As such, they only exist for the TU
-/// (in C++) and for namespaces.
+/// (in C++), for namespaces, and for classes with forward-declared unscoped
+/// enumeration members (in C++11).
void ASTWriter::WriteDeclContextVisibleUpdate(const DeclContext *DC) {
StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(DC->getLookupPtr());
if (!Map || Map->empty())
OpenPOWER on IntegriCloud