diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-12-01 00:59:17 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-12-01 00:59:17 +0000 |
commit | 75df4eeede7b91c22c1d63fafd4dd4142844e3b9 (patch) | |
tree | d67f45ceff1dbec6edcecd230d0beca55d68c167 /lib/AST/Decl.cpp | |
parent | 901dd668931a70932ad09092959c42693409a3cd (diff) |
Further tweak -Wurneachable-code and templates by allowing the warning to run on
explicit template specializations (which represent actual functions somebody wrote).
Along the way, refactor some other code which similarly cares about whether or
not they are looking at a template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 299ddd4b72..7be4d26f98 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1951,7 +1951,20 @@ bool FunctionDecl::isImplicitlyInstantiable() const { return true; return PatternDecl->isInlined(); -} +} + +bool FunctionDecl::isTemplateInstantiation() const { + switch (getTemplateSpecializationKind()) { + case TSK_Undeclared: + case TSK_ExplicitSpecialization: + return false; + case TSK_ImplicitInstantiation: + case TSK_ExplicitInstantiationDeclaration: + case TSK_ExplicitInstantiationDefinition: + return true; + } + llvm_unreachable("All TSK values handled."); +} FunctionDecl *FunctionDecl::getTemplateInstantiationPattern() const { // Handle class scope explicit specialization special case. |