From e669b01ab1c03039c6b142813d5b26a0356b0f52 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Mon, 6 Jan 2014 12:54:41 +0000 Subject: [PATCH] Simplify diagnostic tag type using the token kind formatter As far as the parser is concerned the tag type is always a keyword. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198606 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticParseKinds.td | 3 +-- lib/Parse/ParseDeclCXX.cpp | 9 ++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 7e9272945c..4ebc29e002 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -627,8 +627,7 @@ def err_typename_refers_to_non_type_template : Error< def err_expected_type_name_after_typename : Error< "expected an identifier or template-id after '::'">; def err_explicit_spec_non_template : Error< - "explicit %select{specialization|instantiation}0 of non-template " - "%select{class|struct|union|interface}1 %2">; + "explicit %select{specialization|instantiation}0 of non-template %1 %2">; def err_default_template_template_parameter_not_template : Error< "default template argument for a template template parameter must be a class " diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 76973aee4f..85b2aa7cf2 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1237,13 +1237,8 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, } Diag(NameLoc, diag::err_explicit_spec_non_template) - << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) - << (TagType == DeclSpec::TST_class? 0 - : TagType == DeclSpec::TST_struct? 1 - : TagType == DeclSpec::TST_union? 2 - : 3) - << Name - << SourceRange(LAngleLoc, RAngleLoc); + << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) + << TagTokKind << Name << SourceRange(LAngleLoc, RAngleLoc); // Strip off the last template parameter list if it was empty, since // we've removed its template argument list. -- 2.40.0