https://github.com/pav-code created 
https://github.com/llvm/llvm-project/pull/76310

Fixes Issue: https://github.com/llvm/llvm-project/issues/61256

>From 82fe20f1ccc2e9129282c71bf5bdfd6cfd4fadf3 Mon Sep 17 00:00:00 2001
From: Pavel Gueorguiev <pavel.gueorgu...@gmail.com>
Date: Sat, 23 Dec 2023 14:19:50 -0500
Subject: [PATCH] [clang] Reword apologetic Clang diagnostic messages

Fixes Issue: https://github.com/llvm/llvm-project/issues/61256
---
 clang/include/clang/Basic/DiagnosticCommonKinds.td |  4 ++--
 clang/include/clang/Basic/DiagnosticSemaKinds.td   | 10 +++++-----
 clang/test/CXX/drs/dr16xx.cpp                      |  2 +-
 clang/test/CXX/drs/dr18xx.cpp                      |  2 +-
 clang/test/Lexer/SourceLocationsOverflow.c         |  2 +-
 clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp |  4 ++--
 clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp | 12 ++++++------
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td 
b/clang/include/clang/Basic/DiagnosticCommonKinds.td
index 65a33f61a6948a..aceaa518d55ea9 100644
--- a/clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -355,9 +355,9 @@ def err_cannot_open_file : Error<"cannot open file '%0': 
%1">, DefaultFatal;
 def err_file_modified : Error<
   "file '%0' modified since it was first processed">, DefaultFatal;
 def err_file_too_large : Error<
-  "sorry, unsupported: file '%0' is too large for Clang to process">;
+  "file '%0' is too large for Clang to process">;
 def err_sloc_space_too_large : Error<
-  "sorry, the translation unit is too large for Clang to process: ran out of 
source locations">, DefaultFatal;
+  "translation unit is too large for Clang to process: ran out of source 
locations">, DefaultFatal;
 def err_unsupported_bom : Error<"%0 byte order mark detected in '%1', but "
   "encoding is not supported">, DefaultFatal;
 def err_unable_to_rename_temp : Error<
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index aebb7d9b945c33..dbe2b16b5fc39f 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5135,7 +5135,7 @@ def err_non_type_template_arg_subobject : Error<
 def err_non_type_template_arg_addr_label_diff : Error<
   "template argument / label address difference / what did you expect?">;
 def err_non_type_template_arg_unsupported : Error<
-  "sorry, non-type template argument of type %0 is not yet supported">;
+  "non-type template argument of type %0 is not yet supported">;
 def err_template_arg_not_convertible : Error<
   "non-type template argument of type %0 cannot be converted to a value "
   "of type %1">;
@@ -5188,7 +5188,7 @@ def err_template_arg_not_object_or_func : Error<
 def err_template_arg_not_pointer_to_member_form : Error<
   "non-type template argument is not a pointer to member constant">;
 def err_template_arg_member_ptr_base_derived_not_supported : Error<
-  "sorry, non-type template argument of pointer-to-member type %1 that refers "
+  "non-type template argument of a pointer to member type %1, that refers "
   "to member %q0 of a different class is not supported yet">;
 def err_template_arg_invalid : Error<
   "non-type template argument '%0' is invalid">;
@@ -9913,11 +9913,11 @@ def warn_new_dangling_initializer_list : Warning<
   "will be destroyed at the end of the full-expression">,
   InGroup<DanglingInitializerList>;
 def warn_unsupported_lifetime_extension : Warning<
-  "sorry, lifetime extension of "
+  "lifetime extension of "
   "%select{temporary|backing array of initializer list}0 created "
-  "by aggregate initialization using default member initializer "
+  "by aggregate initialization using a default member initializer "
   "is not supported; lifetime of %select{temporary|backing array}0 "
-  "will end at the end of the full-expression">, InGroup<Dangling>;
+  "will terminate at the end of the full-expression">, InGroup<Dangling>;
 
 // For non-floating point, expressions of the form x == x or x != x
 // should result in a warning, since these always evaluate to a constant.
diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp
index 3f074c4d57354a..2ffeb5372ec1d2 100644
--- a/clang/test/CXX/drs/dr16xx.cpp
+++ b/clang/test/CXX/drs/dr16xx.cpp
@@ -472,7 +472,7 @@ namespace dr1696 { // dr1696: 7
     const A &a = A(); // #dr1696-D1-a
   };
   D1 d1 = {}; // #dr1696-d1
-  // since-cxx14-warning@-1 {{sorry, lifetime extension of temporary created 
by aggregate initialization using default member initializer is not supported; 
lifetime of temporary will end at the end of the full-expression}}
+  // since-cxx14-warning@-1 {{lifetime extension of temporary created by 
aggregate initialization using a default member initializer is not supported; 
lifetime of temporary will terminate at the end of the full-expression}}
   //   since-cxx14-note@#dr1696-D1-a {{initializing field 'a' with default 
