diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-07-17 21:16:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-07-17 21:16:27 +0000 |
commit | 93ed7cf05f900b9150dcf59c0e0f37f3bd325f62 (patch) | |
tree | 525545912354cdb7fcd7a82eceec9ef96c30710f /lib/AST/DeclBase.cpp | |
parent | 26dc97cbeba8ced19972a259720a71aefa01ef43 (diff) |
Teach the ASTImporter how to handle anonymous structs/unions
better. Fixes <rdar://problem/11466212>; the test (and back-ported
version of this code) were committed to LLDB in r160186.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 574f779b86..f9ce46def5 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -1196,23 +1196,25 @@ void DeclContext::localUncachedLookup(DeclarationName Name, // If there's no external storage, just perform a normal lookup and copy // the results. - if (!hasExternalVisibleStorage() && !hasExternalLexicalStorage()) { + if (!hasExternalVisibleStorage() && !hasExternalLexicalStorage() && Name) { lookup_result LookupResults = lookup(Name); Results.insert(Results.end(), LookupResults.first, LookupResults.second); return; } // If we have a lookup table, check there first. Maybe we'll get lucky. - if (StoredDeclsMap *Map = LookupPtr.getPointer()) { - StoredDeclsMap::iterator Pos = Map->find(Name); - if (Pos != Map->end()) { - Results.insert(Results.end(), - Pos->second.getLookupResult().first, - Pos->second.getLookupResult().second); - return; + if (Name) { + if (StoredDeclsMap *Map = LookupPtr.getPointer()) { + StoredDeclsMap::iterator Pos = Map->find(Name); + if (Pos != Map->end()) { + Results.insert(Results.end(), + Pos->second.getLookupResult().first, + Pos->second.getLookupResult().second); + return; + } } } - + // Slow case: grovel through the declarations in our chain looking for // matches. for (Decl *D = FirstDecl; D; D = D->getNextDeclInContext()) { |