From 3646c68676c3c46a026b23d52188ef6e0d856178 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 7 Feb 2013 03:30:24 +0000 Subject: 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174576 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/MultiplexExternalSemaSource.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'lib/Sema/MultiplexExternalSemaSource.cpp') diff --git a/lib/Sema/MultiplexExternalSemaSource.cpp b/lib/Sema/MultiplexExternalSemaSource.cpp index ecce6d8e7b..d85624ba6f 100644 --- a/lib/Sema/MultiplexExternalSemaSource.cpp +++ b/lib/Sema/MultiplexExternalSemaSource.cpp @@ -81,19 +81,12 @@ CXXBaseSpecifier *MultiplexExternalSemaSource::GetExternalCXXBaseSpecifiers( return 0; } -DeclContextLookupResult MultiplexExternalSemaSource:: +bool MultiplexExternalSemaSource:: FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) { - StoredDeclsList DeclsFound; - for(size_t i = 0; i < Sources.size(); ++i) { - DeclContext::lookup_result R = - Sources[i]->FindExternalVisibleDeclsByName(DC, Name); - for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E; - ++I) { - if (!DeclsFound.HandleRedeclaration(*I)) - DeclsFound.AddSubsequentDecl(*I); - } - } - return DeclsFound.getLookupResult(); + bool AnyDeclsFound = false; + for (size_t i = 0; i < Sources.size(); ++i) + AnyDeclsFound |= Sources[i]->FindExternalVisibleDeclsByName(DC, Name); + return AnyDeclsFound; } void MultiplexExternalSemaSource::completeVisibleDeclsMap(const DeclContext *DC){ -- cgit v1.2.1