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 | 5205a8cfd815e4e71ccd3f067080c11c8980c399 (patch) | |
| tree | 0e5d7953b2d9fb8911a68ee7f175e625a6819dc7 /clang/lib/AST/ASTContext.cpp | |
| parent | 34353270a0231661cfb284159dbe6558c760a5ef (diff) | |
| download | bcm5719-llvm-5205a8cfd815e4e71ccd3f067080c11c8980c399.tar.gz bcm5719-llvm-5205a8cfd815e4e71ccd3f067080c11c8980c399.zip | |
Don't eagerly deserialize every templated function (and every static data
member inside a class template) when loading a PCH file or module.
llvm-svn: 178496
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 6ac18a8d88e..7245c031608 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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. |

