]> granicus.if.org Git - clang/commit
[modules] Rework merging of redeclaration chains on module import.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Mar 2015 23:24:12 +0000 (23:24 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Mar 2015 23:24:12 +0000 (23:24 +0000)
commitcc533bedb934be2293673e14027a6d7aa05e8edf
tree8d0a23147181fb6e4bb98f9b4cca17df7fb347ba
parent0320f66e14b2cdbbbc940ccd274eb33ac5b0d44a
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231424 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
include/clang/AST/DeclContextInternals.h
include/clang/Serialization/ASTBitCodes.h
include/clang/Serialization/ASTReader.h
include/clang/Serialization/ASTWriter.h
lib/AST/Decl.cpp
lib/Sema/IdentifierResolver.cpp
lib/Sema/SemaLookup.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/ASTWriterDecl.cpp
test/Modules/linkage-merge.cpp