diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-08-29 23:59:27 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-08-29 23:59:27 +0000 |
| commit | 676c404dec0c28651b1c568496f8fc1ed7231fa0 (patch) | |
| tree | 001269a579f2a01ec6ab2f69b9e6416ffd9a6b89 /clang/lib/Serialization | |
| parent | b81766ca232cba89ba2c058affadc2220eb19f19 (diff) | |
| download | bcm5719-llvm-676c404dec0c28651b1c568496f8fc1ed7231fa0.tar.gz bcm5719-llvm-676c404dec0c28651b1c568496f8fc1ed7231fa0.zip | |
Be lazier when loading KeyFunctions from PCH/modules. We don't need to load
these in eagerly if we're not actually processing a translation unit. The added
laziness here also avoids us loading in parts of a CXXRecordDecl earlier than an
upcoming class template specialization merging patch would like.
Ideally, we should mark the vtable as used when we see a definition for the key
function, rather than having a separate pass over dynamic classes at the end of
the TU. The existing approach is pretty bad for PCH/modules, since it forcibly
loads the declarations of all key functions in all imported modules, whether or
not those key functions are defined.
llvm-svn: 189627
Diffstat (limited to 'clang/lib/Serialization')
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 3c93340f5ef..a224aefa8fa 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1276,11 +1276,11 @@ ASTDeclReader::VisitCXXRecordDeclImpl(CXXRecordDecl *D) { } } - // Load the key function to avoid deserializing every method so we can + // Lazily load the key function to avoid deserializing every method so we can // compute it. if (D->IsCompleteDefinition) { - if (CXXMethodDecl *Key = ReadDeclAs<CXXMethodDecl>(Record, Idx)) - C.KeyFunctions[D] = Key; + if (DeclID KeyFn = ReadDeclID(Record, Idx)) + C.KeyFunctions[D] = KeyFn; } return Redecl; |

