[cfe-commits] r107596 - /cfe/trunk/lib/AST/DeclBase.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Sun Jul 4 14:44:25 PDT 2010
Author: akirtzidis
Date: Sun Jul 4 16:44:25 2010
New Revision: 107596
URL: http://llvm.org/viewvc/llvm-project?rev=107596&view=rev
Log:
When adding a visible decl, deserialize the visible decls and add it.
Before this commit, visible decls added before deserialization were ignored.
This was not an issue since name lookup (that usually comes before the addition) forces deserialization
but it is an issue for lazily declared class implicit members.
We can use a PCH'ed <string> now.
Modified:
cfe/trunk/lib/AST/DeclBase.cpp
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=107596&r1=107595&r2=107596&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Sun Jul 4 16:44:25 2010
@@ -947,9 +947,10 @@
}
// If we already have a lookup data structure, perform the insertion
- // into it. Otherwise, be lazy and don't build that structure until
- // someone asks for it.
- if (LookupPtr || !Recoverable)
+ // into it. If we haven't deserialized externally stored decls, deserialize
+ // them so we can add the decl. Otherwise, be lazy and don't build that
+ // structure until someone asks for it.
+ if (LookupPtr || !Recoverable || hasExternalVisibleStorage())
makeDeclVisibleInContextImpl(D);
// If we are a transparent context, insert into our parent context,
@@ -969,18 +970,18 @@
if (isa<ClassTemplateSpecializationDecl>(D))
return;
- ASTContext *C = 0;
- if (!LookupPtr) {
- C = &getParentASTContext();
- CreateStoredDeclsMap(*C);
- }
-
// If there is an external AST source, load any declarations it knows about
// with this declaration's name.
if (ExternalASTSource *Source = getParentASTContext().getExternalSource())
if (hasExternalVisibleStorage())
Source->FindExternalVisibleDeclsByName(this, D->getDeclName());
+ ASTContext *C = 0;
+ if (!LookupPtr) {
+ C = &getParentASTContext();
+ CreateStoredDeclsMap(*C);
+ }
+
// Insert this declaration into the map.
StoredDeclsList &DeclNameEntries = (*LookupPtr)[D->getDeclName()];
if (DeclNameEntries.isNull()) {
More information about the cfe-commits
mailing list