easyaspi314 created this revision.
easyaspi314 added a project: clang.
Herald added a subscriber: cfe-commits.

Replace [-Wreturn-type] messages, "control reaches/may reach end of non-void 
x", to "non-void x does/might not return a value".

F5962917: Screen Shot 2018-04-13 at 6.56.17 PM.png 
<https://reviews.llvm.org/F5962917>

That warning is a very cryptic error copied from GCC, and I had to memorize the 
real meaning of the message in order to make sense of it.

If you were to merge this, 'Clang :: Misc/serialized-diags-stable.c' will fail.

I need some help on this one, as 
clang/test/Misc/Inputs/serialized-diags-stable.dia is a binary which needs to 
be regenerated, and I don't exactly know how to do that.


Repository:
  rC Clang

https://reviews.llvm.org/D45643

Files:
  bindings/python/tests/cindex/test_diagnostics.py
  docs/DiagnosticsReference.rst
  include/clang/Basic/DiagnosticASTKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  test/Analysis/const-method-call.cpp
  test/Analysis/logical-ops.c
  test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
  test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
  test/CodeGenObjCXX/property-dot-reference.mm
  test/Driver/cc-log-diagnostics.c
  test/Frontend/absolute-paths.c
  test/Frontend/ast-main.cpp
  test/Index/warning-flags.c
  test/Misc/serialized-diags-stable.c
  test/Modules/redecl-merge.m
  test/PCH/late-parsed-instantiations.cpp
  test/Sema/block-return-1.c
  test/Sema/block-return-3.c
  test/Sema/freemain.c
  test/Sema/return.c
  test/SemaCXX/attr-noreturn.cpp
  test/SemaCXX/constant-expression-cxx1y.cpp
  test/SemaCXX/coreturn.cpp
  test/SemaCXX/cxx1y-deduced-return-type.cpp
  test/SemaCXX/return-noreturn.cpp
  test/SemaCXX/warn-missing-noreturn.cpp
  test/SemaTemplate/late-parsing-eager-instantiation.cpp

Index: test/SemaTemplate/late-parsing-eager-instantiation.cpp
===================================================================
--- test/SemaTemplate/late-parsing-eager-instantiation.cpp
+++ test/SemaTemplate/late-parsing-eager-instantiation.cpp
@@ -15,8 +15,8 @@
   char data() {
     visit([](auto buffer) -> char { // expected-note {{in instantiation}}
       buffer->data();
-    }); // expected-warning {{control reaches end of non-void lambda}}
-  } // expected-warning {{control reaches end of non-void function}}
+    }); // expected-warning {{non-void lambda does not return a value}}
+  } // expected-warning {{non-void function does not return a value}}
 };
 
 // pr34185
Index: test/SemaCXX/warn-missing-noreturn.cpp
===================================================================
--- test/SemaCXX/warn-missing-noreturn.cpp
+++ test/SemaCXX/warn-missing-noreturn.cpp
@@ -91,7 +91,7 @@
 
 int rdar8875247_test() {
   rdar8875247 f;
-} // expected-warning{{control reaches end of non-void function}}
+} // expected-warning{{non-void function does not return a value}}
 
 struct rdar8875247_B {
   rdar8875247_B();
Index: test/SemaCXX/return-noreturn.cpp
===================================================================
--- test/SemaCXX/return-noreturn.cpp
+++ test/SemaCXX/return-noreturn.cpp
@@ -26,7 +26,7 @@
   }
   int f2_positive(int x) {
     switch (x) { default: ; }
-  } // expected-warning {{control reaches end of non-void function}}
+  } // expected-warning {{non-void function does not return a value}}
   int f3(int x) {
     switch (x) { default: { pr6884_abort_struct(); } }
   }
@@ -46,7 +46,7 @@
       pr6884_abort_struct *p = new pr6884_abort_struct();
       delete p;
     }
-  } // expected-warning {{control reaches end of non-void function}}
+  } // expected-warning {{non-void function does not return a value}}
 
   // Test that these constructs work even when extraneous blocks are created
   // before and after the switch due to implicit destructors.
