diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-08-24 00:50:16 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-08-24 00:50:16 +0000 |
commit | 9617e7e8c7530f04c4be3a296890fa44902aa1ef (patch) | |
tree | 1925ad1645b680bf3fc2754601bca16940fac9bf /clang/lib/Serialization/ASTReader.cpp | |
parent | a4071b4fac77e679cff6585a3c819f702a357ac8 (diff) | |
download | bcm5719-llvm-9617e7e8c7530f04c4be3a296890fa44902aa1ef.tar.gz bcm5719-llvm-9617e7e8c7530f04c4be3a296890fa44902aa1ef.zip |
Add testcase for C++ chained PCH and fix the bugs it uncovered in name lookup.
llvm-svn: 111882
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 8167a0f5faf..38b343ffe83 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3192,9 +3192,10 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, llvm::SmallVector<NamedDecl *, 64> Decls; // There might be visible decls in multiple parts of the chain, for the TU - // and namespaces. + // and namespaces. For any given name, the last available results replace + // all earlier ones. For this reason, we walk in reverse. DeclContextInfos &Infos = DeclContextOffsets[DC]; - for (DeclContextInfos::iterator I = Infos.begin(), E = Infos.end(); + for (DeclContextInfos::reverse_iterator I = Infos.rbegin(), E = Infos.rend(); I != E; ++I) { if (!I->NameLookupTableData) continue; @@ -3208,6 +3209,7 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, ASTDeclContextNameLookupTrait::data_type Data = *Pos; for (; Data.first != Data.second; ++Data.first) Decls.push_back(cast<NamedDecl>(GetDecl(*Data.first))); + break; } ++NumVisibleDeclContextsRead; |