[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-13 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8968-8970
 def note_defaulted_comparison_calls_deleted : Note<
   "defaulted %0 is implicitly deleted because it would invoke a deleted "
   "comparison function%select{| for member %2| for base class %2}1">;

mizvekov wrote:
> rsmith wrote:
> > Would it be useful to apply the same diagnostic improvement to this 
> > diagnostic too? (Genuine question: I *think* we'll attach a note pointing 
> > to the deleted function in this case, which would probably make the "for T" 
> > part just be noise, but I've not checked.)
> Yeah I thought about checking other errors for similar improvements. It's on 
> my list to check that.
For this one in particular, we really do attach another note that makes it 
obvious, pointing to the explicitly marked deleted function.
`note_defaulted_comparison_not_constexpr` at first glance looks like might 
suffer from the same problem, but in this case I don't think the error ever 
could apply to the complete object.
And then nothing else that I could find.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97990/new/

https://reviews.llvm.org/D97990

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-12 Thread Matheus Izvekov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc9fd92d57398: [clang] Improve diagnostics on implicitly 
deleted defaulted comparisons (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97990/new/

https://reviews.llvm.org/D97990

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
  clang/test/CXX/class/class.compare/class.eq/p2.cpp
  clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
  clang/test/CXX/class/class.compare/class.spaceship/p2.cpp

Index: clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
===
--- clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
+++ clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
@@ -52,7 +52,7 @@
 bool operator<(const A&) const;
   };
   struct B {
-A a; // expected-note {{no viable comparison function for member 'a'}}
+A a; // expected-note {{no viable three-way comparison function for member 'a'}}
 auto operator<=>(const B&) const = default; // expected-warning {{implicitly deleted}}
   };
 }
@@ -159,16 +159,16 @@
 namespace PR48856 {
   struct A {
 auto operator<=>(const A &) const = default; // expected-warning {{implicitly deleted}}
-void (*x)(); // expected-note {{because there is no viable comparison function for member 'x'}}
+void (*x)(); // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 
   struct B {
 auto operator<=>(const B &) const = default; // expected-warning {{implicitly deleted}}
-void (B::*x)();  // expected-note {{because there is no viable comparison function for member 'x'}}
+void (B::*x)();  // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 
   struct C {
 auto operator<=>(const C &) const = default; // expected-warning {{implicitly deleted}}
-int C::*x;   // expected-note {{because there is no viable comparison function for member 'x'}}
+int C::*x;   // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 }
Index: clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
===
--- clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
+++ clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
@@ -78,9 +78,9 @@
   };
 
   // expected-note@#base {{deleted comparison function for base class 'C'}}
-  // expected-note@#base {{no viable comparison function for base class 'D1'}}
+  // expected-note@#base {{no viable three-way comparison function for base class 'D1'}}
   // expected-note@#base {{three-way comparison cannot be synthesized because there is no viable function for '<' comparison}}
-  // expected-note@#base {{no viable comparison function for base class 'D2'}}
+  // expected-note@#base {{no viable three-way comparison function for base class 'D2'}}
   // expected-note@#base {{three-way comparison cannot be synthesized because there is no viable function for '==' comparison}}
   // expected-note@#base {{deleted comparison function for base class 'E'}}
   // expected-note@#base {{implied comparison for base class 'F' is ambiguous}}
@@ -110,9 +110,9 @@
   }
 
   // expected-note@#arr {{deleted comparison function for member 'arr'}}
-  // expected-note@#arr {{no viable comparison function for member 'arr'}}
+  // expected-note@#arr {{no viable three-way comparison function for member 'arr'}}
   // expected-note@#arr {{three-way comparison cannot be synthesized because there is no viable function for '<' comparison}}
-  // expected-note@#arr {{no viable comparison function for member 'arr'}}
+  // expected-note@#arr {{no viable three-way comparison function for member 'arr'}}
   // expected-note@#arr {{three-way comparison cannot be synthesized because there is no viable function for '==' comparison}}
   // expected-note@#arr {{deleted comparison function for member 'arr'}}
   // expected-note@#arr {{implied comparison for member 'arr' is ambiguous}}
Index: clang/test/CXX/class/class.compare/class.eq/p2.cpp
===
--- clang/test/CXX/class/class.compare/class.eq/p2.cpp
+++ clang/test/CXX/class/class.compare/class.eq/p2.cpp
@@ -18,26 +18,26 @@
 struct H1 {
   bool operator==(const H1 &) const = default;
   bool operator<(const H1 &) const = default; // expected-warning {{implicitly deleted}}
-  // expected-note@-1 

[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-12 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8968-8970
 def note_defaulted_comparison_calls_deleted : Note<
   "defaulted %0 is implicitly deleted because it would invoke a deleted "
   "comparison function%select{| for member %2| for base class %2}1">;

rsmith wrote:
> Would it be useful to apply the same diagnostic improvement to this 
> diagnostic too? (Genuine question: I *think* we'll attach a note pointing to 
> the deleted function in this case, which would probably make the "for T" part 
> just be noise, but I've not checked.)
Yeah I thought about checking other errors for similar improvements. It's on my 
list to check that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97990/new/

https://reviews.llvm.org/D97990

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-12 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8968-8970
 def note_defaulted_comparison_calls_deleted : Note<
   "defaulted %0 is implicitly deleted because it would invoke a deleted "
   "comparison function%select{| for member %2| for base class %2}1">;

Would it be useful to apply the same diagnostic improvement to this diagnostic 
too? (Genuine question: I *think* we'll attach a note pointing to the deleted 
function in this case, which would probably make the "for T" part just be 
noise, but I've not checked.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97990/new/

https://reviews.llvm.org/D97990

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-09 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 329289.
mizvekov added a comment.

Change to simpler way to do it:
For CompleteObject Kind, just fill in the declaration for the complete object.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97990/new/

https://reviews.llvm.org/D97990

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p2.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
  clang/test/CXX/class/class.compare/class.eq/p2.cpp
  clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
  clang/test/CXX/class/class.compare/class.spaceship/p2.cpp

Index: clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
===
--- clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
+++ clang/test/CXX/class/class.compare/class.spaceship/p2.cpp
@@ -52,7 +52,7 @@
 bool operator<(const A&) const;
   };
   struct B {
-A a; // expected-note {{no viable comparison function for member 'a'}}
+A a; // expected-note {{no viable three-way comparison function for member 'a'}}
 auto operator<=>(const B&) const = default; // expected-warning {{implicitly deleted}}
   };
 }
@@ -159,16 +159,16 @@
 namespace PR48856 {
   struct A {
 auto operator<=>(const A &) const = default; // expected-warning {{implicitly deleted}}
-void (*x)(); // expected-note {{because there is no viable comparison function for member 'x'}}
+void (*x)(); // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 
   struct B {
 auto operator<=>(const B &) const = default; // expected-warning {{implicitly deleted}}
-void (B::*x)();  // expected-note {{because there is no viable comparison function for member 'x'}}
+void (B::*x)();  // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 
   struct C {
 auto operator<=>(const C &) const = default; // expected-warning {{implicitly deleted}}
-int C::*x;   // expected-note {{because there is no viable comparison function for member 'x'}}
+int C::*x;   // expected-note {{because there is no viable three-way comparison function for member 'x'}}
   };
 }
Index: clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
===
--- clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
+++ clang/test/CXX/class/class.compare/class.spaceship/p1.cpp
@@ -78,9 +78,9 @@
   };
 
   // expected-note@#base {{deleted comparison function for base class 'C'}}
-  // expected-note@#base {{no viable comparison function for base class 'D1'}}
+  // expected-note@#base {{no viable three-way comparison function for base class 'D1'}}
   // expected-note@#base {{three-way comparison cannot be synthesized because there is no viable function for '<' comparison}}
-  // expected-note@#base {{no viable comparison function for base class 'D2'}}
+  // expected-note@#base {{no viable three-way comparison function for base class 'D2'}}
   // expected-note@#base {{three-way comparison cannot be synthesized because there is no viable function for '==' comparison}}
   // expected-note@#base {{deleted comparison function for base class 'E'}}
   // expected-note@#base {{implied comparison for base class 'F' is ambiguous}}
@@ -110,9 +110,9 @@
   }
 
   // expected-note@#arr {{deleted comparison function for member 'arr'}}
-  // expected-note@#arr {{no viable comparison function for member 'arr'}}
+  // expected-note@#arr {{no viable three-way comparison function for member 'arr'}}
   // expected-note@#arr {{three-way comparison cannot be synthesized because there is no viable function for '<' comparison}}
-  // expected-note@#arr {{no viable comparison function for member 'arr'}}
+  // expected-note@#arr {{no viable three-way comparison function for member 'arr'}}
   // expected-note@#arr {{three-way comparison cannot be synthesized because there is no viable function for '==' comparison}}
   // expected-note@#arr {{deleted comparison function for member 'arr'}}
   // expected-note@#arr {{implied comparison for member 'arr' is ambiguous}}
Index: clang/test/CXX/class/class.compare/class.eq/p2.cpp
===
--- clang/test/CXX/class/class.compare/class.eq/p2.cpp
+++ clang/test/CXX/class/class.compare/class.eq/p2.cpp
@@ -18,26 +18,26 @@
 struct H1 {
   bool operator==(const H1 &) const = default;
   bool operator<(const H1 &) const = default; // expected-warning {{implicitly deleted}}
-  // expected-note@-1 {{because there is no 

[PATCH] D97990: [clang] Improve diagnostics on implicitly deleted defaulted comparisons

2021-03-08 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added a comment.

You are absolutely right, my bad!!

So we stealth fix this revision to improve the message :D


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97990/new/

https://reviews.llvm.org/D97990

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits