[cfe-commits] r110441 - in /cfe/trunk: include/clang/Parse/Action.h lib/Parse/ParseExprCXX.cpp lib/Parse/ParseTemplate.cpp lib/Parse/Parser.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaTemplate.cpp
Abramo Bagnara
abramo.bagnara at gmail.com
Fri Aug 6 05:11:12 PDT 2010
Author: abramo
Date: Fri Aug 6 07:11:11 2010
New Revision: 110441
URL: http://llvm.org/viewvc/llvm-project?rev=110441&view=rev
Log:
Template keyword should not be ignored building a QualifiedTemplateName.
Modified:
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=110441&r1=110440&r2=110441&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Fri Aug 6 07:11:11 2010
@@ -281,6 +281,8 @@
/// \param SS the C++ nested-name-specifier that precedes the template name,
/// if any.
///
+ /// \param hasTemplateKeyword true if the template keyword was specified.
+ ///
/// \param Name the name that we are querying to determine whether it is
/// a template.
///
@@ -303,6 +305,7 @@
/// \returns the kind of template that this name refers to.
virtual TemplateNameKind isTemplateName(Scope *S,
CXXScopeSpec &SS,
+ bool hasTemplateKeyword,
UnqualifiedId &Name,
TypeTy *ObjectType,
bool EnteringContext,
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=110441&r1=110440&r2=110441&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Fri Aug 6 07:11:11 2010
@@ -294,6 +294,7 @@
TemplateName.setIdentifier(&II, Tok.getLocation());
bool MemberOfUnknownSpecialization;
if (TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS,
+ /*hasTemplateKeyword=*/false,
TemplateName,
ObjectType,
EnteringContext,
@@ -1023,8 +1024,9 @@
return true;
} else {
bool MemberOfUnknownSpecialization;
- TNK = Actions.isTemplateName(getCurScope(), SS, Id, ObjectType,
- EnteringContext, Template,
+ TNK = Actions.isTemplateName(getCurScope(), SS,
+ TemplateKWLoc.isValid(), Id,
+ ObjectType, EnteringContext, Template,
MemberOfUnknownSpecialization);
if (TNK == TNK_Non_template && MemberOfUnknownSpecialization &&
@@ -1059,7 +1061,8 @@
UnqualifiedId TemplateName;
bool MemberOfUnknownSpecialization;
TemplateName.setIdentifier(Name, NameLoc);
- TNK = Actions.isTemplateName(getCurScope(), SS, TemplateName, ObjectType,
+ TNK = Actions.isTemplateName(getCurScope(), SS, TemplateKWLoc.isValid(),
+ TemplateName, ObjectType,
EnteringContext, Template,
MemberOfUnknownSpecialization);
break;
@@ -1076,7 +1079,8 @@
if (TNK == TNK_Non_template)
return true;
} else {
- TNK = Actions.isTemplateName(getCurScope(), SS, TemplateName, ObjectType,
+ TNK = Actions.isTemplateName(getCurScope(), SS, TemplateKWLoc.isValid(),
+ TemplateName, ObjectType,
EnteringContext, Template,
MemberOfUnknownSpecialization);
Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=110441&r1=110440&r2=110441&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Fri Aug 6 07:11:11 2010
@@ -928,7 +928,9 @@
if (isEndOfTemplateArgument(Tok)) {
bool MemberOfUnknownSpecialization;
- TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS, Name,
+ TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS,
+ /*hasTemplateKeyword=*/false,
+ Name,
/*ObjectType=*/0,
/*EnteringContext=*/false,
Template,
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=110441&r1=110440&r2=110441&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Fri Aug 6 07:11:11 2010
@@ -1007,9 +1007,10 @@
TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
bool MemberOfUnknownSpecialization;
if (TemplateNameKind TNK
- = Actions.isTemplateName(getCurScope(), SS, TemplateName,
- /*ObjectType=*/0, EnteringContext,
- Template, MemberOfUnknownSpecialization)) {
+ = Actions.isTemplateName(getCurScope(), SS,
+ /*hasTemplateKeyword=*/false, TemplateName,
+ /*ObjectType=*/0, EnteringContext,
+ Template, MemberOfUnknownSpecialization)) {
// Consume the identifier.
ConsumeToken();
if (AnnotateTemplateIdToken(Template, TNK, &SS, TemplateName)) {
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=110441&r1=110440&r2=110441&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Fri Aug 6 07:11:11 2010
@@ -2960,6 +2960,7 @@
virtual TemplateNameKind isTemplateName(Scope *S,
CXXScopeSpec &SS,
+ bool hasTemplateKeyword,
UnqualifiedId &Name,
TypeTy *ObjectType,
bool EnteringContext,
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=110441&r1=110440&r2=110441&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Aug 6 07:11:11 2010
@@ -282,7 +282,8 @@
CXXScopeSpec EmptySS;
TemplateTy TemplateResult;
bool MemberOfUnknownSpecialization;
- if (isTemplateName(S, SS ? *SS : EmptySS, Name, 0, true, TemplateResult,
+ if (isTemplateName(S, SS ? *SS : EmptySS, /*hasTemplateKeyword=*/false,
+ Name, 0, true, TemplateResult,
MemberOfUnknownSpecialization) == TNK_Type_template) {
TemplateName TplName = TemplateResult.getAsVal<TemplateName>();
Diag(IILoc, diag::err_template_missing_args) << TplName;
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=110441&r1=110440&r2=110441&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Aug 6 07:11:11 2010
@@ -97,6 +97,7 @@
TemplateNameKind Sema::isTemplateName(Scope *S,
CXXScopeSpec &SS,
+ bool hasTemplateKeyword,
UnqualifiedId &Name,
TypeTy *ObjectTypePtr,
bool EnteringContext,
@@ -150,7 +151,8 @@
if (SS.isSet() && !SS.isInvalid()) {
NestedNameSpecifier *Qualifier
= static_cast<NestedNameSpecifier *>(SS.getScopeRep());
- Template = Context.getQualifiedTemplateName(Qualifier, false, TD);
+ Template = Context.getQualifiedTemplateName(Qualifier,
+ hasTemplateKeyword, TD);
} else {
Template = TemplateName(TD);
}
@@ -1681,8 +1683,8 @@
// "template" keyword is now permitted). We follow the C++0x
// rules, even in C++03 mode with a warning, retroactively applying the DR.
bool MemberOfUnknownSpecialization;
- TemplateNameKind TNK = isTemplateName(0, SS, Name, ObjectType,
- EnteringContext, Result,
+ TemplateNameKind TNK = isTemplateName(0, SS, TemplateKWLoc.isValid(), Name,
+ ObjectType, EnteringContext, Result,
MemberOfUnknownSpecialization);
if (TNK == TNK_Non_template && LookupCtx->isDependentContext() &&
isa<CXXRecordDecl>(LookupCtx) &&
More information about the cfe-commits
mailing list