@@ -61,7 +61,7 @@
   int g2_positive(int x) {
     other o;
     switch (x) { default: ; }
-  } // expected-warning {{control reaches end of non-void function}}
+  } // expected-warning {{non-void function does not return a value}}
   int g3(int x) {
     other o;
     switch (x) { default: { pr6884_abort_struct(); } }
@@ -140,7 +140,7 @@
     default:
         break;
   }
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 void PR9412_f() {
     PR9412_t<PR9412_Exact>(); // expected-note {{in instantiation of function template specialization 'PR9412_t<PR9412_Exact>' requested here}}
@@ -165,7 +165,7 @@
 
 int testTernaryStaticallyConditionalRetrunOnTrue() {
   true ? Return() : NoReturn();
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int testTernaryStaticallyConditionalNoretrunOnFalse() {
   false ? Return() : NoReturn();
@@ -173,23 +173,23 @@
 
 int testTernaryStaticallyConditionalRetrunOnFalse() {
   false ? NoReturn() : Return();
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int testTernaryConditionalNoreturnTrueBranch(bool value) {
   value ? (NoReturn() || NoReturn()) : Return();
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int testTernaryConditionalNoreturnFalseBranch(bool value) {
   value ? Return() : (NoReturn() || NoReturn());
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int testConditionallyExecutedComplexTernaryTrueBranch(bool value) {
   value || (true ? NoReturn() : true);
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int testConditionallyExecutedComplexTernaryFalseBranch(bool value) {
   value || (false ? true : NoReturn());
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int testStaticallyExecutedLogicalOrBranch() {
   false || NoReturn();
@@ -201,19 +201,19 @@
 
 int testStaticallySkippedLogicalOrBranch() {
   true || NoReturn();
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int testStaticallySkppedLogicalAndBranch() {
   false && NoReturn();
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int testConditionallyExecutedComplexLogicalBranch(bool value) {
   value || (true && NoReturn());
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int testConditionallyExecutedComplexLogicalBranch2(bool value) {
   (true && value) || (true && NoReturn());
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int testConditionallyExecutedComplexLogicalBranch3(bool value) {
   (false && (Return() || true)) || (true && NoReturn());
@@ -236,7 +236,7 @@
   int bar() {
     X work([](){ Fatal(); });
     foo();
-  } // expected-warning {{control reaches end of non-void function}}
+  } // expected-warning {{non-void function does not return a value}}
 
   int baz() {
     FatalCopy fc;
@@ -250,12 +250,12 @@
 int functionTryBlock1(int s) try {
   return 0;
 } catch (...) {
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int functionTryBlock2(int s) try {
 } catch (...) {
   return 0;
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int functionTryBlock3(int s) try {
   return 0;
Index: test/SemaCXX/cxx1y-deduced-return-type.cpp
===================================================================
--- test/SemaCXX/cxx1y-deduced-return-type.cpp
+++ test/SemaCXX/cxx1y-deduced-return-type.cpp
@@ -281,7 +281,7 @@
 namespace Constexpr {
   constexpr auto f1(int n) { return n; }
   template<typename T> struct X { constexpr auto f() {} }; // PR18746
-  template<typename T> struct Y { constexpr T f() {} }; // expected-note {{control reached end of constexpr function}}
+  template<typename T> struct Y { constexpr T f() {} }; // expected-note {{constexpr function does not return a value}}
   void f() {
     X<int>().f();
     Y<void>().f();
Index: test/SemaCXX/coreturn.cpp
===================================================================
--- test/SemaCXX/coreturn.cpp
+++ test/SemaCXX/coreturn.cpp
@@ -88,12 +88,12 @@
 
 int test2() {
   co_await a;
-} // expected-warning {{control reaches end of coroutine; which is undefined behavior because the promise type 'std::experimental::coroutine_traits<int>::promise_type' (aka 'promise_int') does not declare 'return_void()'}}
+} // expected-warning {{coroutine does not return a value; which is undefined behavior because the promise type 'std::experimental::coroutine_traits<int>::promise_type' (aka 'promise_int') does not declare 'return_void()'}}
 
 int test2a(bool b) {
   if (b)
     co_return 42;
-} // expected-warning {{control may reach end of coroutine; which is undefined behavior because the promise type 'std::experimental::coroutine_traits<int, bool>::promise_type' (aka 'promise_int') does not declare 'return_void()'}}
+} // expected-warning {{coroutine might not return a value; which is undefined behavior because the promise type 'std::experimental::coroutine_traits<int, bool>::promise_type' (aka 'promise_int') does not declare 'return_void()'}}
 
 int test3() {
   co_await a;
@@ -107,12 +107,12 @@
 
 void test5(int) {
   co_await a;
-} // expected-warning {{control reaches end of coroutine; which is undefined behavior because}}
+} // expected-warning {{coroutine does not return a value; which is undefined behavior because}}
 
 void test6(int x) {
   if (x)
     co_return 42;
-} // expected-warning {{control may reach end of coroutine; which is undefined behavior because}}
+} // expected-warning {{coroutine might not return a value; which is undefined behavior because}}
 
 void test7(int y) {
   if (y)
@@ -132,9 +132,9 @@
 
 VoidTagReturnValue test10() {
   co_await a;
-} // expected-warning {{control reaches end of coroutine}}
+} // expected-warning {{coroutine does not return a value}}
 
 VoidTagReturnValue test11(bool b) {
   if (b)
     co_return 42;
-} // expected-warning {{control may reach end of coroutine}}
+} // expected-warning {{coroutine might not return a value}}
Index: test/SemaCXX/constant-expression-cxx1y.cpp
===================================================================
--- test/SemaCXX/constant-expression-cxx1y.cpp
+++ test/SemaCXX/constant-expression-cxx1y.cpp
@@ -63,7 +63,7 @@
       return 2;
     }
   }
-} // expected-note 2{{control reached end of constexpr function}}
+} // expected-note 2{{constexpr function does not return a value}}
 static_assert(j(0) == -3, "");
 static_assert(j(1) == 5, "");
 static_assert(j(2), ""); // expected-error {{constant expression}} expected-note {{in call to 'j(2)'}}
Index: test/SemaCXX/attr-noreturn.cpp
===================================================================
--- test/SemaCXX/attr-noreturn.cpp
+++ test/SemaCXX/attr-noreturn.cpp
@@ -10,7 +10,7 @@
 
   int &test1() {
     a.nofail();
-  } // expected-warning {{control reaches end of non-void function}}
+  } // expected-warning {{non-void function does not return a value}}
 
   int &test2() {
     a.fail();
Index: test/Sema/return.c
===================================================================
--- test/Sema/return.c
+++ test/Sema/return.c
@@ -17,7 +17,7 @@
 }
 
 int test1() {
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test2() {
   a: goto a;
@@ -26,7 +26,7 @@
 int test3() {
   goto a;
   a: ;
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 
 void halt() {
@@ -54,11 +54,11 @@
 
 int test7() {
   unknown();
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test8() {
   (void)(1 + unknown());
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int halt3() __attribute__((noreturn));
 
@@ -68,11 +68,11 @@
 
 int test10() {
   (void)(unknown() || halt3());
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int test11() {
   (void)(unknown() && halt3());
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int test12() {
   (void)(halt3() || unknown());
@@ -84,27 +84,27 @@
 
 int test14() {
   (void)(1 || unknown());
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test15() {
   (void)(0 || unknown());
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test16() {
   (void)(0 && unknown());
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test17() {
   (void)(1 && unknown());
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test18() {
   (void)(unknown_nohalt() && halt3());
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int test19() {
   (void)(unknown_nohalt() && unknown());
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test20() {
   int i;
@@ -112,7 +112,7 @@
     return 0;
   else if (0)
     return 2;
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int test21() {
   int i;
@@ -125,7 +125,7 @@
 int test22() {
   int i;
   switch (i) default: ;
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int test23() {
   int i;
@@ -135,7 +135,7 @@
   case 2:
     return 2;
   }
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 int test24() {
   int i;
@@ -155,7 +155,7 @@
 
 int test26() {
   0 ? halt3() : unknown();
-} // expected-warning {{control reaches end of non-void function}}
+} // expected-warning {{non-void function does not return a value}}
 
 int j;
 void (*fptr)() __attribute__((noreturn));
@@ -231,19 +231,19 @@
 
 // Test that 'static inline' functions are only analyzed for CFG-based warnings
 // when they are used.
-static inline int si_has_missing_return() {} // expected-warning{{control reaches end of non-void function}}
-static inline int si_has_missing_return_2() {}; // expected-warning{{control reaches end of non-void function}}
+static inline int si_has_missing_return() {} // expected-warning{{non-void function does not return a value}}
+static inline int si_has_missing_return_2() {}; // expected-warning{{non-void function does not return a value}}
 static inline int si_forward();
 static inline int si_has_missing_return_3(int x) {
   if (x)
    return si_has_missing_return_3(x+1);
-} // expected-warning{{control may reach end of non-void function}}
+} // expected-warning{{non-void function might not return a value}}
 
 int test_static_inline(int x) {
   si_forward();
   return x ? si_has_missing_return_2() : si_has_missing_return_3(x);
 }
-static inline int si_forward() {} // expected-warning{{control reaches end of non-void function}}
+static inline int si_forward() {} // expected-warning{{non-void function does not return a value}}
 
 // Test warnings on ignored qualifiers on return types.
 const int ignored_c_quals(); // expected-warning{{'const' type qualifier on return type has no effect}}
@@ -319,7 +319,7 @@
   default:
     break;
   }
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
 
 // sizeof(long) test.
 int sizeof_long() {
Index: test/Sema/freemain.c
===================================================================
--- test/Sema/freemain.c
+++ test/Sema/freemain.c
@@ -6,4 +6,4 @@
 
 void* main(void* context, long size) {
   if (context) return allocate(size);
-} // expected-warning {{control may reach end of non-void function}}
+} // expected-warning {{non-void function might not return a value}}
Index: test/Sema/block-return-3.c
===================================================================
--- test/Sema/block-return-3.c
+++ test/Sema/block-return-3.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
 
 void foo() {
-  ^ int (void) { }(); // expected-error {{control reaches end of non-void block}}
+  ^ int (void) { }(); // expected-error {{non-void block does not return a value}}
 }
Index: test/Sema/block-return-1.c
===================================================================
--- test/Sema/block-return-1.c
+++ test/Sema/block-return-1.c
@@ -2,5 +2,5 @@
 
 int j;
 void foo() {
-  ^ (void) { if (j) return 1; }(); // expected-error {{control may reach end of non-void block}}
+  ^ (void) { if (j) return 1; }(); // expected-error {{non-void block might not return a value}}
 }
Index: test/PCH/late-parsed-instantiations.cpp
===================================================================
--- test/PCH/late-parsed-instantiations.cpp
+++ test/PCH/late-parsed-instantiations.cpp
@@ -20,8 +20,8 @@
   char data() {
     visit([](auto buffer) -> char { // expected-note {{in instantiation}}
       buffer->data();
-    }); // expected-warning {{control reaches end of non-void lambda}}
-  } // expected-warning {{control reaches end of non-void function}}
+    }); // expected-warning {{non-void lambda does not return a value}}
+  } // expected-warning {{non-void function does not return a value}}
 };
 
 #else
Index: test/Modules/redecl-merge.m
===================================================================
--- test/Modules/redecl-merge.m
+++ test/Modules/redecl-merge.m
@@ -12,11 +12,11 @@
 
 int *call_eventually_noreturn(void) {
   eventually_noreturn();
-} // expected-warning{{control reaches end of non-void function}}
+} // expected-warning{{non-void function does not return a value}}
 
 int *call_eventually_noreturn2(void) {
   eventually_noreturn2();
-} // expected-warning{{control reaches end of non-void function}}
+} // expected-warning{{non-void function does not return a value}}
 
 @import redecl_merge_right;
 
Index: test/Misc/serialized-diags-stable.c
===================================================================
--- test/Misc/serialized-diags-stable.c
+++ test/Misc/serialized-diags-stable.c
@@ -5,7 +5,7 @@
 // RUN: c-index-test -read-diagnostics %S/Inputs/serialized-diags-stable.dia 2>&1 | FileCheck %s
 
 int foo() {
-  // CHECK: serialized-diags-stable.c:[[@LINE+2]]:1: warning: control reaches end of non-void function [-Wreturn-type] [Semantic Issue]
+  // CHECK: serialized-diags-stable.c:[[@LINE+2]]:1: warning: non-void function does not return a value [-Wreturn-type] [Semantic Issue]
   // CHECK-NEXT: Number FIXITs = 0
 }
 
Index: test/Index/warning-flags.c
===================================================================
--- test/Index/warning-flags.c
+++ test/Index/warning-flags.c
@@ -9,10 +9,10 @@
 // RUN: c-index-test -test-load-source-reparse 5 all -w %s 2>&1 | FileCheck -check-prefix=NOWARNINGS %s
 // RUN: c-index-test -test-load-source all -w -O4 %s 2>&1 | FileCheck -check-prefix=NOWARNINGS %s
 
-// CHECK-BOTH-WARNINGS: warning: control reaches end of non-void function
+// CHECK-BOTH-WARNINGS: warning: non-void function does not return a value
 // CHECK-BOTH-WARNINGS: warning: incompatible pointer types returning 'float *' from a function with result type 'int *'
 
-// CHECK-SECOND-WARNING-NOT:control reaches end of non-void
+// CHECK-SECOND-WARNING-NOT:non-void function does not return a value
 // CHECK-SECOND-WARNING: warning: incompatible pointer types returning 'float *' from a function with result type 'int *'
 
 // NOWARNINGS-NOT: warning:
Index: test/Frontend/ast-main.cpp
===================================================================
--- test/Frontend/ast-main.cpp
+++ test/Frontend/ast-main.cpp
@@ -10,7 +10,7 @@
 };
 template<typename T>
 T *S<T>::mf() {
-    // warning: control reaches end of non-void function [-Wreturn-type]
+    // warning: non-void function does not return a value [-Wreturn-type]
 }
 
 void f() {
Index: test/Frontend/absolute-paths.c
===================================================================
--- test/Frontend/absolute-paths.c
+++ test/Frontend/absolute-paths.c
@@ -7,11 +7,11 @@
 // directory in the path.
 // NORMAL: SystemHeaderPrefix
 // ABSOLUTE-NOT: SystemHeaderPrefix
-// CHECK: warning: control reaches end of non-void function
+// CHECK: warning: non-void function does not return a value
 
 
 // For files which don't exist, just print the filename.
 #line 123 "non-existant.c"
 int g() {}
-// NORMAL: non-existant.c:123:10: warning: control reaches end of non-void function
-// ABSOLUTE: non-existant.c:123:10: warning: control reaches end of non-void function
+// NORMAL: non-existant.c:123:10: warning: non-void function does not return a value
+// ABSOLUTE: non-existant.c:123:10: warning: non-void function does not return a value
Index: test/Driver/cc-log-diagnostics.c
===================================================================
--- test/Driver/cc-log-diagnostics.c
+++ test/Driver/cc-log-diagnostics.c
@@ -29,7 +29,7 @@
 // CHECK:       <key>column</key>
 // CHECK:       <integer>11</integer>
 // CHECK:       <key>message</key>
-// CHECK:       <string>control reaches end of non-void function</string>
+// CHECK:       <string>non-void function does not return a value</string>
 // CHECK:     </dict>
 // CHECK:   </array>
 // CHECK: </dict>
Index: test/CodeGenObjCXX/property-dot-reference.mm
===================================================================
--- test/CodeGenObjCXX/property-dot-reference.mm
+++ test/CodeGenObjCXX/property-dot-reference.mm
@@ -14,7 +14,7 @@
 // CHECK: call dereferenceable({{[0-9]+}}) %struct.TFENode* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
 // CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(%struct.TFENode* %{{.*}})
 	self.node.GetURL();
-}	// expected-warning {{control reaches end of non-void function}}
+}	// expected-warning {{non-void function does not return a value}}
 @end
 
 // rdar://8437240
Index: test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
===================================================================
--- test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
+++ test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
@@ -2,7 +2,7 @@
 
 // Check that analysis-based warnings work in lambda bodies.
 void analysis_based_warnings() {
-  (void)[]() -> int { }; // expected-warning{{control reaches end of non-void lambda}}
+  (void)[]() -> int { }; // expected-warning{{non-void lambda does not return a value}}
 }
 
 // Check that we get the right types of captured variables (the
Index: test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
===================================================================
--- test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
+++ test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
@@ -3,7 +3,7 @@
 // An attribute-specifier-seq in a lambda-declarator appertains to the
 // type of the corresponding function call operator.
 void test_attributes() {
-  auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-warning{{control may reach end of non-void lambda}}
+  auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-warning{{non-void lambda might not return a value}}
 
   // FIXME: GCC accepts the [[gnu::noreturn]] attribute here.
   auto nrl2 = []() [[gnu::noreturn]] { return; }; // expected-warning{{attribute 'noreturn' ignored}}
Index: test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
===================================================================
--- test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
+++ test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
@@ -80,7 +80,7 @@
   return [obj voidM], 0;
 }
 
-int marker(void) { // control reaches end of non-void function
+int marker(void) { // non-void function does not return a value
 }
 
 // CHECK-darwin8: warning: The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage
Index: test/Analysis/logical-ops.c
===================================================================
--- test/Analysis/logical-ops.c
+++ test/Analysis/logical-ops.c
@@ -33,7 +33,7 @@
   return x >= start && x < end;
 }
 
-int undef(void) {} // expected-warning{{control reaches end of non-void function}}
+int undef(void) {} // expected-warning{{non-void function does not return a value}}
 void useUndef(void) { 0 || undef(); }
 
 void testPointer(void) { (void) (1 && testPointer && 0); }
Index: test/Analysis/const-method-call.cpp
===================================================================
--- test/Analysis/const-method-call.cpp
+++ test/Analysis/const-method-call.cpp
@@ -211,7 +211,7 @@
   void constMemberFunction() const;
 };
 
-HasConstMemberFunction hasNoReturn() { } // expected-warning {{control reaches end of non-void function}}
+HasConstMemberFunction hasNoReturn() { } // expected-warning {{non-void function does not return a value}}
 
 void testUnknownWithConstMemberFunction() {
   hasNoReturn().constMemberFunction();
Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -550,20 +550,20 @@
   "thread-local storage is not supported for the current target">;
 
 def warn_maybe_falloff_nonvoid_function : Warning<
-  "control may reach end of non-void function">,
+  "non-void function might not return a value">,
   InGroup<ReturnType>;
 def warn_falloff_nonvoid_function : Warning<
-  "control reaches end of non-void function">,
+  "non-void function does not return a value">,
   InGroup<ReturnType>;
 def err_maybe_falloff_nonvoid_block : Error<
-  "control may reach end of non-void block">;
+  "non-void block might not return a value">;
 def err_falloff_nonvoid_block : Error<
-  "control reaches end of non-void block">;
+  "non-void block does not return a value">;
 def warn_maybe_falloff_nonvoid_coroutine : Warning<
-  "control may reach end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
+  "coroutine might not return a value; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
   InGroup<ReturnType>;
 def warn_falloff_nonvoid_coroutine : Warning<
-  "control reaches end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
+  "coroutine does not return a value; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
   InGroup<ReturnType>;
 def warn_suggest_noreturn_function : Warning<
   "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
@@ -6582,10 +6582,10 @@
   def err_noreturn_lambda_has_return_expr : Error<
     "lambda declared 'noreturn' should not return">;
   def warn_maybe_falloff_nonvoid_lambda : Warning<
-    "control may reach end of non-void lambda">,
+    "non-void lambda might not return a value">,
     InGroup<ReturnType>;
   def warn_falloff_nonvoid_lambda : Warning<
-    "control reaches end of non-void lambda">,
+    "non-void lambda does not return a value">,
     InGroup<ReturnType>;
   def err_access_lambda_capture : Error<
     // The ERRORs represent other special members that aren't constructors, in
Index: include/clang/Basic/DiagnosticASTKinds.td
===================================================================
--- include/clang/Basic/DiagnosticASTKinds.td
+++ include/clang/Basic/DiagnosticASTKinds.td
@@ -30,7 +30,7 @@
   "constructor inherited from base class %0 cannot be used in a "
   "constant expression; derived class cannot be implicitly initialized">;
 def note_constexpr_no_return : Note<
-  "control reached end of constexpr function">;
+  "constexpr function does not return a value">;
 def note_constexpr_virtual_call : Note<
   "cannot evaluate virtual function call in a constant expression">;
 def note_constexpr_virtual_base : Note<
Index: docs/DiagnosticsReference.rst
===================================================================
--- docs/DiagnosticsReference.rst
+++ docs/DiagnosticsReference.rst
@@ -9097,28 +9097,28 @@
 |                                                   |+--------------------+|                                                                 |
 +---------------------------------------------------+----------------------+-----------------------------------------------------------------+
 
-+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-|:warning:`warning:` |nbsp| :diagtext:`control reaches end of coroutine; which is undefined behavior because the promise type` |nbsp| :placeholder:`A` |nbsp| :diagtext:`does not declare 'return\_void()'`|
-+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|:warning:`warning:` |nbsp| :diagtext:`coroutine does not return a value; which is undefined behavior because the promise type` |nbsp| :placeholder:`A` |nbsp| :diagtext:`does not declare 'return\_void()'`|
++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
-+-------------------------------------------------------------------------------+
-|:warning:`warning:` |nbsp| :diagtext:`control reaches end of non-void function`|
-+-------------------------------------------------------------------------------+
++--------------------------------------------------------------------------------+
+|:warning:`warning:` |nbsp| :diagtext:`non-void function does not return a value`|
++--------------------------------------------------------------------------------+
 
-+-----------------------------------------------------------------------------+
-|:warning:`warning:` |nbsp| :diagtext:`control reaches end of non-void lambda`|
-+-----------------------------------------------------------------------------+
++------------------------------------------------------------------------------+
+|:warning:`warning:` |nbsp| :diagtext:`non-void lambda does not return a value`|
++------------------------------------------------------------------------------+
 
 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-|:warning:`warning:` |nbsp| :diagtext:`control may reach end of coroutine; which is undefined behavior because the promise type` |nbsp| :placeholder:`A` |nbsp| :diagtext:`does not declare 'return\_void()'`|
+|:warning:`warning:` |nbsp| :diagtext:`coroutine might not return a value; which is undefined behavior because the promise type` |nbsp| :placeholder:`A` |nbsp| :diagtext:`does not declare 'return\_void()'`|
 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
 +---------------------------------------------------------------------------------+
-|:warning:`warning:` |nbsp| :diagtext:`control may reach end of non-void function`|
+|:warning:`warning:` |nbsp| :diagtext:`non-void function might not return a value`|
 +---------------------------------------------------------------------------------+
 
 +-------------------------------------------------------------------------------+
-|:warning:`warning:` |nbsp| :diagtext:`control may reach end of non-void lambda`|
+|:warning:`warning:` |nbsp| :diagtext:`non-void lambda might not return a value`|
 +-------------------------------------------------------------------------------+
 
 +---------------------------------------------------+----------------------+-----------------------------------------------------------------+
Index: bindings/python/tests/cindex/test_diagnostics.py
===================================================================
--- bindings/python/tests/cindex/test_diagnostics.py
+++ bindings/python/tests/cindex/test_diagnostics.py
@@ -15,7 +15,7 @@
         self.assertEqual(tu.diagnostics[0].location.line, 1)
         self.assertEqual(tu.diagnostics[0].location.column, 11)
         self.assertEqual(tu.diagnostics[0].spelling,
-                'control reaches end of non-void function')
+                'non-void function does not return a value')
 
     def test_diagnostic_note(self):
         # FIXME: We aren't getting notes here for some reason.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D45643: [... easyaspi314 (Devin) via Phabricator via cfe-commits

Reply via email to