[modules] Remove some redundant work when building a lookup table for a DeclContext.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 20 Mar 2015 02:17:21 +0000 (02:17 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 20 Mar 2015 02:17:21 +0000 (02:17 +0000)
commit625ccb3f7897cb056c44808c6352d93378ac94a3
treece4511d24f37c1ab9703410cb73f1e3a6fcbb98f
parent41a1546ebcd07c27ac46bc9858159e7ba6532d1d
[modules] Remove some redundant work when building a lookup table for a DeclContext.

When we need to build the lookup table for a DeclContext, we used to pull in
all lexical declarations for the context; instead, just build a lookup table
for the local lexical declarations. We previously didn't guarantee that the
imported declarations would be in the returned map, but in some cases we'd
happen to put them all in there regardless. Now we're even lazier about this.

This unnecessary work was papering over some other bugs:

 - LookupVisibleDecls would use the DC for name lookups in the TU in C, and
   this was not guaranteed to find all imported names (generally, the DC for
   the TU in C is not a reliable place to perform lookups). We now use an
   identifier-based lookup mechanism for this.

 - We didn't actually load in the list of eagerly-deserialized declarations
   when importing a module (so external definitions in a module wouldn't be
   emitted by users of those modules unless they happened to be deserialized
   by the user of the module).

llvm-svn: 232793
clang/include/clang/AST/DeclBase.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/DeclBase.cpp
clang/lib/Sema/IdentifierResolver.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/Serialization/ASTReader.cpp
clang/test/Modules/cxx-templates.cpp
clang/test/Modules/odr.cpp
clang/test/Modules/redecl-add-after-load.cpp