r176474 - Add quotation marks to template names in diagnostics.
David Blaikie
dblaikie at gmail.com
Mon Mar 4 22:21:38 PST 2013
Author: dblaikie
Date: Tue Mar 5 00:21:38 2013
New Revision: 176474
URL: http://llvm.org/viewvc/llvm-project?rev=176474&view=rev
Log:
Add quotation marks to template names in diagnostics.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/TemplateName.cpp
cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp
cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
cfe/trunk/test/Parser/cxx-casting.cpp
cfe/trunk/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp
cfe/trunk/test/SemaTemplate/class-template-id.cpp
cfe/trunk/test/SemaTemplate/temp_arg.cpp
cfe/trunk/test/SemaTemplate/temp_arg_type.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Mar 5 00:21:38 2013
@@ -3126,9 +3126,9 @@ def warn_cxx98_compat_template_outside_o
InGroup<CXX98Compat>, DefaultIgnore;
def err_non_type_template_in_nested_name_specifier : Error<
- "qualified name refers into a specialization of function template '%0'">;
+ "qualified name refers into a specialization of function template %0">;
def err_template_id_not_a_type : Error<
- "template name refers to non-type template '%0'">;
+ "template name refers to non-type template %0">;
def note_template_declared_here : Note<
"%select{function template|class template|type alias template|template template parameter}0 "
"%1 declared here">;
Modified: cfe/trunk/lib/AST/TemplateName.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateName.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TemplateName.cpp (original)
+++ cfe/trunk/lib/AST/TemplateName.cpp Tue Mar 5 00:21:38 2013
@@ -163,7 +163,9 @@ const DiagnosticBuilder &clang::operator
LangOptions LO;
LO.CPlusPlus = true;
LO.Bool = true;
+ OS << '\'';
N.print(OS, PrintingPolicy(LO));
+ OS << '\'';
OS.flush();
return DB << NameStr;
}
Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp (original)
+++ cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp Tue Mar 5 00:21:38 2013
@@ -33,5 +33,5 @@ namespace test1 {
// specifiers.
namespace test2 {
template <class T> struct bar {};
- template <class T> struct foo : bar<foo> {}; // expected-error {{use of class template foo requires template arguments}} expected-note {{template is declared here}}
+ template <class T> struct foo : bar<foo> {}; // expected-error {{use of class template 'foo' requires template arguments}} expected-note {{template is declared here}}
}
Modified: cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp Tue Mar 5 00:21:38 2013
@@ -27,3 +27,21 @@ void test_f2(int *ip, float *fp) {
f2(ip, ip); // okay
f2(ip, fp); // expected-error{{no matching function}}
}
+
+namespace test3 {
+ template<typename T>
+ struct bar { };
+
+ template<typename T>
+ struct foo {
+ operator bar<T>();
+ };
+
+ template<typename T>
+ void func(bar<T>) { // expected-note {{candidate template ignored: could not match 'bar' against 'foo'}}
+ }
+
+ void test() {
+ func(foo<int>()); // expected-error {{no matching function}}
+ }
+}
Modified: cfe/trunk/test/Parser/cxx-casting.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-casting.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-casting.cpp (original)
+++ cfe/trunk/test/Parser/cxx-casting.cpp Tue Mar 5 00:21:38 2013
@@ -58,9 +58,9 @@ void test2(char x, struct B * b) {
expected-error {{expected ']'}}
#define LC <:
#define C :
- test1::A LC:B> c; // expected-error {{class template test1::A requires template arguments}} expected-error 2{{}}
+ test1::A LC:B> c; // expected-error {{class template 'test1::A' requires template arguments}} expected-error 2{{}}
(void)static_cast LC:c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
- test1::A<:C B> d; // expected-error {{class template test1::A requires template arguments}} expected-error 2{{}}
+ test1::A<:C B> d; // expected-error {{class template 'test1::A' requires template arguments}} expected-error 2{{}}
(void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
#define LCC <::
@@ -85,7 +85,7 @@ void test3() {
E< ::F>();
// Make sure that parser doesn't expand '[:' to '< ::'
- ::D[:F> A5; // expected-error {{class template ::D requires template arguments}} \
+ ::D[:F> A5; // expected-error {{class template '::D' requires template arguments}} \
// expected-error {{expected expression}} \
// expected-error {{expected unqualified-id}}
}
Modified: cfe/trunk/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp (original)
+++ cfe/trunk/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp Tue Mar 5 00:21:38 2013
@@ -70,7 +70,7 @@ namespace llvm {
struct S {};
void bar() {
GraphWriter<S> x; //expected-error{{no template named 'GraphWriter'; did you mean 'llvm::GraphWriter'?}}
- (void)new llvm::GraphWriter; // expected-error {{use of class template llvm::GraphWriter requires template arguments}}
+ (void)new llvm::GraphWriter; // expected-error {{use of class template 'llvm::GraphWriter' requires template arguments}}
(void)new llvm::Graphwriter<S>; // expected-error {{no template named 'Graphwriter' in namespace 'llvm'; did you mean 'GraphWriter'?}}
}
Modified: cfe/trunk/test/SemaTemplate/class-template-id.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/class-template-id.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/class-template-id.cpp (original)
+++ cfe/trunk/test/SemaTemplate/class-template-id.cpp Tue Mar 5 00:21:38 2013
@@ -40,7 +40,7 @@ typedef N::C<float> c2;
// PR5655
template<typename T> struct Foo { }; // expected-note{{template is declared here}}
-void f(void) { Foo bar; } // expected-error{{use of class template Foo requires template arguments}}
+void f(void) { Foo bar; } // expected-error{{use of class template 'Foo' requires template arguments}}
// rdar://problem/8254267
template <typename T> class Party;
Modified: cfe/trunk/test/SemaTemplate/temp_arg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg.cpp Tue Mar 5 00:21:38 2013
@@ -10,7 +10,7 @@ A<int, 0, X> * a1;
A<float, 1, X, double> *a2; // expected-error{{too many template arguments for class template 'A'}}
A<float, 1> *a3; // expected-error{{too few template arguments for class template 'A'}}
-A a3; // expected-error{{use of class template A requires template arguments}}
+A a3; // expected-error{{use of class template 'A' requires template arguments}}
namespace test0 {
template <class t> class foo {};
Modified: cfe/trunk/test/SemaTemplate/temp_arg_type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg_type.cpp?rev=176474&r1=176473&r2=176474&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg_type.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg_type.cpp Tue Mar 5 00:21:38 2013
@@ -4,7 +4,7 @@ template<typename T> class A; // expecte
// [temp.arg.type]p1
A<0> *a1; // expected-error{{template argument for template type parameter must be a type}}
-A<A> *a2; // expected-error{{use of class template A requires template arguments}}
+A<A> *a2; // expected-error{{use of class template 'A' requires template arguments}}
A<int> *a3;
A<int()> *a4;
@@ -19,7 +19,7 @@ A<function_tpl> a7; // expected-error{{
namespace ns {
template<typename T> class B {}; // expected-note{{template is declared here}}
}
-A<ns::B> a8; // expected-error{{use of class template ns::B requires template arguments}}
+A<ns::B> a8; // expected-error{{use of class template 'ns::B' requires template arguments}}
// [temp.arg.type]p2
void f() {
More information about the cfe-commits
mailing list