summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-02-07 03:30:24 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-02-07 03:30:24 +0000
commit9ce12e36abf44b6373b88610f3c73fbbbdee9b36 (patch)
tree252cae5664a20d1ce68c51dc63bf82c4d0dd5ce2 /clang/lib/AST/DeclBase.cpp
parentc121b9b796e40f2eec2aabebb4dfcabe2f21537f (diff)
downloadbcm5719-llvm-9ce12e36abf44b6373b88610f3c73fbbbdee9b36.tar.gz
bcm5719-llvm-9ce12e36abf44b6373b88610f3c73fbbbdee9b36.zip
Simplify FindExternalVisibleDeclsByName by making it return a bool indicating
if it found any decls, rather than returning a list of found decls. This removes a returning-ArrayRef-to-deleted-storage bug from MultiplexExternalSemaSource (in code not exercised by any of the clang binaries), reduces the work required in the found-no-decls case with PCH, and importantly removes the need for DeclContext::lookup to be reentrant. No functionality change intended! llvm-svn: 174576
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 27a91cb7e66..52ecdeb3183 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1186,7 +1186,15 @@ DeclContext::lookup(DeclarationName Name) {
}
ExternalASTSource *Source = getParentASTContext().getExternalSource();
- return Source->FindExternalVisibleDeclsByName(this, Name);
+ if (Source->FindExternalVisibleDeclsByName(this, Name)) {
+ if (StoredDeclsMap *Map = LookupPtr.getPointer()) {
+ StoredDeclsMap::iterator I = Map->find(Name);
+ if (I != Map->end())
+ return I->second.getLookupResult();
+ }
+ }
+
+ return lookup_result(lookup_iterator(0), lookup_iterator(0));
}
StoredDeclsMap *Map = LookupPtr.getPointer();
OpenPOWER on IntegriCloud