Fix chained PCH issue; make sure all visible decls that will be put into a UPDATE_VISIBLE block were recorded beforehand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116931 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Argyrios Kyrtzidis 2010-10-20 16:22:56 +00:00
Родитель 3e8a614b15
Коммит 0ad6dc3cee
1 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -16,6 +16,7 @@
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/DeclContextInternals.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Bitcode/BitstreamWriter.h"
#include "llvm/Support/ErrorHandling.h"
@ -636,7 +637,23 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
if (Writer.hasChain() && !D->isOriginalNamespace() &&
D->getOriginalNamespace()->getPCHLevel() > 0) {
Writer.AddUpdatedNamespace(D->getOriginalNamespace());
NamespaceDecl *NS = D->getOriginalNamespace();
Writer.AddUpdatedNamespace(NS);
// Make sure all visible decls are written. They will be recorded later.
NS->lookup(DeclarationName());
StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(NS->getLookupPtr());
if (Map) {
for (StoredDeclsMap::iterator D = Map->begin(), DEnd = Map->end();
D != DEnd; ++D) {
DeclarationName Name = D->first;
DeclContext::lookup_result Result = D->second.getLookupResult();
while (Result.first != Result.second) {
Writer.GetDeclRef(*Result.first);
++Result.first;
}
}
}
}
}