]> granicus.if.org Git - clang/commit
Re-implement caching for the linkage calculation of declarations.
authorDouglas Gregor <dgregor@apple.com>
Mon, 6 Dec 2010 18:36:25 +0000 (18:36 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 6 Dec 2010 18:36:25 +0000 (18:36 +0000)
commit381d34e0b205ca27bcc7e7c1652561941c437965
treebcc773b9b2992ca9f0cc00534faf29b0e9464a8a
parent40c2913cef2c211f1fe720ffef83fdb3e4d0fabf
Re-implement caching for the linkage calculation of declarations.

My previous attempt at solving the compile-time problem with many
redeclarations of the same entity cached both linkage and visibility,
while this patch only tackles linkage. There are several reasons for
this difference:

  - Linkage is a language concept, and is evaluated many times during
    semantic analysis and codegen, while visibility is only a
    code-generation concept that is evaluated only once per (unique)
    declaration. Hence, we *must* optimize linkage calculations but
    don't need to optimize visibility computation.
  - Once we know the linkage of a declaration, subsequent
    redeclarations can't change that linkage. Hence, cache
    invalidation is far simpler than for visibility, where a later
    redeclaration can completely change the visibility.
  - We have 3 spare bits in Decl to store the linkage cache, so the
    cache doesn't increase the size of declarations. With the
    visibility+linkage cache, NamedDecl got larger.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121023 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Decl.h
include/clang/AST/DeclBase.h
include/clang/AST/Redeclarable.h
lib/AST/Decl.cpp
lib/Serialization/ASTReaderDecl.cpp