member initializer}}
 
   struct D2 {
diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp
index fbe67bd0c2f6db..0179d411358902 100644
--- a/clang/test/CXX/drs/dr18xx.cpp
+++ b/clang/test/CXX/drs/dr18xx.cpp
@@ -56,7 +56,7 @@ namespace dr1815 { // dr1815: no
   // FIXME: needs codegen test
   struct A { int &&r = 0; }; // #dr1815-A 
   A a = {};
-  // since-cxx14-warning@-1 {{sorry, lifetime extension of temporary created 
by aggregate initialization using default member initializer is not supported; 
lifetime of temporary will end at the end of the full-expression}} FIXME
+  // since-cxx14-warning@-1 {{lifetime extension of temporary created by 
aggregate initialization using a default member initializer is not supported; 
lifetime of temporary will terminate at the end of the full-expression}} FIXME
   //   since-cxx14-note@#dr1815-A {{initializing field 'r' with default member 
initializer}}
 
   struct B { int &&r = 0; }; // #dr1815-B
diff --git a/clang/test/Lexer/SourceLocationsOverflow.c 
b/clang/test/Lexer/SourceLocationsOverflow.c
index c42f648fedf501..f058c09428e6e7 100644
--- a/clang/test/Lexer/SourceLocationsOverflow.c
+++ b/clang/test/Lexer/SourceLocationsOverflow.c
@@ -1,6 +1,6 @@
 // RUN: not %clang %s -S -o - 2>&1 | FileCheck %s
 // CHECK: In file included from {{.*}}SourceLocationsOverflow.c
-// CHECK-NEXT: inc1.h{{.*}}: fatal error: sorry, the translation unit is too 
large for Clang to process: ran out of source locations
+// CHECK-NEXT: inc1.h{{.*}}: fatal error: translation unit is too large for 
Clang to process: ran out of source locations
 // CHECK-NEXT: #include "inc2.h"
 // CHECK-NEXT:          ^
 // CHECK-NEXT: note: 214{{.......}}B in local locations, 0B in locations 
loaded from AST files, for a total of 214{{.......}}B (99% of available space)
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp 
b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
index 22788e1c1ffb3a..35c342492099a0 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
@@ -205,9 +205,9 @@ namespace Auto {
 
     struct Y : X {};
     void type_affects_identity(B<&X::n>) {}
-    void type_affects_identity(B<(int Y::*)&X::n>) {} // FIXME: expected-error 
{{sorry}}
+    void type_affects_identity(B<(int Y::*)&X::n>) {} // FIXME: expected-error 
{{non-type template argument of a pointer to member type}}
     void type_affects_identity(B<(const int X::*)&X::n>) {}
-    void type_affects_identity(B<(const int Y::*)&X::n>) {} // FIXME: 
expected-error {{sorry}}
+    void type_affects_identity(B<(const int Y::*)&X::n>) {} // FIXME: 
expected-error {{non-type template argument of a pointer to member type}}
 
     // A case where we need to do auto-deduction, and check whether the
     // resulting dependent types match during partial ordering. These
diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp 
b/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
index 792dc78464b2a8..27559f5e3241ca 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
@@ -8,8 +8,8 @@ namespace std {
 
 // floating-point arguments
 template<float> struct Float {};
-using F1 = Float<1.0f>; // FIXME expected-error {{sorry}}
-using F1 = Float<2.0f / 2>; // FIXME expected-error {{sorry}}
+using F1 = Float<1.0f>; // FIXME expected-error {{non-type template argument 
of type}}
+using F1 = Float<2.0f / 2>; // FIXME expected-error {{non-type template 
argument of type}}
 
 struct S { int n[3]; } s; // expected-note 1+{{here}}
 union U { int a, b; } u;
@@ -48,12 +48,12 @@ using U1 = Union<U{.b = 1}>; // expected-error {{different 
types}}
 
 // miscellaneous scalar types
 template<_Complex int> struct ComplexInt {};
-using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{sorry}}
-using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{sorry}}
+using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{non-type template 
argument of type}}
+using CI = ComplexInt<1 + 3i>; // FIXME: expected-error {{non-type template 
argument of type}}
 
 template<_Complex float> struct ComplexFloat {};
-using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{sorry}}
-using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{sorry}}
+using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{non-type 
template argument of type}}
+using CF = ComplexFloat<1.0f + 3.0fi>; // FIXME: expected-error {{non-type 
template argument of type}}
 
 namespace ClassNTTP {
   struct A { // expected-note 2{{candidate}}

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

Reply via email to