Improve & simplify diagnostic for missing 'class' in template template parameter.

Change suggested by Sebastian Redl on review feedback from r153887.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154102 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index b3a0ebd..87de39f 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -479,8 +479,8 @@
   "unknown template name %0">;
 def err_expected_comma_greater : Error<
   "expected ',' or '>' in template-parameter-list">;
-def err_expected_class_before : Error<"expected 'class' before '%0'">;
-def err_expected_class_instead : Error<"expected 'class' instead of '%0'">;
+def err_expected_class_on_template_template_param : Error<
+  "template template parameters require 'class' after the argument list">;
 def err_template_spec_syntax_non_template : Error<
   "identifier followed by '<' indicates a class template specialization but "
   "%0 %select{does not refer to a template|refers to a function "
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index 1727433..91a9d72 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -541,14 +541,12 @@
   // Generate a meaningful error if the user forgot to put class before the
   // identifier, comma, or greater.
   if (Tok.is(tok::kw_typename) || Tok.is(tok::kw_struct)) {
-    Diag(Tok.getLocation(), diag::err_expected_class_instead)
-      << PP.getSpelling(Tok)
+    Diag(Tok.getLocation(), diag::err_expected_class_on_template_template_param)
       << FixItHint::CreateReplacement(Tok.getLocation(), "class");
     ConsumeToken();
   } else if (!Tok.is(tok::kw_class))
-      Diag(Tok.getLocation(), diag::err_expected_class_before)
-        << PP.getSpelling(Tok)
-        << FixItHint::CreateInsertion(Tok.getLocation(), "class ");
+    Diag(Tok.getLocation(), diag::err_expected_class_on_template_template_param)
+      << FixItHint::CreateInsertion(Tok.getLocation(), "class ");
   else 
     ConsumeToken();
 
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index c881c63..c61902d 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -200,7 +200,7 @@
   return Mystery<T>::get();
 }
 
-template<template<typename> Foo, // expected-error {{expected 'class' before 'Foo'}}
-         template<typename> typename Bar, // expected-error {{expected 'class' instead of 'typename'}}
-         template<typename> struct Baz> // expected-error {{expected 'class' instead of 'struct'}}
+template<template<typename> Foo, // expected-error {{template template parameters require 'class' after the argument list}}
+         template<typename> typename Bar, // expected-error {{template template parameters require 'class' after the argument list}}
+         template<typename> struct Baz> // expected-error {{template template parameters require 'class' after the argument list}}
 void func();
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp
index 72f2d7d..af3eb2d 100644
--- a/test/Parser/cxx-template-decl.cpp
+++ b/test/Parser/cxx-template-decl.cpp
@@ -11,8 +11,8 @@
 // expected-warning {{declaration does not declare anything}}
 template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
 // expected-error{{extraneous}}
-template <template <typename> > struct Err2;       // expected-error {{expected 'class' before '>'}}
-template <template <typename> Foo> struct Err3;    // expected-error {{expected 'class' before 'Foo'}}
+template <template <typename> > struct Err2;       // expected-error {{template template parameters require 'class' after the argument list}}
+template <template <typename> Foo> struct Err3;    // expected-error {{template template parameters require 'class' after the argument list}}
 
 // Template function declarations
 template <typename T> void foo();