diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-03-05 23:24:12 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-03-05 23:24:12 +0000 |
commit | fe620d26ea10980f56f87db68c9e63c4a7832aa0 (patch) | |
tree | 62ab35d2b491c70ce7219678f87041d6bacd6378 /clang/lib/Sema/SemaLookup.cpp | |
parent | 6fb4915bd6a751f9d52aceae72186c11f30b830c (diff) | |
download | bcm5719-llvm-fe620d26ea10980f56f87db68c9e63c4a7832aa0.tar.gz bcm5719-llvm-fe620d26ea10980f56f87db68c9e63c4a7832aa0.zip |
[modules] Rework merging of redeclaration chains on module import.
We used to save out and eagerly load a (potentially huge) table of merged
formerly-canonical declarations when we loaded each module. This was extremely
inefficient in the presence of large amounts of merging, and didn't actually
save any merging lookup work, because we still needed to perform name lookup to
check that our merged declaration lists were complete. This also resulted in a
loss of laziness -- even if we only needed an early declaration of an entity, we
would eagerly pull in all declarations that had been merged into it regardless.
We now store the relevant fragments of the table within the declarations
themselves. In detail:
* The first declaration of each entity within a module stores a list of first
declarations from imported modules that are merged into it.
* Loading that declaration pre-loads those other entities, so that they appear
earlier within the redeclaration chain.
* The name lookup tables list the most recent local lookup result, if there
is one, or all directly-imported lookup results if not.
llvm-svn: 231424
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 06d2223c0b9..d9ac445a6a1 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -415,7 +415,9 @@ void LookupResult::resolveKind() { // If it's not unique, pull something off the back (and // continue at this index). // FIXME: This is wrong. We need to take the more recent declaration in - // order to get the right type, default arguments, etc. + // order to get the right type, default arguments, etc. We also need to + // prefer visible declarations to hidden ones (for redeclaration lookup + // in modules builds). Decls[I] = Decls[--N]; continue; } |