diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-01 20:22:16 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-04-01 20:22:16 +0000 |
commit | f396ad9b1fa0c74c9db16a8158c3882c9db774e2 (patch) | |
tree | 00203889c9adb8d6c893719c99b8313b3d69732b /lib/AST/ASTContext.cpp | |
parent | efb72adbae0c253fc2fd9127fb3e1c36cb1b8d93 (diff) |
Don't eagerly deserialize every templated function (and every static data
member inside a class template) when loading a PCH file or module.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178496 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 6ac18a8d88..7245c03160 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -7673,7 +7673,15 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { if (const VarDecl *VD = dyn_cast<VarDecl>(D)) { if (!VD->isFileVarDecl()) return false; - } else if (!isa<FunctionDecl>(D)) + } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { + // We never need to emit an uninstantiated function template. + if (FD->getTemplatedKind() == FunctionDecl::TK_FunctionTemplate) + return false; + } else + return false; + + // If this is a member of a class template, we do not need to emit it. + if (D->getDeclContext()->isDependentContext()) return false; // Weak references don't produce any output by themselves. |