]> granicus.if.org Git - clang/commit
[modules] Rearrange how redeclaration chains are loaded, to remove a walk over
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 22 Aug 2015 01:47:18 +0000 (01:47 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 22 Aug 2015 01:47:18 +0000 (01:47 +0000)
commitfe4ae099f54be229f418d22e1e608c331d0fb17a
tree009717a4ed5018ef2cd42b722a3a2d76d8cb6b22
parent4241f944e8d9a93c776fe9d7f4d5f31e2186f0b9
[modules] Rearrange how redeclaration chains are loaded, to remove a walk over
all modules and reduce the number of declarations we load when loading a
redeclaration chain.

The new approach is:
 * when loading the first declaration of an entity within a module file, we
   first load all declarations of the entity that were imported into that
   module file, and then load all the other declarations of that entity from
   that module file and build a suitable decl chain from them
 * when loading any other declaration of an entity, we first load the first
   declaration from the same module file

As before, we complete redecl chains through name lookup where necessary.

To make this work, I also had to change the way that template specializations
are stored -- it no longer suffices to track only canonical specializations; we
now emit all "first local" declarations when emitting a list of specializations
for a template.

On one testcase with several thousand imported module files, this reduces the
total runtime by 72%.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245779 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Serialization/ASTWriter.h
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/ASTWriterDecl.cpp
test/Modules/cxx-templates.cpp