[clang] 086e111 - [clang] NFC: include non friendly types and missing sugar in test expectations

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 27 14:03:37 PDT 2021


Author: Matheus Izvekov
Date: 2021-10-27T23:03:29+02:00
New Revision: 086e111216bc4fb8065aa7ef4bc226380d1c237e

URL: https://github.com/llvm/llvm-project/commit/086e111216bc4fb8065aa7ef4bc226380d1c237e
DIFF: https://github.com/llvm/llvm-project/commit/086e111216bc4fb8065aa7ef4bc226380d1c237e.diff

LOG: [clang] NFC: include non friendly types and missing sugar in test expectations

The dump of all diagnostics of all tests under `clang/test/{CXX,SemaCXX,SemaTemplate}` was analyzed , and all the cases where there were obviously bad canonical types being printed, like `type-parameter-*-*` and `<overloaded function type>` were identified. Also a small amount of cases of missing sugar were analyzed.

This patch then spells those explicitly in the test expectations, as preparatory work for future fixes for these problems.

Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D110210

Added: 
    

Modified: 
    clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
    clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
    clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
    clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
    clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
    clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
    clang/test/SemaCXX/conversion-function.cpp
    clang/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp
    clang/test/SemaCXX/cxx1y-generic-lambdas.cpp
    clang/test/SemaCXX/cxx1z-decomposition.cpp
    clang/test/SemaCXX/deduced-return-type-cxx14.cpp
    clang/test/SemaCXX/recovery-expr-type.cpp
    clang/test/SemaCXX/redeclared-alias-template.cpp
    clang/test/SemaTemplate/instantiate-var-template.cpp
    clang/test/SemaTemplate/temp_arg_nontype.cpp
    clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
index f780bf796ee43..2933532627d4c 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
@@ -7,7 +7,7 @@ int &b = [] (int &r) -> decltype(auto) { return r; } (a);
 int &c = [] (int &r) -> decltype(auto) { return (r); } (a);
 int &d = [] (int &r) -> auto & { return r; } (a);
 int &e = [] (int &r) -> auto { return r; } (a); // expected-error {{cannot bind to a temporary}}
-int &f = [] (int r) -> decltype(auto) { return r; } (a); // expected-error {{cannot bind to a temporary}}
+int &f = [] (int r) -> decltype(auto) { return r; } (a); // expected-error {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
 int &g = [] (int r) -> decltype(auto) { return (r); } (a); // expected-warning {{reference to stack}}
 // cxx2b-error at -1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
 

diff  --git a/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp b/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
index cb9541caaddd4..cb9407b1db88b 100644
--- a/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
+++ b/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
@@ -36,7 +36,7 @@ namespace std {
 
 namespace p0702r1 {
   template<typename T> struct X { // expected-note {{candidate}}
-    X(std::initializer_list<T>); // expected-note {{candidate}}
+    X(std::initializer_list<T>); // expected-note {{candidate template ignored: could not match 'initializer_list<type-parameter-0-0>' against 'p0702r1::Z'}}
   };
 
   X xi = {0};
@@ -84,4 +84,4 @@ int main() {
 }
 
 
-}
\ No newline at end of file
+}

diff  --git a/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
index d6d171470c21d..0963dd23724a8 100644
--- a/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
+++ b/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
@@ -336,9 +336,9 @@ namespace p0962r1 {
   void use(NA::A a, NB::B b, NC::C c, ND::D d, NE::E e, NF::F f) {
     for (auto x : a) {}
     for (auto x : b) {}
-    for (auto x : c) {} // expected-error {{no viable 'end' function}}
-    for (auto x : d) {} // expected-error {{no viable 'begin' function}}
-    for (auto x : e) {} // expected-error {{no viable 'begin' function}}
-    for (auto x : f) {} // expected-error {{no viable 'end' function}}
+    for (auto x : c) {} // expected-error {{invalid range expression of type 'p0962r1::NC::C'; no viable 'end' function available}}
+    for (auto x : d) {} // expected-error {{invalid range expression of type 'p0962r1::ND::D'; no viable 'begin' function available}}
+    for (auto x : e) {} // expected-error {{invalid range expression of type 'p0962r1::NE::E'; no viable 'begin' function available}}
+    for (auto x : f) {} // expected-error {{invalid range expression of type 'p0962r1::NF::F'; no viable 'end' function available}}
   }
 }

