diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-07 03:30:24 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-07 03:30:24 +0000 |
commit | 9ce12e36abf44b6373b88610f3c73fbbbdee9b36 (patch) | |
tree | 252cae5664a20d1ce68c51dc63bf82c4d0dd5ce2 /clang/lib/Serialization/ASTReader.cpp | |
parent | c121b9b796e40f2eec2aabebb4dfcabe2f21537f (diff) | |
download | bcm5719-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/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index aa4c448e989..1213084e365 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -5424,14 +5424,13 @@ static ModuleFile *getDefinitiveModuleFileFor(const DeclContext *DC, return 0; } -DeclContext::lookup_result +bool ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) { assert(DC->hasExternalVisibleStorage() && "DeclContext has no visible decls in storage"); if (!Name) - return DeclContext::lookup_result(DeclContext::lookup_iterator(0), - DeclContext::lookup_iterator(0)); + return false; SmallVector<NamedDecl *, 64> Decls; @@ -5464,7 +5463,7 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, } ++NumVisibleDeclContextsRead; SetExternalVisibleDeclsForName(DC, Name, Decls); - return const_cast<DeclContext*>(DC)->lookup(Name); + return !Decls.empty(); } namespace { |