aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTReader.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-24 23:29:12 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-24 23:29:12 +0000
commit76dc8890b6c5223de80be8284adbfc63ceeb3a55 (patch)
tree7a6a7d1605396f009c434359184d415f4c53e676 /lib/Serialization/ASTReader.cpp
parent37bf9d2bb74944c9d9a52522412bc077629977f1 (diff)
When setting the globally-visible declarations for a particular
identifier, we may have a Sema object but no translation unit scope (because parsing is finished). In this case, we still need to update the IdResolver, which might still be used when writing a PCH containing another PCH (without chaining). This bug manifested as a failure with precompiled preambles. Also, add a little environment-variable-sensitive logging for libclang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
-rw-r--r--lib/Serialization/ASTReader.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 91f0d36118..cc593e9827 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -3362,11 +3362,11 @@ void ASTReader::InitializeSema(Sema &S) {
// Makes sure any declarations that were deserialized "too early"
// still get added to the identifier's declaration chains.
- if (SemaObj->TUScope) {
- for (unsigned I = 0, N = PreloadedDecls.size(); I != N; ++I) {
+ for (unsigned I = 0, N = PreloadedDecls.size(); I != N; ++I) {
+ if (SemaObj->TUScope)
SemaObj->TUScope->AddDecl(PreloadedDecls[I]);
- SemaObj->IdResolver.AddDecl(PreloadedDecls[I]);
- }
+
+ SemaObj->IdResolver.AddDecl(PreloadedDecls[I]);
}
PreloadedDecls.clear();
@@ -3564,8 +3564,8 @@ ASTReader::SetGloballyVisibleDecls(IdentifierInfo *II,
// and add it to the declaration chain for this identifier, so
// that (unqualified) name lookup will find it.
SemaObj->TUScope->AddDecl(D);
- SemaObj->IdResolver.AddDeclToIdentifierChain(II, D);
}
+ SemaObj->IdResolver.AddDeclToIdentifierChain(II, D);
} else {
// Queue this declaration so that it will be added to the
// translation unit scope and identifier's declaration chain