diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-03-05 06:21:38 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-03-05 06:21:38 +0000 |
commit | 4b02dff7aebb98d2d60b2ff4d3fc86109213128c (patch) | |
tree | 5aad388be05f04fc93dfe3140478b502013c0b53 | |
parent | e09b8c41d0eeb17f8cbe73affb213cb7ff8d0718 (diff) |
Add quotation marks to template names in diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176474 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 4 | ||||
-rw-r--r-- | lib/AST/TemplateName.cpp | 2 | ||||
-rw-r--r-- | test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp | 2 | ||||
-rw-r--r-- | test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp | 18 | ||||
-rw-r--r-- | test/Parser/cxx-casting.cpp | 6 | ||||
-rw-r--r-- | test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp | 2 | ||||
-rw-r--r-- | test/SemaTemplate/class-template-id.cpp | 2 | ||||
-rw-r--r-- | test/SemaTemplate/temp_arg.cpp | 2 | ||||
-rw-r--r-- | test/SemaTemplate/temp_arg_type.cpp | 4 |
9 files changed, 31 insertions, 11 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index a17719df99..44dec5a2c8 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -3126,9 +3126,9 @@ def warn_cxx98_compat_template_outside_of_template : Warning< 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">; diff --git a/lib/AST/TemplateName.cpp b/lib/AST/TemplateName.cpp index f68dbda7c7..8767c635f6 100644 --- a/lib/AST/TemplateName.cpp +++ b/lib/AST/TemplateName.cpp @@ -163,7 +163,9 @@ const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB, LangOptions LO; LO.CPlusPlus = true; LO.Bool = true; + OS << '\''; N.print(OS, PrintingPolicy(LO)); + OS << '\''; OS.flush(); return DB << NameStr; } diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp index d2afd5d83f..9632fda296 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp @@ -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}} } diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp index 4f6dcc1105..33efac0248 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp @@ -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}} + } +} diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp index 01980d3341..69680e421b 100644 --- a/test/Parser/cxx-casting.cpp +++ b/test/Parser/cxx-casting.cpp @@ -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}} } diff --git a/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp b/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp index 83f8395139..40bcf45bca 100644 --- a/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp +++ b/test/SemaCXX/missing-namespace-qualifier-typo-corrections.cpp @@ -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'?}} } diff --git a/test/SemaTemplate/class-template-id.cpp b/test/SemaTemplate/class-template-id.cpp index b674537ea7..5bbc70c955 100644 --- a/test/SemaTemplate/class-template-id.cpp +++ b/test/SemaTemplate/class-template-id.cpp @@ -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; diff --git a/test/SemaTemplate/temp_arg.cpp b/test/SemaTemplate/temp_arg.cpp index 5a4c8fc16f..052c19ef63 100644 --- a/test/SemaTemplate/temp_arg.cpp +++ b/test/SemaTemplate/temp_arg.cpp @@ -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 {}; diff --git a/test/SemaTemplate/temp_arg_type.cpp b/test/SemaTemplate/temp_arg_type.cpp index 397094218a..637b5637ba 100644 --- a/test/SemaTemplate/temp_arg_type.cpp +++ b/test/SemaTemplate/temp_arg_type.cpp @@ -4,7 +4,7 @@ template<typename T> class A; // expected-note 2 {{template parameter is declare // [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{{template argument for template type para 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() { |