aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-08 18:40:42 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-08 18:40:42 +0000
commitf57172b24f08a68d179675989813d5479dc87829 (patch)
tree47d214eda99288951195881d3e20e38dbfed2208 /lib/Sema/SemaTemplate.cpp
parent4ebd716f260584663297bdb820714788f2a1e4cb (diff)
Move Sema::isTemplateParameterDecl to Decl::isTemplateParameter, where it belongs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 092c9d2236..2dcb9fe336 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -18,18 +18,12 @@
using namespace clang;
-/// isTemplateParameterDecl - Determines whether the given declaration
-/// 'D' names a template parameter.
-bool Sema::isTemplateParameterDecl(Decl *D) {
- return isa<TemplateTypeParmDecl>(D) || isa<NonTypeTemplateParmDecl>(D);
-}
-
/// DiagnoseTemplateParameterShadow - Produce a diagnostic complaining
/// that the template parameter 'PrevDecl' is being shadowed by a new
/// declaration at location Loc. Returns true to indicate that this is
/// an error, and false otherwise.
bool Sema::DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl) {
- assert(isTemplateParameterDecl(PrevDecl) && "Not a template parameter");
+ assert(PrevDecl->isTemplateParameter() && "Not a template parameter");
// Microsoft Visual C++ permits template parameters to be shadowed.
if (getLangOptions().Microsoft)
@@ -63,7 +57,7 @@ Sema::DeclTy *Sema::ActOnTypeParameter(Scope *S, bool Typename,
if (ParamName) {
Decl *PrevDecl = LookupDecl(ParamName, Decl::IDNS_Tag, S);
- if (PrevDecl && isTemplateParameterDecl(PrevDecl))
+ if (PrevDecl && PrevDecl->isTemplateParameter())
Invalid = Invalid || DiagnoseTemplateParameterShadow(ParamNameLoc,
PrevDecl);
}
@@ -97,7 +91,7 @@ Sema::DeclTy *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D) {
IdentifierInfo *ParamName = D.getIdentifier();
if (ParamName) {
Decl *PrevDecl = LookupDecl(ParamName, Decl::IDNS_Tag, S);
- if (PrevDecl && isTemplateParameterDecl(PrevDecl))
+ if (PrevDecl && PrevDecl->isTemplateParameter())
Invalid = Invalid || DiagnoseTemplateParameterShadow(D.getIdentifierLoc(),
PrevDecl);
}