diff  --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
index d0fc797f50027..38dde7367fea3 100644
--- a/clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
@@ -38,7 +38,7 @@ A<short>::C::B<int*> absip;
 template<typename T, typename U>
 struct Outer {
   template<typename X, typename Y> struct Inner;
-  template<typename Y> struct Inner<T, Y> {}; // expected-note{{previous}}
+  template<typename Y> struct Inner<T, Y> {}; // expected-note{{previous declaration of class template partial specialization 'Inner<int, type-parameter-0-0>' is here}}
   template<typename Y> struct Inner<U, Y> {}; // expected-error{{cannot be redeclared}}
 };
 

diff  --git a/clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp b/clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
index 24a70a85166b3..f5cadc75e6d3d 100644
--- a/clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
@@ -76,7 +76,7 @@ struct X0 {
 
 template X0::operator const char*() const; // expected-note{{'X0::operator const char *<char>' requested here}}
 template X0::operator const int*(); // expected-note{{'X0::operator const int *<const int>' requested here}}
-template X0::operator float*() const; // expected-error{{explicit instantiation of undefined function template}}
+template X0::operator float*() const; // expected-error{{explicit instantiation of undefined function template 'operator type-parameter-0-0 *'}}
 
 void test_X0(X0 x0, const X0 &x0c) {
   x0.operator const int*(); // expected-note{{in instantiation of function template specialization}}

diff  --git a/clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
index 82114cfa9deaf..46fc91325880c 100644
--- a/clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
@@ -283,7 +283,9 @@ namespace PR13386 {
     template<typename...U>
     void g(U &&...u, T &&...t) {} // expected-note {{candidate}}
     template<typename...U>
-    void h(tuple<T, U> &&...) {} // expected-note 2{{candidate}}
+    void h(tuple<T, U> &&...) {}
+    // expected-note at -1 {{candidate template ignored: could not match 'tuple<type-parameter-0-0, type-parameter-0-0>' against 'int'}}
+    // expected-note at -2 {{candidate template ignored: substitution failure: deduced incomplete pack <(no value)> for template parameter 'U'}}
 
     template<typename...U>
     struct X {

diff  --git a/clang/test/SemaCXX/conversion-function.cpp b/clang/test/SemaCXX/conversion-function.cpp
index 98ee2aba4bc4c..4d89400813c32 100644
--- a/clang/test/SemaCXX/conversion-function.cpp
+++ b/clang/test/SemaCXX/conversion-function.cpp
@@ -189,7 +189,7 @@ namespace source_locations {
   template<typename T>
   struct E2 {
     operator T
-    * // expected-error{{pointer to a reference}}
+    * // expected-error{{'operator type-parameter-0-0 *' declared as a pointer to a reference of type 'int &'}}
     () const;
   };
 

diff  --git a/clang/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp b/clang/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp
index 868a05357d275..f38fb2c6d71e7 100644
--- a/clang/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp
+++ b/clang/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp
@@ -104,7 +104,9 @@ namespace variadic_expansion {
 
 namespace PR33082 {
   template<int ...I> void a() {
-    int arr[] = { [](auto ...K) { (void)I; } ... }; // expected-error {{no viable conversion}} expected-note {{candidate}}
+    int arr[] = { [](auto ...K) { (void)I; } ... };
+    // expected-error at -1   {{no viable conversion}}
+    // expected-note-re at -2 {{candidate template ignored: could not match 'auto (*)(type-parameter-0-0...){{.*}}' against 'int'}}
   }
 
   template<typename ...T> struct Pack {};

diff  --git a/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp b/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp
index 4b6cbf9584f2c..463e077ce934c 100644
--- a/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp
+++ b/clang/test/SemaCXX/cxx1y-generic-lambdas.cpp
@@ -215,8 +215,9 @@ namespace conversion_operator {
     auto L = [](auto a) -> int { return a; }; // expected-error {{cannot initialize}}
     int (*fp)(int) = L; 
     int (&fp2)(int) = [](auto a) { return a; };  // expected-error{{non-const lvalue}}
-    int (&&fp3)(int) = [](auto a) { return a; };  // expected-error{{no viable conversion}}\
-                                                  //expected-note{{candidate}}
+    int (&&fp3)(int) = [](auto a) { return a; };
+    // expected-error at -1   {{no viable conversion}}
+    // expected-note-re at -2 {{candidate template ignored: could not match 'auto (*)(type-parameter-0-0){{.*}}' against 'int (int)'}}
 
     using F = int(int);
     using G = int(void*);
@@ -290,8 +291,9 @@ int test() {
 {
   auto L = [](auto a) ->decltype(a) {
     print("a = ", a, "\n");
-    return [](auto b) ->decltype(a) { //expected-error{{no viable conversion}}\
-                                      //expected-note{{candidate template ignored}}
+    return [](auto b) ->decltype(a) {
+      // expected-error at -1   {{no viable conversion}}
+      // expected-note-re at -2 {{candidate template ignored: could not match 'int (*)(type-parameter-0-0){{.*}}' against 'int'}}
       print("b = ", b, "\n");
       return b;
     };

diff  --git a/clang/test/SemaCXX/cxx1z-decomposition.cpp b/clang/test/SemaCXX/cxx1z-decomposition.cpp
index 26fbbadafdcbf..f97c5b033e9c7 100644
--- a/clang/test/SemaCXX/cxx1z-decomposition.cpp
+++ b/clang/test/SemaCXX/cxx1z-decomposition.cpp
@@ -70,7 +70,7 @@ void enclosing() {
 void bitfield() {
   struct { int a : 3, : 4, b : 5; } a;
   auto &[x, y] = a;
-  auto &[p, q, r] = a; // expected-error {{decomposes into 2 elements, but 3 names were provided}}
+  auto &[p, q, r] = a; // expected-error-re {{type '(unnamed struct at {{.*}})' decomposes into 2 elements, but 3 names were provided}}
 }
 
 void for_range() {

diff  --git a/clang/test/SemaCXX/deduced-return-type-cxx14.cpp b/clang/test/SemaCXX/deduced-return-type-cxx14.cpp
index 71439c60ad3b8..030a329697efc 100644
--- a/clang/test/SemaCXX/deduced-return-type-cxx14.cpp
+++ b/clang/test/SemaCXX/deduced-return-type-cxx14.cpp
@@ -146,7 +146,7 @@ namespace Templates {
   auto fwd_decl(); // expected-note {{candidate template ignored: could not match 'auto ()' against 'int ()'}}
   int g = fwd_decl<char>();
 
-  auto (*p)() = f1; // expected-error {{incompatible initializer}}
+  auto (*p)() = f1; // expected-error {{variable 'p' with type 'auto (*)()' has incompatible initializer of type '<overloaded function type>'}}
   auto (*q)() = f1<int>; // ok
 
   typedef decltype(f2(1.2)) dbl; // cxx14_20-note {{previous}}

diff  --git a/clang/test/SemaCXX/recovery-expr-type.cpp b/clang/test/SemaCXX/recovery-expr-type.cpp
index 509cd17459762..15b83e50387f7 100644
--- a/clang/test/SemaCXX/recovery-expr-type.cpp
+++ b/clang/test/SemaCXX/recovery-expr-type.cpp
@@ -133,7 +133,7 @@ struct S { // expected-note {{candidate}}
 template <typename T> S(T t) -> S<void *>;
 
 void baz() {
-  bar(S(123)); // expected-error {{no matching conversion}}
+  bar(S(123)); // expected-error {{no matching conversion for functional-style cast from 'int' to 'test11::S<>'}}
 }
 } // namespace test11
 

diff  --git a/clang/test/SemaCXX/redeclared-alias-template.cpp b/clang/test/SemaCXX/redeclared-alias-template.cpp
index 09e9d0d83bf57..4828986f96a61 100644
--- a/clang/test/SemaCXX/redeclared-alias-template.cpp
+++ b/clang/test/SemaCXX/redeclared-alias-template.cpp
@@ -5,7 +5,7 @@ template<typename T> using A = char; // expected-error {{type alias template red
 template<typename T1, typename T2> using A = T1; // expected-error {{too many template parameters in template redeclaration}}
 
 template<typename T1, typename T2> using B = T1; // expected-note {{previous}}
-template<typename T2, typename T1> using B = T1; // expected-error {{type alias template redefinition with 
diff erent types}}
+template<typename T2, typename T1> using B = T1; // expected-error {{type alias template redefinition with 
diff erent types ('T1' (aka 'type-parameter-0-1') vs 'T1' (aka 'type-parameter-0-0'))}}
 
 
 template<typename> struct S;

diff  --git a/clang/test/SemaTemplate/instantiate-var-template.cpp b/clang/test/SemaTemplate/instantiate-var-template.cpp
index a24b205da596f..8037a4865a8bf 100644
--- a/clang/test/SemaTemplate/instantiate-var-template.cpp
+++ b/clang/test/SemaTemplate/instantiate-var-template.cpp
@@ -31,7 +31,7 @@ namespace InstantiationDependent {
   static_assert(b<char> == 1, ""); // expected-note {{in instantiation of}} expected-error {{not an integral constant}}
 
   template<typename T> void f() {
-    static_assert(a<sizeof(sizeof(f(T())))> == 0, ""); // expected-error {{static_assert failed}}
+    static_assert(a<sizeof(sizeof(f(T())))> == 0, ""); // expected-error {{static_assert failed due to requirement 'a<sizeof (sizeof (f(type-parameter-0-0())))> == 0'}}
   }
 }
 

diff  --git a/clang/test/SemaTemplate/temp_arg_nontype.cpp b/clang/test/SemaTemplate/temp_arg_nontype.cpp
index 4ad15ae20d850..8e93c7a9e4410 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype.cpp
@@ -437,7 +437,7 @@ namespace dependent_nested_partial_specialization {
 
   template<template<typename> class X> struct A {
     template<typename T, X<T> N> struct B; // expected-note 2{{here}}
-    template<typename T> struct B<T, 0> {}; // expected-error {{specializes a template parameter with dependent type 'Y<T>'}}
+    template<typename T> struct B<T, 0> {}; // expected-error {{non-type template argument specializes a template parameter with dependent type 'Y<T>' (aka 'type-parameter-0-0 *')}}
   };
   A<X>::B<int, 0> ax;
   A<Y>::B<int, &n> ay; // expected-error {{undefined}} expected-note {{instantiation of}}

diff  --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
index cfb5bba7a67bc..1fb04f5df3105 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
@@ -43,7 +43,7 @@ namespace Function {
   typedef A<void (*)(), i> d;
   typedef A<void (*)(), &i> d;
   typedef A<void (*)(), i<>> d;
-  typedef A<void (*)(), i<int>> e; // expected-error {{is not implicitly convertible}}
+  typedef A<void (*)(), i<int>> e; // expected-error {{value of type '<overloaded function type>' is not implicitly convertible to 'void (*)()'}}
 
   typedef A<void (*)(), 0> x; // expected-error {{not allowed in a converted constant}}
   typedef A<void (*)(), nullptr> y;


        


More information about the cfe-commits mailing list