[clang] [Clang] Make `-Wreturn-type` default to an error. (PR #123464)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 18 07:34:13 PST 2025
https://github.com/Sirraide created https://github.com/llvm/llvm-project/pull/123464
This makes `-Wreturn-type` default to an error as there is virtually no situation where you’d *want* to fall off the end of a function that is supposed to return a value. The actual change is just adding `DefaultError` to 6 diagnostics, the rest is fixing tests that have relied on this being a warning, of which there seem to be 3 kinds:
1. Tests which for no apparent reason have a function that triggers the warning.
I suspect that a lot of these were on accident (or from before the warning was introduced), since a lot of people will open issues w/ their problematic code in the `main` function (which is the one case where you don’t need to return from a non-void function, after all...), which someone will then copy, possibly into a namespace, possibly renaming it, the end result of that being that you end up w/ something that definitely is not `main` anymore, but which still is declared as returning `int`, and which still has no return statement (another reason why I think this might apply to a lot of these is because usually the actual return type of such problematic functions is quite literally `int`).
A lot of these are really old tests that don’t use `-verify`, which is why no-one noticed or had to care about the extra warning that was already being emitted by them until now.
4. Tests which test either `-Wreturn-type`, `[[noreturn]]`, or what codegen and sanitisers do whenever you do fall off the end of a function.
5. Tests where I struggle to figure out what is even being tested (usually because they’re Objective-C tests, and I don’t know Objective-C), whether falling off the end of a function matters in the first place, and tests where actually spelling out an expression to return would be rather cumbersome (e.g. matrix types currently don’t support list initialisation, so I can’t write e.g. `return {}`).
For tests that fall into categories 2 and 3, I just added `-Wno-error=return-type` to the `RUN` lines and called it a day. This was especially necessary for the former since `-Wreturn-type` is an analysis-based warning, meaning that it is currently impossible to test for more than one occurrence of it in the same compilation if it defaults to an error since the analysis pass is skipped for subsequent functions as soon as an error is emitted.
>From 56cc7d7014d3f99a77c4c5e93c0c4c263889e2df Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Thu, 16 Jan 2025 02:16:13 +0100
Subject: [PATCH 1/4] [Clang] Make '-Wreturn-type' default to an error
---
clang/docs/ReleaseNotes.rst | 9 ++++++---
clang/include/clang/Basic/DiagnosticSemaKinds.td | 8 ++++----
.../AST/ast-dump-special-member-functions.cpp | 16 ++++++++--------
clang/test/Analysis/malloc.c | 4 ++--
clang/test/Analysis/novoidtypecrash.c | 1 +
clang/test/Analysis/plist-stats-output.c | 2 +-
clang/test/CXX/drs/cwg605.cpp | 2 +-
clang/test/CodeGen/2003-06-26-CFECrash.c | 2 +-
clang/test/CodeGen/2003-08-18-SigSetJmp.c | 2 +-
clang/test/CodeGen/2003-08-23-LocalUnionTest.c | 2 +-
clang/test/CodeGen/2003-10-29-AsmRename.c | 2 +-
clang/test/CodeGen/2003-11-20-ComplexDivision.c | 2 +-
.../2004-06-18-VariableLengthArrayOfStructures.c | 2 +-
.../CodeGen/2004-11-27-StaticFunctionRedeclare.c | 2 +-
clang/test/CodeGen/2005-01-02-VAArgError-ICE.c | 2 +-
clang/test/CodeGen/2007-01-06-KNR-Proto.c | 1 +
.../CodeGen/2008-07-30-redef-of-bitcasted-decl.c | 2 +-
clang/test/CodeGen/2009-01-21-InvalidIterator.c | 1 +
.../test/CodeGen/2009-07-15-pad-wchar_t-array.c | 1 +
clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c | 2 +-
clang/test/CodeGen/X86/avx512fp16-abi.c | 8 ++++++++
clang/test/CodeGen/X86/x86_64-atomic-128.c | 1 +
clang/test/CodeGen/align-local.c | 2 +-
clang/test/CodeGen/arm-cmse-nonsecure.c | 4 ++--
clang/test/CodeGen/attr-noinline.cpp | 2 +-
clang/test/CodeGen/block-copy.c | 2 +-
clang/test/CodeGen/const-label-addr.c | 2 +-
clang/test/CodeGen/empty-union-init.c | 1 +
clang/test/CodeGen/exceptions-seh.c | 1 +
clang/test/CodeGen/exprs.c | 12 ++++++------
clang/test/CodeGen/ext-int-cc.c | 2 +-
clang/test/CodeGen/object-size.c | 2 +-
clang/test/CodeGen/sret.c | 2 +-
clang/test/CodeGen/static-order.c | 1 +
clang/test/CodeGen/staticinit.c | 4 ++--
clang/test/CodeGen/union.c | 14 +++++++-------
.../test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp | 5 +++++
.../test/CodeGenCXX/2007-10-01-StructResize.cpp | 2 +-
clang/test/CodeGenCXX/catch-undef-behavior.cpp | 10 +++++-----
clang/test/CodeGenCXX/debug-info-cxx0x.cpp | 2 +-
clang/test/CodeGenCXX/debug-lambda-this.cpp | 4 ++--
clang/test/CodeGenCXX/expr.cpp | 2 +-
.../CodeGenCXX/mangle-variadic-templates.cpp | 4 ++--
clang/test/CodeGenCXX/mangle.cpp | 2 +-
clang/test/CodeGenCXX/nrvo.cpp | 2 ++
clang/test/CodeGenCXX/reference-field.cpp | 4 ++--
clang/test/CodeGenCXX/return.cpp | 8 ++++----
clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp | 2 +-
.../test/CodeGenObjC/2007-10-18-ProDescriptor.m | 1 +
clang/test/CodeGenObjC/debug-info-crash.m | 11 ++++++-----
clang/test/CodeGenObjC/message-arrays.m | 2 +-
clang/test/CodeGenObjC/objc2-write-barrier-2.m | 11 ++++++-----
clang/test/CodeGenObjC/protocols-lazy.m | 2 +-
clang/test/CodeGenObjCXX/instantiate-return.mm | 1 +
clang/test/Driver/cc-log-diagnostics.c | 6 +++---
clang/test/Index/warning-flags.c | 2 +-
clang/test/Misc/serialized-diags-stable.c | 2 +-
clang/test/Modules/pr61067.cppm | 1 +
clang/test/PCH/late-parsed-instantiations.cpp | 5 +++--
clang/test/Parser/promote_types_in_proto.c | 2 +-
clang/test/Rewriter/rewrite-extern-c.mm | 2 +-
clang/test/Sema/freemain.c | 1 +
clang/test/SemaCXX/constant-expression-cxx14.cpp | 2 +-
clang/test/SemaCXX/err-missing-noreturn-1.cpp | 9 +++++++++
clang/test/SemaCXX/err-missing-noreturn-2.cpp | 14 ++++++++++++++
clang/test/SemaCXX/warn-missing-noreturn.cpp | 15 +--------------
.../ASTMatchers/ASTMatchersNarrowingTest.cpp | 2 +-
clang/unittests/Tooling/ASTSelectionTest.cpp | 2 +-
.../LexicallyOrderedRecursiveASTVisitorTest.cpp | 2 +-
clang/unittests/Tooling/Syntax/BuildTreeTest.cpp | 6 +++---
70 files changed, 158 insertions(+), 115 deletions(-)
create mode 100644 clang/test/SemaCXX/err-missing-noreturn-1.cpp
create mode 100644 clang/test/SemaCXX/err-missing-noreturn-2.cpp
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9eeb872aa57d79..b017f51658a449 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -81,6 +81,9 @@ code bases.
``-fno-strict-overflow`` to opt-in to a language dialect where signed integer
and pointer overflow are well-defined.
+- The `-Wreturn-type` warning now defaults to an error. This behaviour can currently
+ be turned off by specifying `-Wno-error=return-type`.
+
C/C++ Language Potentially Breaking Changes
-------------------------------------------
@@ -310,7 +313,7 @@ C++23 Feature Support
- Extend lifetime of temporaries in mem-default-init for P2718R0. Clang now fully
supports `P2718R0 Lifetime extension in range-based for loops <https://wg21.link/P2718R0>`_.
-
+
- ``__cpp_explicit_this_parameter`` is now defined. (#GH82780)
C++20 Feature Support
@@ -715,7 +718,7 @@ Improvements to Clang's diagnostics
- Clang now diagnoses dangling references for C++20's parenthesized aggregate initialization (#101957).
-- Fixed a bug where Clang would not emit ``-Wunused-private-field`` warnings when an unrelated class
+- Fixed a bug where Clang would not emit ``-Wunused-private-field`` warnings when an unrelated class
defined a defaulted comparison operator (#GH116270).
.. code-block:: c++
@@ -934,7 +937,7 @@ Bug Fixes to C++ Support
- Fixed an assertion failure caused by invalid default argument substitutions in non-defining
friend declarations. (#GH113324)
- Fix a crash caused by incorrect argument position in merging deduced template arguments. (#GH113659)
-- Fixed a parser crash when using pack indexing as a nested name specifier. (#GH119072)
+- Fixed a parser crash when using pack indexing as a nested name specifier. (#GH119072)
- Fixed a null pointer dereference issue when heuristically computing ``sizeof...(pack)`` expressions. (#GH81436)
- Fixed an assertion failure caused by mangled names with invalid identifiers. (#GH112205)
- Fixed an incorrect lambda scope of generic lambdas that caused Clang to crash when computing potential lambda
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 8be4f946dce1cc..75cc9d1329928b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -707,10 +707,10 @@ def err_thread_unsupported : Error<
// FIXME: Combine fallout warnings to just one warning.
def warn_maybe_falloff_nonvoid_function : Warning<
"non-void function does not return a value in all control paths">,
- InGroup<ReturnType>;
+ InGroup<ReturnType>, DefaultError;
def warn_falloff_nonvoid_function : Warning<
"non-void function does not return a value">,
- InGroup<ReturnType>;
+ InGroup<ReturnType>, DefaultError;
def warn_const_attr_with_pure_attr : Warning<
"'const' attribute imposes more restrictions; 'pure' attribute ignored">,
InGroup<IgnoredAttributes>;
@@ -724,10 +724,10 @@ def err_falloff_nonvoid_block : Error<
"non-void block does not return a value">;
def warn_maybe_falloff_nonvoid_coroutine : Warning<
"non-void coroutine does not return a value in all control paths">,
- InGroup<ReturnType>;
+ InGroup<ReturnType>, DefaultError;
def warn_falloff_nonvoid_coroutine : Warning<
"non-void coroutine does not return a value">,
- InGroup<ReturnType>;
+ InGroup<ReturnType>, DefaultError;
def warn_suggest_noreturn_function : Warning<
"%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
InGroup<MissingNoreturn>, DefaultIgnore;
diff --git a/clang/test/AST/ast-dump-special-member-functions.cpp b/clang/test/AST/ast-dump-special-member-functions.cpp
index b98c90f6760434..0fe2cee615c826 100644
--- a/clang/test/AST/ast-dump-special-member-functions.cpp
+++ b/clang/test/AST/ast-dump-special-member-functions.cpp
@@ -253,25 +253,25 @@ struct TrivialCopyAssignment {
struct NontrivialCopyAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyAssignment definition
// CHECK: CopyAssignment {{.*}}non_trivial{{.*}}
- NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) {}
+ NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) { return *this; }
};
struct CopyAssignmentHasConstParam {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentHasConstParam definition
// CHECK: CopyAssignment {{.*}}has_const_param{{.*}}
- CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) {}
+ CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) { return *this; }
};
struct CopyAssignmentDoesNotHaveConstParam {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotHaveConstParam definition
// CHECK-NOT: CopyAssignment {{.*}} has_const_param{{.*}}
- CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) {}
+ CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) { return *this; }
};
struct UserDeclaredCopyAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyAssignment definition
// CHECK: CopyAssignment {{.*}}user_declared{{.*}}
- UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) {}
+ UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) { return *this; }
};
struct NonUserDeclaredCopyAssignment {
@@ -288,7 +288,7 @@ struct NeedsImplicitCopyAssignment {
struct DoesNotNeedImplicitCopyAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyAssignment definition
// CHECK-NOT: CopyAssignment {{.*}}needs_implicit{{.*}}
- DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) {}
+ DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) { return *this; }
};
struct DeclaresCopyAssignment {
@@ -352,13 +352,13 @@ struct TrivialMoveAssignment {
struct NontrivialMoveAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveAssignment definition
// CHECK: MoveAssignment {{.*}}non_trivial{{.*}}
- NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) {}
+ NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) { return *this; }
};
struct UserDeclaredMoveAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveAssignment definition
// CHECK: MoveAssignment {{.*}}user_declared{{.*}}
- UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) {}
+ UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) { return *this; }
};
struct NonUserDeclaredMoveAssignment {
@@ -375,7 +375,7 @@ struct NeedsImplicitMoveAssignment {
struct DoesNotNeedImplicitMoveAssignment {
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveAssignment definition
// CHECK-NOT: MoveAssignment {{.*}}needs_implicit{{.*}}
- DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) {}
+ DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) { return *this; }
};
struct MoveAssignmentNeedsOverloadResolution : virtual DeletedDestructor {
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c
index f2f8975b5f0e21..0dc667bc1ed505 100644
--- a/clang/test/Analysis/malloc.c
+++ b/clang/test/Analysis/malloc.c
@@ -1914,8 +1914,8 @@ variable 'buf', which is not memory allocated by 'malloc()' [unix.Malloc]}}
(*crash_a)(); // expected-warning{{type specifier missing}}
// A CallEvent without a corresponding FunctionDecl.
-crash_b() { crash_a(); } // no-crash
-// expected-warning at -1{{type specifier missing}} expected-warning at -1{{non-void}}
+crash_b() { crash_a(); return 0; } // no-crash
+// expected-warning at -1{{type specifier missing}}
long *global_a;
void realloc_crash(void) {
diff --git a/clang/test/Analysis/novoidtypecrash.c b/clang/test/Analysis/novoidtypecrash.c
index 197516a2596187..8d4124005d60bc 100644
--- a/clang/test/Analysis/novoidtypecrash.c
+++ b/clang/test/Analysis/novoidtypecrash.c
@@ -5,6 +5,7 @@ y(void **z) { // no-crash
int *w;
y(&w);
*w;
+ return 0;
}
a;
diff --git a/clang/test/Analysis/plist-stats-output.c b/clang/test/Analysis/plist-stats-output.c
index 4bcae557d9276d..42e0a802d3e377 100644
--- a/clang/test/Analysis/plist-stats-output.c
+++ b/clang/test/Analysis/plist-stats-output.c
@@ -2,7 +2,7 @@
// REQUIRES: asserts
// RUN: FileCheck --input-file=%t.plist %s
-int foo(void) {}
+void foo(void) {}
// CHECK: <key>diagnostics</key>
diff --git a/clang/test/CXX/drs/cwg605.cpp b/clang/test/CXX/drs/cwg605.cpp
index 2fd9e8155bf77b..b98c483f3118eb 100644
--- a/clang/test/CXX/drs/cwg605.cpp
+++ b/clang/test/CXX/drs/cwg605.cpp
@@ -12,7 +12,7 @@ template <class T>
static T f(T t) {}
template <>
-int f(int t) {}
+int f(int t) { return 0; }
void g(int a) {
f(a);
diff --git a/clang/test/CodeGen/2003-06-26-CFECrash.c b/clang/test/CodeGen/2003-06-26-CFECrash.c
index aef3aa02534483..b92d9d8b18bf1b 100644
--- a/clang/test/CodeGen/2003-06-26-CFECrash.c
+++ b/clang/test/CodeGen/2003-06-26-CFECrash.c
@@ -13,7 +13,7 @@ typedef struct Globals {
extern Uz_Globs G;
-int extract_or_test_files(void) {
+void extract_or_test_files(void) {
G.pInfo = G.info;
}
diff --git a/clang/test/CodeGen/2003-08-18-SigSetJmp.c b/clang/test/CodeGen/2003-08-18-SigSetJmp.c
index 986bcb8bd74c38..cf7abaef7eff86 100644
--- a/clang/test/CodeGen/2003-08-18-SigSetJmp.c
+++ b/clang/test/CodeGen/2003-08-18-SigSetJmp.c
@@ -5,7 +5,7 @@ typedef int sigjmp_buf[_JBLEN + 1];
int sigsetjmp(sigjmp_buf env, int savemask);
void bar(void);
sigjmp_buf B;
-int foo(void) {
+void foo(void) {
sigsetjmp(B, 1);
bar();
}
diff --git a/clang/test/CodeGen/2003-08-23-LocalUnionTest.c b/clang/test/CodeGen/2003-08-23-LocalUnionTest.c
index 50b01e42587848..01b830f284f38d 100644
--- a/clang/test/CodeGen/2003-08-23-LocalUnionTest.c
+++ b/clang/test/CodeGen/2003-08-23-LocalUnionTest.c
@@ -4,7 +4,7 @@
union foo { int X; };
-int test(union foo* F) {
+void test(union foo* F) {
{
union foo { float X; } A;
}
diff --git a/clang/test/CodeGen/2003-10-29-AsmRename.c b/clang/test/CodeGen/2003-10-29-AsmRename.c
index 746ff15dd0e319..0db2e862ae00e6 100644
--- a/clang/test/CodeGen/2003-10-29-AsmRename.c
+++ b/clang/test/CodeGen/2003-10-29-AsmRename.c
@@ -16,7 +16,7 @@ int Func64(struct bar* B) {
}
-int test(void) {
+void test(void) {
Func(0); /* should be renamed to call Func64 */
Func64(0);
}
diff --git a/clang/test/CodeGen/2003-11-20-ComplexDivision.c b/clang/test/CodeGen/2003-11-20-ComplexDivision.c
index 51198b81ee2e11..29873f5673dd2a 100644
--- a/clang/test/CodeGen/2003-11-20-ComplexDivision.c
+++ b/clang/test/CodeGen/2003-11-20-ComplexDivision.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
-int test(void) {
+void test(void) {
__complex__ double C;
double D;
C / D;
diff --git a/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c b/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c
index abf78fb0955660..5ad837ab4bcb8c 100644
--- a/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c
+++ b/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c
@@ -3,7 +3,7 @@
struct S { };
-int xxxx(int a) {
+void xxxx(int a) {
struct S comps[a];
comps[0];
}
diff --git a/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c b/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c
index 0650c744e46c4f..b9deeb0e2bf63a 100644
--- a/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c
+++ b/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c
@@ -14,4 +14,4 @@ void bar(void) {
int func(void);
foo(func);
}
-static int func(char** A, char ** B) {}
+static int func(char** A, char ** B) { return 0; }
diff --git a/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c b/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c
index 39439d7c614cdc..4f9a536be52763 100644
--- a/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c
+++ b/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c
@@ -2,7 +2,7 @@
// PR481
// RUN: %clang_cc1 %s -Wno-implicit-function-declaration -emit-llvm -o /dev/null
-int flags(int a, int b, ...) {
+void flags(int a, int b, ...) {
__builtin_va_list args;
__builtin_va_start(args,a); // not the last named arg
foo(args);
diff --git a/clang/test/CodeGen/2007-01-06-KNR-Proto.c b/clang/test/CodeGen/2007-01-06-KNR-Proto.c
index d56a786fce538d..f38979b6700817 100644
--- a/clang/test/CodeGen/2007-01-06-KNR-Proto.c
+++ b/clang/test/CodeGen/2007-01-06-KNR-Proto.c
@@ -6,5 +6,6 @@ int svc_register (void (*dispatch) (int));
int svc_register (dispatch)
void (*dispatch) ();
{
+ return 0;
}
diff --git a/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c b/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
index 70f3aaf6abfc72..910b5fdde7fc61 100644
--- a/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
+++ b/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
@@ -22,6 +22,6 @@ static void bar(void *db) {
char s[5] = "hi";
-int foo(void) {
+void foo(void) {
bar(0);
}
diff --git a/clang/test/CodeGen/2009-01-21-InvalidIterator.c b/clang/test/CodeGen/2009-01-21-InvalidIterator.c
index 83353da68beb1a..b16e6d2d24ac34 100644
--- a/clang/test/CodeGen/2009-01-21-InvalidIterator.c
+++ b/clang/test/CodeGen/2009-01-21-InvalidIterator.c
@@ -63,6 +63,7 @@ frame_hdr_cache[8];
_Unwind_Ptr
base_from_cb_data (struct unw_eh_callback_data *data)
{
+ return 0;
}
void
diff --git a/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c b/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c
index 7be237d11a4dd7..78bc0e8eb6a963 100644
--- a/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c
+++ b/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c
@@ -14,4 +14,5 @@ typedef __WCHAR_TYPE__ wchar_t;
signed short _iodbcdm_sqlerror(void)
{
wchar_t _sqlState[6] = { L"\0" };
+ return 0;
}
diff --git a/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c b/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c
index c19fd17a9684d4..d0cc7615dd6bda 100644
--- a/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c
+++ b/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c
@@ -11,7 +11,7 @@ typedef __attribute__((vector_size(16))) int v4i32;
v4i32 (*bar)(int);
static int foo() {
- (*bar)(0)[0];
+ return (*bar)(0)[0];
}
int fun() { return foo(); }
diff --git a/clang/test/CodeGen/X86/avx512fp16-abi.c b/clang/test/CodeGen/X86/avx512fp16-abi.c
index 3d1b713a610a53..5442c480d67c05 100644
--- a/clang/test/CodeGen/X86/avx512fp16-abi.c
+++ b/clang/test/CodeGen/X86/avx512fp16-abi.c
@@ -206,6 +206,8 @@ struct fsd {
struct fsd pr52011(void) {
// CHECK: define{{.*}} { float, double } @
+ fsd x;
+ return x;
}
struct hsd {
@@ -216,6 +218,8 @@ struct hsd {
struct hsd pr52011_2(void) {
// CHECK: define{{.*}} { half, double } @
+ hsd x;
+ return x;
}
struct hsf {
@@ -226,6 +230,8 @@ struct hsf {
struct hsf pr52011_3(void) {
// CHECK: define{{.*}} <4 x half> @
+ hsf x;
+ return x;
}
struct fds {
@@ -237,4 +243,6 @@ struct fds {
struct fds pr52011_4(void) {
// CHECK-C: define{{.*}} { float, double } @pr52011_4
// CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret
+ fds x;
+ return x;
}
diff --git a/clang/test/CodeGen/X86/x86_64-atomic-128.c b/clang/test/CodeGen/X86/x86_64-atomic-128.c
index f682ffc75f8259..bf050788fa87ac 100644
--- a/clang/test/CodeGen/X86/x86_64-atomic-128.c
+++ b/clang/test/CodeGen/X86/x86_64-atomic-128.c
@@ -26,4 +26,5 @@ __int128 test_expression(_Atomic __int128 *addr) {
// CHECK-LABEL: @test_expression
// CHECK: atomicrmw and ptr {{.*}} seq_cst, align 16
*addr &= 1;
+ return 0;
}
diff --git a/clang/test/CodeGen/align-local.c b/clang/test/CodeGen/align-local.c
index 9e8a56066e1a06..a88dd1637a7422 100644
--- a/clang/test/CodeGen/align-local.c
+++ b/clang/test/CodeGen/align-local.c
@@ -4,7 +4,7 @@ typedef struct __attribute((aligned(16))) {int x[4];} ff;
// CHECK: alloca %struct.ff, align 16
// CHECK: alloca %struct.anon, align 16
-int a(void) {
+void a(void) {
ff a;
struct {int x[4];} b __attribute((aligned(16)));
}
diff --git a/clang/test/CodeGen/arm-cmse-nonsecure.c b/clang/test/CodeGen/arm-cmse-nonsecure.c
index 3310f0cbd0e9b2..42221ac775cd86 100644
--- a/clang/test/CodeGen/arm-cmse-nonsecure.c
+++ b/clang/test/CodeGen/arm-cmse-nonsecure.c
@@ -41,8 +41,8 @@ typedef struct {
int x, y, z;
} Point;
-void *test_pointed_object(void *p) {
-// CHECK: define {{.*}} ptr @test_pointed_object
+void test_pointed_object(void *p) {
+// CHECK: define {{.*}} void @test_pointed_object
Point *pt = (Point *)p;
cmse_check_pointed_object(pt, CMSE_MPU_READ);
// CHECK: call i32 @llvm.arm.cmse.tt
diff --git a/clang/test/CodeGen/attr-noinline.cpp b/clang/test/CodeGen/attr-noinline.cpp
index c1fb9941b5251d..69916be3195358 100644
--- a/clang/test/CodeGen/attr-noinline.cpp
+++ b/clang/test/CodeGen/attr-noinline.cpp
@@ -8,7 +8,7 @@ static int baz(int x) {
return x * 10;
}
-[[clang::noinline]] bool noi() { }
+[[clang::noinline]] bool noi() { return true; }
[[msvc::noinline]] bool ms_noi() { return true; }
void foo(int i) {
diff --git a/clang/test/CodeGen/block-copy.c b/clang/test/CodeGen/block-copy.c
index 4679fe19b78f8b..69881264c932f7 100644
--- a/clang/test/CodeGen/block-copy.c
+++ b/clang/test/CodeGen/block-copy.c
@@ -6,7 +6,7 @@
void foo(float *);
-float bar(void) {
+void bar(void) {
float lookupTable[] = {-1,-1,-1,0, -1,-1,0,-1, -1,-1,0,1, -1,-1,1,0,
-1,0,-1,-1, -1,0,-1,1, -1,0,1,-1, -1,0,1,1,
-1,1,-1,0, -1,1,0,-1, -1,1,0,1, -1,1,1,0,
diff --git a/clang/test/CodeGen/const-label-addr.c b/clang/test/CodeGen/const-label-addr.c
index edfff0f8f63990..8030f96cb8aed7 100644
--- a/clang/test/CodeGen/const-label-addr.c
+++ b/clang/test/CodeGen/const-label-addr.c
@@ -2,7 +2,7 @@
// REQUIRES: asserts
// CHECK: @a.a = internal global ptr blockaddress(@a, %A)
-int a(void) {
+void a(void) {
A:;static void* a = &&A;
}
diff --git a/clang/test/CodeGen/empty-union-init.c b/clang/test/CodeGen/empty-union-init.c
index f1cdfb12f62460..1a05ebea7df5ab 100644
--- a/clang/test/CodeGen/empty-union-init.c
+++ b/clang/test/CodeGen/empty-union-init.c
@@ -8,6 +8,7 @@ struct Mem {
struct Mem *columnMem(void){
static const struct Mem nullMem = { {} };
+ return nullptr;
}
diff --git a/clang/test/CodeGen/exceptions-seh.c b/clang/test/CodeGen/exceptions-seh.c
index a102afb1d271c4..25d622419b09c3 100644
--- a/clang/test/CodeGen/exceptions-seh.c
+++ b/clang/test/CodeGen/exceptions-seh.c
@@ -276,6 +276,7 @@ int exception_code_in_except(void) {
} __except(1) {
return _exception_code();
}
+ return 0;
}
// CHECK-LABEL: define dso_local i32 @exception_code_in_except()
diff --git a/clang/test/CodeGen/exprs.c b/clang/test/CodeGen/exprs.c
index 13a64f02710657..95fed365f539ca 100644
--- a/clang/test/CodeGen/exprs.c
+++ b/clang/test/CodeGen/exprs.c
@@ -7,18 +7,18 @@ int x=sizeof(zxcv);
int y=__alignof__(zxcv);
-void *test(int *i) {
+void test(int *i) {
short a = 1;
i += a;
i + a;
a + i;
}
-_Bool test2b;
+_Bool test2b;
int test2(void) { if (test2b); return 0; }
// PR1921
-int test3(void) {
+void test3(void) {
const unsigned char *bp;
bp -= (short)1;
}
@@ -29,7 +29,7 @@ int t2 = __alignof__(void);
void test4(void) {
t1 = sizeof(void);
t2 = __alignof__(void);
-
+
t1 = sizeof(test4());
t2 = __alignof__(test4());
}
@@ -70,13 +70,13 @@ int bar(void) {
void f2(void);
unsigned f1(void) {
void (*fp)(void) = f2;
-
+
++fp;
fp++;
--fp;
fp--;
return (unsigned) fp;
-}
+}
union f3_x {int x; float y;};
int f3(void) {return ((union f3_x)2).x;}
diff --git a/clang/test/CodeGen/ext-int-cc.c b/clang/test/CodeGen/ext-int-cc.c
index 05b2bf1bec81ee..df1b1ef6246b2a 100644
--- a/clang/test/CodeGen/ext-int-cc.c
+++ b/clang/test/CodeGen/ext-int-cc.c
@@ -162,7 +162,7 @@ void ParamPassing4(_BitInt(129) a) {}
// LA32-NOT: define{{.*}} void @ParamPassing4(ptr %{{.+}})
#endif
-_BitInt(63) ReturnPassing(void){}
+_BitInt(63) ReturnPassing(void) { return 0; }
// LIN64: define{{.*}} i64 @ReturnPassing(
// WIN64: define dso_local i63 @ReturnPassing(
// LIN32: define{{.*}} i63 @ReturnPassing(
diff --git a/clang/test/CodeGen/object-size.c b/clang/test/CodeGen/object-size.c
index 58561a5470f72c..2a3dfc8f4b12b2 100644
--- a/clang/test/CodeGen/object-size.c
+++ b/clang/test/CodeGen/object-size.c
@@ -592,7 +592,7 @@ void PR30346(void) {
extern char incomplete_char_array[];
// CHECK-LABEL: @incomplete_and_function_types
-int incomplete_and_function_types(void) {
+void incomplete_and_function_types(void) {
// CHECK: call i64 @llvm.objectsize.i64.p0
gi = OBJECT_SIZE_BUILTIN(incomplete_char_array, 0);
// CHECK: call i64 @llvm.objectsize.i64.p0
diff --git a/clang/test/CodeGen/sret.c b/clang/test/CodeGen/sret.c
index 6d905e89b2c6fd..dd776334e3969b 100644
--- a/clang/test/CodeGen/sret.c
+++ b/clang/test/CodeGen/sret.c
@@ -12,7 +12,7 @@ struct abc foo1(void);
// CHECK-DAG: declare {{.*}} @foo1(ptr dead_on_unwind writable sret(%struct.abc)
struct abc foo2();
// CHECK-DAG: declare {{.*}} @foo2(ptr dead_on_unwind writable sret(%struct.abc)
-struct abc foo3(void){}
+struct abc foo3(void) { return {}; }
// CHECK-DAG: define {{.*}} @foo3(ptr dead_on_unwind noalias writable sret(%struct.abc)
void bar(void) {
diff --git a/clang/test/CodeGen/static-order.c b/clang/test/CodeGen/static-order.c
index dbd22db96b52c0..e128c2f74245fd 100644
--- a/clang/test/CodeGen/static-order.c
+++ b/clang/test/CodeGen/static-order.c
@@ -19,4 +19,5 @@ void *f(void)
{
if (a.a)
return v;
+ return 0;
}
diff --git a/clang/test/CodeGen/staticinit.c b/clang/test/CodeGen/staticinit.c
index 90b8fa5edb024f..f7b28ff8398e7e 100644
--- a/clang/test/CodeGen/staticinit.c
+++ b/clang/test/CodeGen/staticinit.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
-struct AStruct {
+struct AStruct {
int i;
char *s;
double d;
@@ -27,7 +27,7 @@ void foo(void) {
}
// CHECK: @f1.l0 = internal global i32 ptrtoint (ptr @f1 to i32)
-int f1(void) { static int l0 = (unsigned) f1; }
+void f1(void) { static int l0 = (unsigned) f1; }
// PR7044
char *f2(char key) {
diff --git a/clang/test/CodeGen/union.c b/clang/test/CodeGen/union.c
index 60e9e2d771ff19..26a6fbf8bcd78a 100644
--- a/clang/test/CodeGen/union.c
+++ b/clang/test/CodeGen/union.c
@@ -13,12 +13,12 @@ float get_b(union u_tag *my_u) {
return my_u->b;
}
-int f2( float __x ) {
- union{
- float __f;
- unsigned int __u;
+int f2( float __x ) {
+ union{
+ float __f;
+ unsigned int __u;
}__u;
- return (int)(__u.__u >> 31);
+ return (int)(__u.__u >> 31);
}
typedef union { int i; int *j; } value;
@@ -29,12 +29,12 @@ int f3(value v) {
enum E9 { one, two };
union S65 { enum E9 a; } ; union S65 s65;
-void fS65(void) { enum E9 e = s65.a; }
+void fS65(void) { enum E9 e = s65.a; }
typedef union{
unsigned char x[65536];
} q;
-int qfunc(void) {q buf; unsigned char* x = buf.x;}
+void qfunc(void) {q buf; unsigned char* x = buf.x;}
union RR {_Bool a : 1;} RRU;
int RRF(void) {return RRU.a;}
diff --git a/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp b/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp
index 37005c5e9df77f..465f55f9f8ecfe 100644
--- a/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp
+++ b/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp
@@ -20,6 +20,8 @@ extern "C++"
{
static const nsIID & GetIID ()
{
+ static const nsIID i = {};
+ return i;
}
};
}
@@ -31,6 +33,8 @@ class nsIDOMEventListener:public nsISupports
{
public:static const nsIID & GetIID ()
{
+ static const nsIID i = {};
+ return i;
}
virtual nsresult
__attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) =
@@ -42,6 +46,7 @@ public:static const nsIID & GetIID ()
{
static const nsIID iid = {
};
+ return iid;
}
virtual nsresult
__attribute__ ((regparm (0),
diff --git a/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp b/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp
index 8e5750d3c4ef48..ce1886c2e5032d 100644
--- a/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp
+++ b/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp
@@ -7,7 +7,7 @@ struct Bork {
unsigned int f2 : 30;
};
-int Foo(Bork *hdr) {
+void Foo(Bork *hdr) {
hdr->f1 = 7;
hdr->f2 = 927;
}
diff --git a/clang/test/CodeGenCXX/catch-undef-behavior.cpp b/clang/test/CodeGenCXX/catch-undef-behavior.cpp
index 419d1292551a08..15feebe0c09930 100644
--- a/clang/test/CodeGenCXX/catch-undef-behavior.cpp
+++ b/clang/test/CodeGenCXX/catch-undef-behavior.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN
-// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN
-// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL
-// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN
-// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN
struct S {
double d;
diff --git a/clang/test/CodeGenCXX/debug-info-cxx0x.cpp b/clang/test/CodeGenCXX/debug-info-cxx0x.cpp
index 4c31f60c0d9652..c21a0bb1ad5a1a 100644
--- a/clang/test/CodeGenCXX/debug-info-cxx0x.cpp
+++ b/clang/test/CodeGenCXX/debug-info-cxx0x.cpp
@@ -12,7 +12,7 @@ namespace PR13570 {
template<typename T, typename U> struct P {};
template<typename T> struct A {
template<typename U> static P<T,U> isa(U);
- decltype(isa(int())) f() {}
+ decltype(isa(int())) f() { return {}; }
};
template struct A<int>;
}
diff --git a/clang/test/CodeGenCXX/debug-lambda-this.cpp b/clang/test/CodeGenCXX/debug-lambda-this.cpp
index eecbac6520ac97..019d09c48f858b 100644
--- a/clang/test/CodeGenCXX/debug-lambda-this.cpp
+++ b/clang/test/CodeGenCXX/debug-lambda-this.cpp
@@ -4,9 +4,9 @@ struct D {
D();
D(const D&);
int x;
- int d(int x);
+ void d(int x);
};
-int D::d(int x) {
+void D::d(int x) {
[=] {
return this->x;
}();
diff --git a/clang/test/CodeGenCXX/expr.cpp b/clang/test/CodeGenCXX/expr.cpp
index 33e8e63de2f4a5..d1af538d8c6c80 100644
--- a/clang/test/CodeGenCXX/expr.cpp
+++ b/clang/test/CodeGenCXX/expr.cpp
@@ -24,7 +24,7 @@ int test3g = test3(__PRETTY_FUNCTION__);
struct test4A {
int j : 2;
};
-int test4() {
+void test4() {
test4A a;
(a.j = 2) = 3;
}
diff --git a/clang/test/CodeGenCXX/mangle-variadic-templates.cpp b/clang/test/CodeGenCXX/mangle-variadic-templates.cpp
index d2c1b772659031..4a69c3d331d709 100644
--- a/clang/test/CodeGenCXX/mangle-variadic-templates.cpp
+++ b/clang/test/CodeGenCXX/mangle-variadic-templates.cpp
@@ -47,7 +47,7 @@ template void f3<int>(const int*);
template void f3<int, float>(const int*, const float*);
// Mangling of type pack expansions in a template argument
-template<typename ...Types> tuple<Types...> f4() {}
+template<typename ...Types> tuple<Types...> f4() { return {}; }
// CHECK-LABEL: define weak_odr void @_Z2f4IJifdEE5tupleIJDpT_EEv
template tuple<int, float, double> f4();
@@ -62,7 +62,7 @@ template<int ...Values> int_tuple<Values...> f6() {}
template int_tuple<1, 2, 3> f6();
// Mangling of template template argument expansions
-template<template<typename> class ...Templates>
+template<template<typename> class ...Templates>
template_tuple<Templates...> f7() {}
// CHECK-LABEL: define weak_odr void @_Z2f7IJ8identity13add_referenceEE14template_tupleIJDpT_EEv
template template_tuple<identity, add_reference> f7();
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp
index d0800af55c87e8..0e88c546200f5d 100644
--- a/clang/test/CodeGenCXX/mangle.cpp
+++ b/clang/test/CodeGenCXX/mangle.cpp
@@ -645,7 +645,7 @@ namespace test24 {
foo();
}
- static char bar() {}
+ static char bar() { return 0; }
void test1() {
// CHECK: call noundef signext i8 @_ZN6test24L3barEv()
bar();
diff --git a/clang/test/CodeGenCXX/nrvo.cpp b/clang/test/CodeGenCXX/nrvo.cpp
index d5bb1c0e45a5cf..b4103297b02fea 100644
--- a/clang/test/CodeGenCXX/nrvo.cpp
+++ b/clang/test/CodeGenCXX/nrvo.cpp
@@ -603,6 +603,7 @@ X test4(bool B) {
return x; // NRVO happens
}
exit(1);
+ __builtin_unreachable(); // for -Wreturn-type
}
#ifdef __EXCEPTIONS
@@ -1083,6 +1084,7 @@ X test8(bool b) {
//
Y<int> test9() {
Y<int>::f();
+ __builtin_unreachable(); // for -Wreturn-type
}
// CHECK-LABEL: @_Z6test10b(
diff --git a/clang/test/CodeGenCXX/reference-field.cpp b/clang/test/CodeGenCXX/reference-field.cpp
index 54e914d0f3fce5..abf7ed24b1656a 100644
--- a/clang/test/CodeGenCXX/reference-field.cpp
+++ b/clang/test/CodeGenCXX/reference-field.cpp
@@ -2,7 +2,7 @@
// Make sure the call to b() doesn't get optimized out.
extern struct x {char& x,y;}y;
-int b();
-int a() { if (!&y.x) b(); }
+int b();
+void a() { if (!&y.x) b(); }
// CHECK: @_Z1bv
diff --git a/clang/test/CodeGenCXX/return.cpp b/clang/test/CodeGenCXX/return.cpp
index 584c2921c1e7fb..a281d71a271c67 100644
--- a/clang/test/CodeGenCXX/return.cpp
+++ b/clang/test/CodeGenCXX/return.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - %s | FileCheck --check-prefixes=CHECK,CHECK-COMMON %s
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -O -o - %s | FileCheck %s --check-prefixes=CHECK-OPT,CHECK-COMMON
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -Wno-error=return-type -o - %s | FileCheck --check-prefixes=CHECK,CHECK-COMMON %s
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -Wno-error=return-type -O -o - %s | FileCheck %s --check-prefixes=CHECK-OPT,CHECK-COMMON
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-error=return-type -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-return-type -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON
-// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -O -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT-OPT,CHECK-COMMON
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-error=return-type -O -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT-OPT,CHECK-COMMON
// CHECK-COMMON-LABEL: @_Z9no_return
int no_return() {
diff --git a/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp b/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp
index 96a697aca5eb1b..81db5c4912613d 100644
--- a/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp
+++ b/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp
@@ -8,7 +8,7 @@
// CHECK-SAME: !dbg
struct SourceLocation {
- SourceLocation acquire() {};
+ SourceLocation acquire() { return {}; };
};
extern "C" void __ubsan_handle_type_mismatch_v1(SourceLocation *Loc);
static void handleTypeMismatchImpl(SourceLocation *Loc) { Loc->acquire(); }
diff --git a/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m b/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m
index 35a0df3a1a9f27..b3eda57eec5d27 100644
--- a/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m
+++ b/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m
@@ -14,5 +14,6 @@ @interface AGy:O < AB > {
@end
@implementation AGy
- (unsigned) ver {
+ return 0;
}
@end
diff --git a/clang/test/CodeGenObjC/debug-info-crash.m b/clang/test/CodeGenObjC/debug-info-crash.m
index 85b9b7d334f941..de2bc0048b6a51 100644
--- a/clang/test/CodeGenObjC/debug-info-crash.m
+++ b/clang/test/CodeGenObjC/debug-info-crash.m
@@ -25,16 +25,17 @@ @implementation I1
// PR4541
@class NSString;
- at interface NSAttributedString
+ at interface NSAttributedString
- (NSString *)string;
- at end
- at interface NSMutableAttributedString : NSAttributedString
- at end
+ at end
+ at interface NSMutableAttributedString : NSAttributedString
+ at end
@class NSImage;
- at implementation CYObjectsController
+ at implementation CYObjectsController
+ (void)initialize {
}
+ (NSAttributedString *)attributedStringWithString:(id)string image:(NSImage *)image {
NSMutableAttributedString *attrStr;
+ return nullptr;
}
@end
diff --git a/clang/test/CodeGenObjC/message-arrays.m b/clang/test/CodeGenObjC/message-arrays.m
index 3e8697fc937605..bd5b05fda31dce 100644
--- a/clang/test/CodeGenObjC/message-arrays.m
+++ b/clang/test/CodeGenObjC/message-arrays.m
@@ -9,7 +9,7 @@ @interface A
-(void) m: (int) arg0, ...;
@end
-int f1(A *a) {
+void f1(A *a) {
// This should also get an implicit cast (for the vararg)
[a m: 1, "test"];
}
diff --git a/clang/test/CodeGenObjC/objc2-write-barrier-2.m b/clang/test/CodeGenObjC/objc2-write-barrier-2.m
index 6bc2f509083bcc..5e27c71f7b14d9 100644
--- a/clang/test/CodeGenObjC/objc2-write-barrier-2.m
+++ b/clang/test/CodeGenObjC/objc2-write-barrier-2.m
@@ -17,12 +17,12 @@
void func(id a, id *b, id **c) {
static id w, *x, **y;
- W = a;
+ W = a;
w = a;
X = b;
- x = b;
+ x = b;
Y = c;
- y = c;
+ y = c;
}
// Instances
@@ -50,7 +50,7 @@ void funct2(AStruct *aptr) {
id **ppptr = somefunc();
aptr->alfred = 0;
**ppptr = aptr->alfred;
- *ppptr = somefunc2();
+ *ppptr = somefunc2();
}
typedef const struct __CFString * CFStringRef;
@@ -59,7 +59,7 @@ @interface DSATextSearch {
struct {
id *innerNames;
struct {
- id *nestedDeeperNames;
+ id *nestedDeeperNames;
struct I {
id *is1;
id is2[5];
@@ -78,6 +78,7 @@ @implementation DSATextSearch
inner.inner_most.nestedDeeperNames[filteredPos] = 0;
inner.inner_most.arrI[3].is1[5] = 0;
inner.inner_most.arrI[3].is2[5] = 0;
+ return 0;
}
@end
diff --git a/clang/test/CodeGenObjC/protocols-lazy.m b/clang/test/CodeGenObjC/protocols-lazy.m
index 6764d0487fe36f..5e5e78c4be75ec 100644
--- a/clang/test/CodeGenObjC/protocols-lazy.m
+++ b/clang/test/CodeGenObjC/protocols-lazy.m
@@ -41,7 +41,7 @@ @interface UserP5<P5> // This generates a forward
@protocol P5 -im1; @end
@implementation UserP5
-- im1 { }
+- im1 { __builtin_unreachable(); }
@end
diff --git a/clang/test/CodeGenObjCXX/instantiate-return.mm b/clang/test/CodeGenObjCXX/instantiate-return.mm
index fe59602b395db2..6e41d9b3d26661 100644
--- a/clang/test/CodeGenObjCXX/instantiate-return.mm
+++ b/clang/test/CodeGenObjCXX/instantiate-return.mm
@@ -18,5 +18,6 @@ @interface C1
@implementation C1
- (TemplateClass<S0>)m1 {
+ __builtin_unreachable();
}
@end
diff --git a/clang/test/Driver/cc-log-diagnostics.c b/clang/test/Driver/cc-log-diagnostics.c
index 1e21c6a76022cc..8cca0e9535c380 100644
--- a/clang/test/Driver/cc-log-diagnostics.c
+++ b/clang/test/Driver/cc-log-diagnostics.c
@@ -4,7 +4,7 @@
// RUN: %clang -Wfoobar --target=x86_64-apple-darwin11 -fsyntax-only %s
// RUN: FileCheck %s < %t.log
-int f0(void) {}
+int;
// CHECK: <dict>
// CHECK: <key>main-file</key>
@@ -27,9 +27,9 @@ int f0(void) {}
// CHECK: <key>line</key>
// CHECK: <integer>7</integer>
// CHECK: <key>column</key>
-// CHECK: <integer>15</integer>
+// CHECK: <integer>1</integer>
// CHECK: <key>message</key>
-// CHECK: <string>non-void function does not return a value</string>
+// CHECK: <string>declaration does not declare anything</string>
// CHECK: </dict>
// CHECK: </array>
// CHECK: </dict>
diff --git a/clang/test/Index/warning-flags.c b/clang/test/Index/warning-flags.c
index 1694c6abab5624..3229f000c4ae0c 100644
--- a/clang/test/Index/warning-flags.c
+++ b/clang/test/Index/warning-flags.c
@@ -9,7 +9,7 @@ int *bar(float *f) { return f; }
// 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: non-void function does not return a value
+// CHECK-BOTH-WARNINGS: error: 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:non-void function does not return a value
diff --git a/clang/test/Misc/serialized-diags-stable.c b/clang/test/Misc/serialized-diags-stable.c
index e8ee83ec7499db..0ca29a2370d622 100644
--- a/clang/test/Misc/serialized-diags-stable.c
+++ b/clang/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(void) {
- // CHECK: serialized-diags-stable.c:[[@LINE+2]]:1: warning: non-void function does not return a value [-Wreturn-type] [Semantic Issue]
+ // CHECK: serialized-diags-stable.c:[[@LINE+2]]:1: error: non-void function does not return a value [-Wreturn-type] [Semantic Issue]
// CHECK-NEXT: Number FIXITs = 0
}
diff --git a/clang/test/Modules/pr61067.cppm b/clang/test/Modules/pr61067.cppm
index 50ab7ba201298d..9e33123ee6dbe6 100644
--- a/clang/test/Modules/pr61067.cppm
+++ b/clang/test/Modules/pr61067.cppm
@@ -49,6 +49,7 @@ import a;
int c() {
(void)(a() == a());
+ return 0;
}
// CHECK: define{{.*}}linkonce_odr{{.*}}@_ZW1aeqS_1aS0_(
diff --git a/clang/test/PCH/late-parsed-instantiations.cpp b/clang/test/PCH/late-parsed-instantiations.cpp
index 9ae6b56a09befa..dd54f647a6541b 100644
--- a/clang/test/PCH/late-parsed-instantiations.cpp
+++ b/clang/test/PCH/late-parsed-instantiations.cpp
@@ -27,8 +27,9 @@ class ArrayBuffer {
char data() {
visit([](auto buffer) -> char { // expected-note {{in instantiation}}
buffer->data();
- }); // expected-warning {{non-void lambda does not return a value}}
- } // expected-warning {{non-void function does not return a value}}
+ }); // expected-error {{non-void lambda does not return a value}}
+ return 0;
+ }
};
#else
diff --git a/clang/test/Parser/promote_types_in_proto.c b/clang/test/Parser/promote_types_in_proto.c
index 969ba28120f239..650dae0a5e7271 100644
--- a/clang/test/Parser/promote_types_in_proto.c
+++ b/clang/test/Parser/promote_types_in_proto.c
@@ -2,7 +2,7 @@
void functionPromotion(void f(char *const []));
void arrayPromotion(char * const argv[]);
-int whatever(int argc, char *argv[])
+void whatever(int argc, char *argv[])
{
arrayPromotion(argv);
functionPromotion(arrayPromotion);
diff --git a/clang/test/Rewriter/rewrite-extern-c.mm b/clang/test/Rewriter/rewrite-extern-c.mm
index 2941504ab78d87..daebb07f8fbf2c 100644
--- a/clang/test/Rewriter/rewrite-extern-c.mm
+++ b/clang/test/Rewriter/rewrite-extern-c.mm
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s
extern "C" {
- short foo() { }
+ short foo() { return 0; }
}
typedef unsigned char Boolean;
diff --git a/clang/test/Sema/freemain.c b/clang/test/Sema/freemain.c
index 83d7a4d56eac9a..99bfd023620978 100644
--- a/clang/test/Sema/freemain.c
+++ b/clang/test/Sema/freemain.c
@@ -6,4 +6,5 @@ void* allocate(long size);
void* main(void* context, long size) {
if (context) return allocate(size);
+ return 0;
} // expected-warning {{non-void function does not return a value in all control paths}}
diff --git a/clang/test/SemaCXX/constant-expression-cxx14.cpp b/clang/test/SemaCXX/constant-expression-cxx14.cpp
index 579883ae52ccee..4281372cac7518 100644
--- a/clang/test/SemaCXX/constant-expression-cxx14.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx14.cpp
@@ -68,7 +68,7 @@ constexpr int j(int k) {
}
}
} // expected-note 2{{control reached end of constexpr function}}
- // cxx23-warning at -1 {{does not return a value in all control paths}}
+ // cxx23-error at -1 {{does not return a value in all control paths}}
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)'}}
diff --git a/clang/test/SemaCXX/err-missing-noreturn-1.cpp b/clang/test/SemaCXX/err-missing-noreturn-1.cpp
new file mode 100644
index 00000000000000..ef2a1a111b5946
--- /dev/null
+++ b/clang/test/SemaCXX/err-missing-noreturn-1.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn -Wreturn-type
+
+struct rdar8875247 {
+ ~rdar8875247 ();
+};
+
+int rdar8875247_test() {
+ rdar8875247 f;
+} // expected-error{{non-void function does not return a value}}
diff --git a/clang/test/SemaCXX/err-missing-noreturn-2.cpp b/clang/test/SemaCXX/err-missing-noreturn-2.cpp
new file mode 100644
index 00000000000000..6f0bf85d0213cc
--- /dev/null
+++ b/clang/test/SemaCXX/err-missing-noreturn-2.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn -Wreturn-type
+
+namespace GH63009 {
+struct S1 {
+ [[noreturn]] S1();
+};
+
+int foo();
+
+int test_1() {
+ S1 s1;
+ foo();
+} // expected-error{{non-void function does not return a value}}
+}
diff --git a/clang/test/SemaCXX/warn-missing-noreturn.cpp b/clang/test/SemaCXX/warn-missing-noreturn.cpp
index 32b49e0a325f26..14746e63dc19bb 100644
--- a/clang/test/SemaCXX/warn-missing-noreturn.cpp
+++ b/clang/test/SemaCXX/warn-missing-noreturn.cpp
@@ -77,7 +77,7 @@ namespace test3 {
A a;
};
- struct C : A {
+ struct C : A {
~C() { }
};
}
@@ -88,10 +88,6 @@ struct rdar8875247 {
};
void rdar8875247_aux();
-int rdar8875247_test() {
- rdar8875247 f;
-} // expected-warning{{non-void function does not return a value}}
-
struct rdar8875247_B {
rdar8875247_B();
~rdar8875247_B();
@@ -124,21 +120,12 @@ namespace PR10801 {
}
namespace GH63009 {
-struct S1 {
- [[noreturn]] S1();
-};
-
struct S2 {
[[noreturn]] ~S2();
};
int foo();
-int test_1() {
- S1 s1;
- foo();
-}
-
int test_2() {
S2 s2;
foo();
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
index 92ec79d126575a..5e1c12ba26d877 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -4329,7 +4329,7 @@ TEST_P(ASTMatchersTest, hasOperator) {
TEST_P(ASTMatchersTest, IsMain) {
EXPECT_TRUE(matches("int main() {}", functionDecl(isMain())));
- EXPECT_TRUE(notMatches("int main2() {}", functionDecl(isMain())));
+ EXPECT_TRUE(notMatches("int main2() { return 0; }", functionDecl(isMain())));
}
TEST_P(ASTMatchersTest, OMPExecutableDirective_IsStandaloneDirective) {
diff --git a/clang/unittests/Tooling/ASTSelectionTest.cpp b/clang/unittests/Tooling/ASTSelectionTest.cpp
index 1897bc15196ec2..0f60749725cde9 100644
--- a/clang/unittests/Tooling/ASTSelectionTest.cpp
+++ b/clang/unittests/Tooling/ASTSelectionTest.cpp
@@ -384,7 +384,7 @@ TEST(ASTSelectionFinder, SelectionInFunctionInObjCImplementation) {
@end
@implementation I
-int notSelected() { }
+int notSelected() { return 0; }
int selected(int x) {
return x;
diff --git a/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp b/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp
index b167eb4b811755..c0833dc4a640d8 100644
--- a/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp
+++ b/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp
@@ -107,7 +107,7 @@ TEST(LexicallyOrderedRecursiveASTVisitor, VisitDeclsInImplementation) {
@end
@implementation I
-int nestedFunction() { }
+void nestedFunction() { }
- (void) method{ }
diff --git a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
index a551f83ff3f9c7..f41b52f5d2ca60 100644
--- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -4258,7 +4258,7 @@ TEST_P(BuildSyntaxTreeTest, InitDeclarator_Brace) {
}
EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
-struct S {
+struct S {
S();
S(int);
S(int, float);
@@ -4315,7 +4315,7 @@ TEST_P(BuildSyntaxTreeTest, InitDeclarator_EqualBrace) {
}
EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
-struct S {
+struct S {
S();
S(int);
S(int, float);
@@ -4604,7 +4604,7 @@ TEST_P(BuildSyntaxTreeTest, ConstructorCall_DefaultArguments) {
struct X {
X(int i = 1, char c = '2');
};
-X test() {
+void test() {
auto x0 = [[X()]];
auto x1 = [[X(1)]];
auto x2 = [[X(1, '2')]];
>From 3424460ae13dc90d6f5e11e1b4916bf23fce7387 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Fri, 17 Jan 2025 03:34:26 +0100
Subject: [PATCH 2/4] Fix more tests
---
.../clang/Basic/DiagnosticSemaKinds.td | 4 +-
clang/test/ARCMT/retains.m | 4 +-
.../test/AST/ast-dump-cxx2b-deducing-this.cpp | 2 +-
clang/test/Analysis/const-method-call.cpp | 2 +-
clang/test/Analysis/inline-unique-reports.c | 2 +-
clang/test/Analysis/novoidtypecrash.c | 3 +-
clang/test/Analysis/plist-output.m | 2 +-
clang/test/Analysis/scopes-cfg-output.cpp | 2 +-
clang/test/Analysis/structured_bindings.cpp | 4 +-
.../2005-06-15-ExpandGotoInternalProblem.c | 2 +-
clang/test/CodeGen/2008-05-06-CFECrash.c | 2 +-
clang/test/CodeGen/2008-10-13-FrontendCrash.c | 2 +-
clang/test/CodeGen/2009-05-04-EnumInreg.c | 2 +-
clang/test/CodeGen/X86/avx512fp16-abi.c | 8 +--
clang/test/CodeGen/arm-cmse-secure.c | 2 +-
clang/test/CodeGen/attr-noreturn.c | 4 +-
clang/test/CodeGen/builtin-memfns.c | 4 +-
clang/test/CodeGen/catch-undef-behavior.c | 6 +-
clang/test/CodeGen/cfi-unrelated-cast.cpp | 2 +-
clang/test/CodeGen/debug-info-crash.c | 2 +-
clang/test/CodeGen/debug-info.c | 4 +-
clang/test/CodeGen/empty-union-init.c | 2 +-
clang/test/CodeGen/ext-int-cc.c | 12 ++--
clang/test/CodeGen/implicit-arg.c | 4 +-
clang/test/CodeGen/msan-param-retval.c | 12 ++--
clang/test/CodeGen/msan-param-retval.cpp | 12 ++--
clang/test/CodeGen/sparcv8-abi.c | 3 +
clang/test/CodeGen/sret.c | 2 +-
clang/test/CodeGen/struct.c | 4 +-
clang/test/CodeGen/ubsan-debuglog-return.c | 2 +-
clang/test/CodeGen/ve-abi.c | 1 +
.../2007-09-10-RecursiveTypeResolution.cpp | 1 +
.../CodeGenCXX/2009-08-11-VectorRetTy.cpp | 2 +-
clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp | 6 +-
.../CodeGenCXX/address-space-cast-coerce.cpp | 2 +-
clang/test/CodeGenCXX/attr.cpp | 2 +-
clang/test/CodeGenCXX/c-linkage.cpp | 3 +-
clang/test/CodeGenCXX/conditional-gnu-ext.cpp | 2 +-
.../cxx1y-variable-template-linkage.cpp | 3 +
.../CodeGenCXX/debug-info-scoped-class.cpp | 2 +-
.../lambda-expressions-nested-linkage.cpp | 7 ++-
clang/test/CodeGenCXX/mangle-exprs.cpp | 62 +++++++++----------
.../CodeGenCXX/mangle-variadic-templates.cpp | 2 +-
clang/test/CodeGenCXX/mangle.cpp | 2 +-
.../test/CodeGenCXX/matrix-type-operators.cpp | 2 +-
clang/test/CodeGenCXX/matrix-type.cpp | 20 +++---
.../microsoft-abi-static-initializers.cpp | 1 +
clang/test/CodeGenCXX/new-alias.cpp | 1 +
clang/test/CodeGenCXX/nrvo.cpp | 8 +--
.../CodeGenCXX/template-instantiation.cpp | 4 +-
clang/test/CodeGenCXX/trap-fnattr.cpp | 4 +-
clang/test/CodeGenObjC/2008-11-25-Blocks.m | 2 +-
clang/test/CodeGenObjC/debug-info-crash.m | 2 +-
clang/test/CodeGenObjC/encode-test.m | 12 ++--
clang/test/CodeGenObjC/metadata-symbols-32.m | 4 +-
clang/test/CodeGenObjC/metadata-symbols-64.m | 6 +-
clang/test/CodeGenObjC/objc2-weak-compare.m | 6 +-
clang/test/CodeGenObjC/strong-in-c-struct.m | 8 +--
clang/test/CodeGenObjCXX/debug-info-line.mm | 4 +-
.../pr14474-gline-tables-only.mm | 8 +--
.../CodeGenObjCXX/property-dot-reference.mm | 8 +--
clang/test/CodeGenObjCXX/return.mm | 4 +-
clang/test/CoverageMapping/switch.cpp | 2 +-
clang/test/Frontend/absolute-paths.c | 8 +--
clang/test/Frontend/ast-codegen.c | 4 +-
clang/test/Frontend/ast-main.cpp | 6 +-
clang/test/Modules/redecl-merge.m | 2 +-
clang/test/PCH/irgen-rdar13114142.mm | 2 +
clang/test/PCH/late-parsed-instantiations.cpp | 17 +++--
clang/test/PCH/pr4489.c | 4 +-
clang/test/PCH/va_arg.c | 2 +
clang/test/Sema/freemain.c | 3 +-
clang/test/Sema/return-type-mismatch.c | 12 ++--
.../constexpr-return-non-void-cxx2b.cpp | 2 +-
clang/test/SemaCXX/err-missing-noreturn-2.cpp | 3 +-
clang/test/SemaCXX/return-noreturn.cpp | 4 +-
...-unsafe-buffer-usage-fixits-add-assign.cpp | 14 ++---
clang/test/SemaObjC/return-noreturn.m | 2 +-
clang/test/SemaObjC/try-catch.m | 2 +-
.../late-parsing-eager-instantiation.cpp | 2 +-
.../ASTMatchers/ASTMatchersTraversalTest.cpp | 4 +-
81 files changed, 214 insertions(+), 200 deletions(-)
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 75cc9d1329928b..c84177a9bc75cc 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -8358,10 +8358,10 @@ let CategoryName = "Lambda Issue" in {
"lambda declared 'noreturn' should not return">;
def warn_maybe_falloff_nonvoid_lambda : Warning<
"non-void lambda does not return a value in all control paths">,
- InGroup<ReturnType>;
+ InGroup<ReturnType>, DefaultError;
def warn_falloff_nonvoid_lambda : Warning<
"non-void lambda does not return a value">,
- InGroup<ReturnType>;
+ InGroup<ReturnType>, DefaultError;
def err_access_lambda_capture : Error<
// The ERRORs represent other special members that aren't constructors, in
// hopes that someone will bother noticing and reporting if they appear
diff --git a/clang/test/ARCMT/retains.m b/clang/test/ARCMT/retains.m
index 43a94fc16cecf2..c5d54650a5182f 100644
--- a/clang/test/ARCMT/retains.m
+++ b/clang/test/ARCMT/retains.m
@@ -21,7 +21,7 @@ @implementation Foo
@synthesize bar;
--(id)something {}
+-(id)something { return 0; }
-(id)test:(id)obj {
id x = self.bar;
@@ -44,7 +44,7 @@ -(id)test:(id)obj {
[x release];
return [self retain];
}
-
+
- (id)test1 {
id x=0;
([x retain]);
diff --git a/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp b/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp
index 1b385e0fc33319..854d12b4cdba6e 100644
--- a/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp
+++ b/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp
@@ -5,7 +5,7 @@ struct S {
int f(this S&);
};
-int main() {
+void main() {
S s;
int x = s.f();
// CHECK: CallExpr 0x{{[^ ]*}} <col:11, col:15> 'int
diff --git a/clang/test/Analysis/const-method-call.cpp b/clang/test/Analysis/const-method-call.cpp
index 7da7ca5554a23e..b37ce17447bdd2 100644
--- a/clang/test/Analysis/const-method-call.cpp
+++ b/clang/test/Analysis/const-method-call.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -Wno-error=return-type -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
void clang_analyzer_eval(bool);
diff --git a/clang/test/Analysis/inline-unique-reports.c b/clang/test/Analysis/inline-unique-reports.c
index e58870ea74ab83..306e314a94e437 100644
--- a/clang/test/Analysis/inline-unique-reports.c
+++ b/clang/test/Analysis/inline-unique-reports.c
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -o %t > /dev/null 2>&1
+// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -Wno-error=return-type -o %t > /dev/null 2>&1
// RUN: %normalize_plist <%t | diff -ub %S/Inputs/expected-plists/inline-unique-reports.c.plist -
static inline bug(int *p) {
diff --git a/clang/test/Analysis/novoidtypecrash.c b/clang/test/Analysis/novoidtypecrash.c
index 8d4124005d60bc..5af30c20104386 100644
--- a/clang/test/Analysis/novoidtypecrash.c
+++ b/clang/test/Analysis/novoidtypecrash.c
@@ -1,11 +1,10 @@
-// RUN: %clang_analyze_cc1 -std=c89 -Wno-int-conversion -analyzer-checker=core %s
+// RUN: %clang_analyze_cc1 -Wno-error=return-type -std=c89 -Wno-int-conversion -analyzer-checker=core %s
x;
y(void **z) { // no-crash
*z = x;
int *w;
y(&w);
*w;
- return 0;
}
a;
diff --git a/clang/test/Analysis/plist-output.m b/clang/test/Analysis/plist-output.m
index 96123243a833a0..e7f2c9e441775a 100644
--- a/clang/test/Analysis/plist-output.m
+++ b/clang/test/Analysis/plist-output.m
@@ -177,7 +177,7 @@ - (void)test {
struct RDar13295437_S { int *i; };
-int RDar13295437(void) {
+void RDar13295437(void) {
struct RDar13295437_S s = {0};
struct RDar13295437_S *sp = &s;
RDar13295437_f(sp->i);
diff --git a/clang/test/Analysis/scopes-cfg-output.cpp b/clang/test/Analysis/scopes-cfg-output.cpp
index 5e6706602d4564..c082bb179545fa 100644
--- a/clang/test/Analysis/scopes-cfg-output.cpp
+++ b/clang/test/Analysis/scopes-cfg-output.cpp
@@ -1074,7 +1074,7 @@ void test_switch_with_compound_with_default() {
// CHECK-NEXT: Succs (1): B4
// CHECK: [B0 (EXIT)]
// CHECK-NEXT: Preds (1): B1
-int test_switch_with_compound_without_default() {
+void test_switch_with_compound_without_default() {
char c = '1';
switch (int i = getX()) {
case 0:
diff --git a/clang/test/Analysis/structured_bindings.cpp b/clang/test/Analysis/structured_bindings.cpp
index 7004c2e7dcf43f..989c584189ab2d 100644
--- a/clang/test/Analysis/structured_bindings.cpp
+++ b/clang/test/Analysis/structured_bindings.cpp
@@ -3,10 +3,10 @@
void clang_analyzer_eval(bool);
struct s { int a; };
-int foo() {
+void foo() {
auto [a] = s{1};
clang_analyzer_eval(a == 1); // expected-warning{{TRUE}}
-} // expected-warning{{non-void function does not return a value}}
+}
struct s2 {
int &x;
diff --git a/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c b/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c
index 521e6986615151..597b0bd9afe954 100644
--- a/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c
+++ b/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | \
+// RUN: %clang_cc1 -Wno-error=return-type -std=c99 %s -emit-llvm -o - | \
// RUN: opt -O3 -disable-output
// PR580
diff --git a/clang/test/CodeGen/2008-05-06-CFECrash.c b/clang/test/CodeGen/2008-05-06-CFECrash.c
index 11775673a7cc78..7ca157969ac382 100644
--- a/clang/test/CodeGen/2008-05-06-CFECrash.c
+++ b/clang/test/CodeGen/2008-05-06-CFECrash.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -O2 %s -o /dev/null
+// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -O2 %s -o /dev/null
// PR2292.
__inline__ __attribute__ ((__pure__)) int g (void) {}
void f (int k) { k = g (); }
diff --git a/clang/test/CodeGen/2008-10-13-FrontendCrash.c b/clang/test/CodeGen/2008-10-13-FrontendCrash.c
index da28bd9b1b9b1d..f303224a44942b 100644
--- a/clang/test/CodeGen/2008-10-13-FrontendCrash.c
+++ b/clang/test/CodeGen/2008-10-13-FrontendCrash.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -std=c89 -emit-llvm -o -
// PR2797
-unsigned int
+void
func_48 (signed char p_49)
{
signed char l_340;
diff --git a/clang/test/CodeGen/2009-05-04-EnumInreg.c b/clang/test/CodeGen/2009-05-04-EnumInreg.c
index 0ea18b92691e09..491678647b8463 100644
--- a/clang/test/CodeGen/2009-05-04-EnumInreg.c
+++ b/clang/test/CodeGen/2009-05-04-EnumInreg.c
@@ -14,4 +14,4 @@ enum kobject_action {
struct kobject;
// CHECK: i32 inreg %action
-int kobject_uevent(struct kobject *kobj, enum kobject_action action) {}
+void kobject_uevent(struct kobject *kobj, enum kobject_action action) {}
diff --git a/clang/test/CodeGen/X86/avx512fp16-abi.c b/clang/test/CodeGen/X86/avx512fp16-abi.c
index 5442c480d67c05..1856f1e22715c8 100644
--- a/clang/test/CodeGen/X86/avx512fp16-abi.c
+++ b/clang/test/CodeGen/X86/avx512fp16-abi.c
@@ -206,7 +206,7 @@ struct fsd {
struct fsd pr52011(void) {
// CHECK: define{{.*}} { float, double } @
- fsd x;
+ struct fsd x;
return x;
}
@@ -218,7 +218,7 @@ struct hsd {
struct hsd pr52011_2(void) {
// CHECK: define{{.*}} { half, double } @
- hsd x;
+ struct hsd x;
return x;
}
@@ -230,7 +230,7 @@ struct hsf {
struct hsf pr52011_3(void) {
// CHECK: define{{.*}} <4 x half> @
- hsf x;
+ struct hsf x;
return x;
}
@@ -243,6 +243,6 @@ struct fds {
struct fds pr52011_4(void) {
// CHECK-C: define{{.*}} { float, double } @pr52011_4
// CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret
- fds x;
+ struct fds x;
return x;
}
diff --git a/clang/test/CodeGen/arm-cmse-secure.c b/clang/test/CodeGen/arm-cmse-secure.c
index 132172b6c8702e..ec66f4f6fa6481 100644
--- a/clang/test/CodeGen/arm-cmse-secure.c
+++ b/clang/test/CodeGen/arm-cmse-secure.c
@@ -53,7 +53,7 @@ typedef struct {
int x, y, z;
} Point;
-void *test_pointed_object(void *p) {
+void test_pointed_object(void *p) {
// CHECK: define {{.*}} ptr @test_pointed_object
Point *pt = (Point *)p;
cmse_check_pointed_object(pt, CMSE_NONSECURE
diff --git a/clang/test/CodeGen/attr-noreturn.c b/clang/test/CodeGen/attr-noreturn.c
index 93816b7570e876..c3f41d8424bed6 100644
--- a/clang/test/CodeGen/attr-noreturn.c
+++ b/clang/test/CodeGen/attr-noreturn.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -std=c2x %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CXX
+// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -std=c2x %s -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple %itanium_abi_triple -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CXX
typedef void (*fptrs_t[4])(void);
fptrs_t p __attribute__((noreturn));
diff --git a/clang/test/CodeGen/builtin-memfns.c b/clang/test/CodeGen/builtin-memfns.c
index 581eb85eb28e69..c98f49fd7b3720 100644
--- a/clang/test/CodeGen/builtin-memfns.c
+++ b/clang/test/CodeGen/builtin-memfns.c
@@ -56,9 +56,9 @@ int test6(char *X) {
// CHECK: @test7
// PR12094
-int test7(int *p) {
+void test7(int *p) {
struct snd_pcm_hw_params_t* hwparams; // incomplete type.
-
+
// CHECK: call void @llvm.memset{{.*}} align 4 {{.*}}256, i1 false)
__builtin_memset(p, 0, 256); // Should be alignment = 4
diff --git a/clang/test/CodeGen/catch-undef-behavior.c b/clang/test/CodeGen/catch-undef-behavior.c
index 7580290b0b0333..14cb7705c3783e 100644
--- a/clang/test/CodeGen/catch-undef-behavior.c
+++ b/clang/test/CodeGen/catch-undef-behavior.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-UBSAN
-// RUN: %clang_cc1 -fsanitize-trap=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP
-// RUN: %clang_cc1 -fsanitize=signed-integer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-OVERFLOW
+// RUN: %clang_cc1 -Wno-error=return-type -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-UBSAN
+// RUN: %clang_cc1 -Wno-error=return-type -fsanitize-trap=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP
+// RUN: %clang_cc1 -Wno-error=return-type -fsanitize=signed-integer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-OVERFLOW
// CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
diff --git a/clang/test/CodeGen/cfi-unrelated-cast.cpp b/clang/test/CodeGen/cfi-unrelated-cast.cpp
index abd67901f00202..4095d67450d37f 100644
--- a/clang/test/CodeGen/cfi-unrelated-cast.cpp
+++ b/clang/test/CodeGen/cfi-unrelated-cast.cpp
@@ -29,7 +29,7 @@ class C1 {
virtual void f() {}
};
-C1 *f1() {
+void f1() {
myalloc<C1> allocator;
(void)allocator.allocate(16);
(void)allocator.allocate(16, 0);
diff --git a/clang/test/CodeGen/debug-info-crash.c b/clang/test/CodeGen/debug-info-crash.c
index b53dbc50676d40..e3a8f81d3508b4 100644
--- a/clang/test/CodeGen/debug-info-crash.c
+++ b/clang/test/CodeGen/debug-info-crash.c
@@ -6,7 +6,7 @@ __attribute__((visibility("default")))
extern struct dispatch_queue_s _dispatch_main_q;
typedef struct dispatch_item_s *dispatch_item_t;
typedef void (^dispatch_legacy_block_t)(dispatch_item_t);
-dispatch_item_t LEGACY_dispatch_call(dispatch_queue_t dq,
+void LEGACY_dispatch_call(dispatch_queue_t dq,
dispatch_legacy_block_t dispatch_block,
dispatch_legacy_block_t callback_block) {
dispatch_queue_t lq = _dispatch_queue_get_current() ?: (&_dispatch_main_q);
diff --git a/clang/test/CodeGen/debug-info.c b/clang/test/CodeGen/debug-info.c
index 4c444515757bde..024e9579843d4c 100644
--- a/clang/test/CodeGen/debug-info.c
+++ b/clang/test/CodeGen/debug-info.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
-// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple powerpc64-ibm-aix-xcoff -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s
// PR3023
void convert(void) {
diff --git a/clang/test/CodeGen/empty-union-init.c b/clang/test/CodeGen/empty-union-init.c
index 1a05ebea7df5ab..386aeb260fae53 100644
--- a/clang/test/CodeGen/empty-union-init.c
+++ b/clang/test/CodeGen/empty-union-init.c
@@ -8,7 +8,7 @@ struct Mem {
struct Mem *columnMem(void){
static const struct Mem nullMem = { {} };
- return nullptr;
+ return 0;
}
diff --git a/clang/test/CodeGen/ext-int-cc.c b/clang/test/CodeGen/ext-int-cc.c
index df1b1ef6246b2a..14efd54e24ffb2 100644
--- a/clang/test/CodeGen/ext-int-cc.c
+++ b/clang/test/CodeGen/ext-int-cc.c
@@ -193,7 +193,7 @@ _BitInt(63) ReturnPassing(void) { return 0; }
// LA64: define{{.*}} signext i63 @ReturnPassing(
// LA32: define{{.*}} i63 @ReturnPassing(
-_BitInt(64) ReturnPassing2(void){}
+_BitInt(64) ReturnPassing2(void) { return 0; }
// LIN64: define{{.*}} i64 @ReturnPassing2(
// WIN64: define dso_local i64 @ReturnPassing2(
// LIN32: define{{.*}} i64 @ReturnPassing2(
@@ -224,7 +224,7 @@ _BitInt(64) ReturnPassing2(void){}
// LA64: define{{.*}} i64 @ReturnPassing2(
// LA32: define{{.*}} i64 @ReturnPassing2(
-_BitInt(127) ReturnPassing3(void){}
+_BitInt(127) ReturnPassing3(void) { return 0; }
// LIN64: define{{.*}} { i64, i64 } @ReturnPassing3(
// WIN64: define dso_local void @ReturnPassing3(ptr dead_on_unwind noalias writable sret
// LIN32: define{{.*}} void @ReturnPassing3(ptr dead_on_unwind noalias writable sret
@@ -257,7 +257,7 @@ _BitInt(127) ReturnPassing3(void){}
// LA64: define{{.*}} i127 @ReturnPassing3(
// LA32: define{{.*}} void @ReturnPassing3(ptr dead_on_unwind noalias writable sret
-_BitInt(128) ReturnPassing4(void){}
+_BitInt(128) ReturnPassing4(void) { return 0; }
// LIN64: define{{.*}} { i64, i64 } @ReturnPassing4(
// WIN64: define dso_local void @ReturnPassing4(ptr dead_on_unwind noalias writable sret
// LIN32: define{{.*}} void @ReturnPassing4(ptr dead_on_unwind noalias writable sret
@@ -289,7 +289,7 @@ _BitInt(128) ReturnPassing4(void){}
// LA32: define{{.*}} void @ReturnPassing4(ptr dead_on_unwind noalias writable sret
#if __BITINT_MAXWIDTH__ > 128
-_BitInt(129) ReturnPassing5(void){}
+_BitInt(129) ReturnPassing5(void) { return 0; }
// LIN64: define{{.*}} void @ReturnPassing5(ptr dead_on_unwind noalias writable sret
// WIN64: define dso_local void @ReturnPassing5(ptr dead_on_unwind noalias writable sret
// LIN32: define{{.*}} void @ReturnPassing5(ptr dead_on_unwind noalias writable sret
@@ -322,8 +322,8 @@ _BitInt(129) ReturnPassing5(void){}
// SparcV9 is odd in that it has a return-size limit of 256, not 128 or 64
// like other platforms, so test to make sure this behavior will still work.
-_BitInt(256) ReturnPassing6(void) {}
+_BitInt(256) ReturnPassing6(void) { return 0; }
// SPARCV9-NOT: define{{.*}} i256 @ReturnPassing6(
-_BitInt(257) ReturnPassing7(void) {}
+_BitInt(257) ReturnPassing7(void) { return 0; }
// SPARCV9-NOT: define{{.*}} void @ReturnPassing7(ptr dead_on_unwind noalias writable sret
#endif
diff --git a/clang/test/CodeGen/implicit-arg.c b/clang/test/CodeGen/implicit-arg.c
index 9959419f9b7c88..3630fbbbdb1a62 100644
--- a/clang/test/CodeGen/implicit-arg.c
+++ b/clang/test/CodeGen/implicit-arg.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -emit-llvm -o -
-// RUN: %clang_cc1 %s -emit-llvm -O1 -o -
+// RUN: %clang_cc1 %s -Wno-error=return-type -emit-llvm -o -
+// RUN: %clang_cc1 %s -Wno-error=return-type -emit-llvm -O1 -o -
static int bar();
void foo() {
diff --git a/clang/test/CodeGen/msan-param-retval.c b/clang/test/CodeGen/msan-param-retval.c
index 269a759fac10e7..fea2c3c975a4d4 100644
--- a/clang/test/CodeGen/msan-param-retval.c
+++ b/clang/test/CodeGen/msan-param-retval.c
@@ -1,12 +1,12 @@
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
void bar(int x) {
@@ -33,7 +33,7 @@ int foo() {
int noret() {
}
-// CLEAN: define dso_local i32 @noret() #0 {
+// CLEAN: define dso_local i32 @noret() #0 {
// NOUNDEF: define dso_local noundef i32 @noret() #0 {
// CHECK: %retval = alloca
// CLEAN: @__msan_retval_tls
diff --git a/clang/test/CodeGen/msan-param-retval.cpp b/clang/test/CodeGen/msan-param-retval.cpp
index c4960a4702f6cd..fa62ae2bb5e34e 100644
--- a/clang/test/CodeGen/msan-param-retval.cpp
+++ b/clang/test/CodeGen/msan-param-retval.cpp
@@ -1,12 +1,12 @@
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \
// RUN: FileCheck %s --check-prefixes=CLEAN,CHECK
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \
// RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK
void bar(int x) {
@@ -36,4 +36,4 @@ int noret() {
// CLEAN: define dso_local i32 @_Z5noretv() #0 {
// NOUNDEF: define dso_local noundef i32 @_Z5noretv() #0 {
// CHECK: unreachable
-// CHECK: }
\ No newline at end of file
+// CHECK: }
diff --git a/clang/test/CodeGen/sparcv8-abi.c b/clang/test/CodeGen/sparcv8-abi.c
index 7a937176432786..c5faf130890f89 100644
--- a/clang/test/CodeGen/sparcv8-abi.c
+++ b/clang/test/CodeGen/sparcv8-abi.c
@@ -4,16 +4,19 @@
float __complex__
p (float __complex__ a, float __complex__ b)
{
+ return 0;
}
// CHECK-LABEL: define{{.*}} { double, double } @q(ptr noundef byval({ double, double }) align 8 %a, ptr noundef byval({ double, double }) align 8 %b) #0 {
double __complex__
q (double __complex__ a, double __complex__ b)
{
+ return 0;
}
// CHECK-LABEL: define{{.*}} { i64, i64 } @r(ptr noundef byval({ i64, i64 }) align 8 %a, ptr noundef byval({ i64, i64 }) align 8 %b) #0 {
long long __complex__
r (long long __complex__ a, long long __complex__ b)
{
+ return 0;
}
diff --git a/clang/test/CodeGen/sret.c b/clang/test/CodeGen/sret.c
index dd776334e3969b..f12a7fdfd5ace9 100644
--- a/clang/test/CodeGen/sret.c
+++ b/clang/test/CodeGen/sret.c
@@ -12,7 +12,7 @@ struct abc foo1(void);
// CHECK-DAG: declare {{.*}} @foo1(ptr dead_on_unwind writable sret(%struct.abc)
struct abc foo2();
// CHECK-DAG: declare {{.*}} @foo2(ptr dead_on_unwind writable sret(%struct.abc)
-struct abc foo3(void) { return {}; }
+struct abc foo3(void) { return (abc){0}; }
// CHECK-DAG: define {{.*}} @foo3(ptr dead_on_unwind noalias writable sret(%struct.abc)
void bar(void) {
diff --git a/clang/test/CodeGen/struct.c b/clang/test/CodeGen/struct.c
index c98357160addf1..63c50ed920be5f 100644
--- a/clang/test/CodeGen/struct.c
+++ b/clang/test/CodeGen/struct.c
@@ -115,7 +115,7 @@ typedef struct _a {
void f11(void) {
struct _a a1;
a a2;
-
+
a1 = a2;
a2 = a1;
}
@@ -136,7 +136,7 @@ struct a14 { short a; int b; } x = {1, 1};
/* flexible array members */
struct a15 {char a; int b[];} c15;
-int a16(void) {c15.a = 1;}
+void a16(void) {c15.a = 1;}
/* compound literals */
void f13(void) {
diff --git a/clang/test/CodeGen/ubsan-debuglog-return.c b/clang/test/CodeGen/ubsan-debuglog-return.c
index ecbebc34d22332..253f0819be8ec3 100644
--- a/clang/test/CodeGen/ubsan-debuglog-return.c
+++ b/clang/test/CodeGen/ubsan-debuglog-return.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error-return-type -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s
// The UBSAN function call in the epilogue needs to have a debug location.
__attribute__((returns_nonnull)) void *allocate(void) {}
diff --git a/clang/test/CodeGen/ve-abi.c b/clang/test/CodeGen/ve-abi.c
index 25ec3ed07b7dd5..4e73b7eec16c12 100644
--- a/clang/test/CodeGen/ve-abi.c
+++ b/clang/test/CodeGen/ve-abi.c
@@ -52,6 +52,7 @@ unsigned long fun_zi64(unsigned long a, unsigned long b) {
// CHECK-LABEL: define{{.*}} i128 @fun_si128(i128 noundef %a, i128 noundef %b) #0 {
__int128 fun_si128(__int128 a, __int128 b) {
+ return a;
}
// CHECK-LABEL: define{{.*}} i128 @fun_zi128(i128 noundef %a, i128 noundef %b) #0 {
diff --git a/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp b/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp
index ec8a516c696b10..b8d55ced2c2a63 100644
--- a/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp
+++ b/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp
@@ -55,6 +55,7 @@ namespace Manta
vector < _Tp, _Alloc > > iterator;
iterator end ()
{
+ return {};
}
};
class MantaInterface
diff --git a/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp b/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp
index fe6f32a6969cd8..04b1067aabdec6 100644
--- a/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp
+++ b/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -emit-llvm -o /dev/null
typedef void (*Func) ();
typedef long long m64 __attribute__((__vector_size__(8), __may_alias__));
-static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() {}
+static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() { return {}; }
template <class MM>
static void Bork() {
const m64 mmx_0x00ff = _mm_set1_pi16();
diff --git a/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp b/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp
index a88d605f565eed..91b6a3fb1b8fdf 100644
--- a/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp
+++ b/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp
@@ -69,17 +69,17 @@ template <typename SIZE_AND_ENDIANNESS> void extract_dwarf_data_from_header(TExt
TRawSymbolOwnerData<typename SIZE_AND_ENDIANNESS::SIZE>& symbol_owner_data,
TAddressRelocator<typename SIZE_AND_ENDIANNESS::SIZE>* address_relocator) {}
struct CSCppSymbolOwnerHashFunctor {
- size_t operator()(const CSCppSymbolOwner& symbol_owner) const {
+ void operator()(const CSCppSymbolOwner& symbol_owner) const {
# 97 "wrong_place_for_decl.cpp"
}
};
-template <typename SIZE_AND_ENDIANNESS> CSCppSymbolOwnerData* create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
+template <typename SIZE_AND_ENDIANNESS> void create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
typedef typename SIZE_AND_ENDIANNESS::SIZE SIZE;
std::auto_ptr< TRawSymbolOwnerData<SIZE> > data(new TRawSymbolOwnerData<SIZE>());
std::auto_ptr< TExtendedMachOHeader<SIZE_AND_ENDIANNESS> > header;
extract_dwarf_data_from_header(*header, *data, (TAddressRelocator<typename SIZE_AND_ENDIANNESS::SIZE>*)__null);
}
-CSCppSymbolOwnerData* create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
+void create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) {
create_symbol_owner_data_arch_specific< ISA32Little >(symbol_owner, dsym_path);
create_symbol_owner_data_arch_specific< ISA32Big >(symbol_owner, dsym_path);
create_symbol_owner_data_arch_specific< ISA64Little >(symbol_owner, dsym_path);
diff --git a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp
index 1ad46042b6efd6..ed575e14244f5f 100644
--- a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp
+++ b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp
@@ -41,7 +41,7 @@ template<typename T, unsigned int n>
using char1 = my_vector_type<char, 1>;
-int mane() {
+void mane() {
char1 f1{1};
char1 f2{1};
diff --git a/clang/test/CodeGenCXX/attr.cpp b/clang/test/CodeGenCXX/attr.cpp
index 3890f2018c9a62..78df87c6e08881 100644
--- a/clang/test/CodeGenCXX/attr.cpp
+++ b/clang/test/CodeGenCXX/attr.cpp
@@ -4,7 +4,7 @@
// CHECK: define{{.*}} i32 @_Z3foov() [[NUW:#[0-9]+]] align 1024
int foo() __attribute__((aligned(1024)));
-int foo() { }
+int foo() { return 0; }
class C {
virtual void bar1() __attribute__((aligned(1)));
diff --git a/clang/test/CodeGenCXX/c-linkage.cpp b/clang/test/CodeGenCXX/c-linkage.cpp
index 0f4c3277253f72..d147ff6c954ab5 100644
--- a/clang/test/CodeGenCXX/c-linkage.cpp
+++ b/clang/test/CodeGenCXX/c-linkage.cpp
@@ -3,7 +3,7 @@
extern "C" {
namespace N {
- struct X {
+ struct X {
virtual void f();
};
void X::f() { }
@@ -29,5 +29,6 @@ extern "C" {
struct test3_s {
};
bool operator==(const int& a, const test3_s& b) {
+ return false;
}
}
diff --git a/clang/test/CodeGenCXX/conditional-gnu-ext.cpp b/clang/test/CodeGenCXX/conditional-gnu-ext.cpp
index 3d3d210f22f693..4411d4269b8cde 100644
--- a/clang/test/CodeGenCXX/conditional-gnu-ext.cpp
+++ b/clang/test/CodeGenCXX/conditional-gnu-ext.cpp
@@ -11,7 +11,7 @@ void test0() {
namespace radar8446940 {
extern "C" void abort();
-int main () {
+void main () {
char x[1];
char *y = x ? : 0;
diff --git a/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp b/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp
index ac542870f1f4b8..7bc82eff66790c 100644
--- a/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp
+++ b/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp
@@ -55,6 +55,9 @@ static const int &foo() {
// CHECK-DAG: @_Z1tIKiE
return t<const int>;
}
+
+ static int x;
+ return x;
}
diff --git a/clang/test/CodeGenCXX/debug-info-scoped-class.cpp b/clang/test/CodeGenCXX/debug-info-scoped-class.cpp
index de4aee9a1b448b..7424487df418b8 100644
--- a/clang/test/CodeGenCXX/debug-info-scoped-class.cpp
+++ b/clang/test/CodeGenCXX/debug-info-scoped-class.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -std=c++11 \
+// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -debug-info-kind=standalone -std=c++11 \
// RUN: -triple thumbv7-apple-ios %s -o - | FileCheck %s
// This forward-declared scoped enum will be created while building its own
diff --git a/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp b/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
index 18d2080a611e84..1a212b0806f1fd 100644
--- a/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
+++ b/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
@@ -17,9 +17,9 @@ void foo() {
namespace non_template {
struct L {
- int t = ([](int a) { return [](int b) { return b; };})(2)(3);
+ int t = ([](int a) { return [](int b) { return b; };})(2)(3);
};
- L l;
+ L l;
}
// It's important that this is not in a namespace; we're testing the mangling
@@ -32,7 +32,7 @@ void test_lambda_in_inline_variable(Wrap<decltype(lambda_in_inline_variable)>) {
namespace lambdas_in_NSDMIs_template_class {
template<class T>
struct L {
- T t2 = ([](int a) { return [](int b) { return b; };})(T{})(T{});
+ T t2 = ([](int a) { return [](int b) { return b; };})(T{})(T{});
};
L<int> l;
}
@@ -56,6 +56,7 @@ inline int foo() {
};
};
L(3)('a');
+ return 0;
}
int use = foo();
}
diff --git a/clang/test/CodeGenCXX/mangle-exprs.cpp b/clang/test/CodeGenCXX/mangle-exprs.cpp
index b666eaadf45768..60e4c021b86b9b 100644
--- a/clang/test/CodeGenCXX/mangle-exprs.cpp
+++ b/clang/test/CodeGenCXX/mangle-exprs.cpp
@@ -43,7 +43,7 @@ namespace Casts {
template< unsigned O >
void implicit(typename enable_if< O <= 4 >::type* = 0) {
}
-
+
template< unsigned O >
void cstyle(typename enable_if< O <= (unsigned)4 >::type* = 0) {
}
@@ -51,7 +51,7 @@ namespace Casts {
template< unsigned O >
void functional(typename enable_if< O <= unsigned(4) >::type* = 0) {
}
-
+
template< unsigned O >
void static_(typename enable_if< O <= static_cast<unsigned>(4) >::type* = 0) {
}
@@ -82,7 +82,7 @@ namespace Casts {
extern int i;
extern struct S {} s;
-
+
// CHECK-LABEL: define weak_odr void @_ZN5Casts8implicitILj4EEEvPN9enable_ifIXleT_Li4EEvE4typeE
template void implicit<4>(void*);
// CHECK-LABEL: define weak_odr void @_ZN5Casts6cstyleILj4EEEvPN9enable_ifIXleT_cvjLi4EEvE4typeE
@@ -169,7 +169,7 @@ namespace test2 {
}
namespace test3 {
- template <class T, class U> void a(T x, U y, decltype(x.*y) z) {}
+ template <class T, class U> void a(T x, U y, decltype(x.*y) z) {}
struct X {
int *member;
@@ -301,33 +301,33 @@ namespace test7 {
struct E { E(std::initializer_list<int>); };
struct F { F(E); };
- template<class T> decltype(A{1,2},T()) fA1(T t) {}
- template<class T> decltype(A({1,2}),T()) fA2(T t) {}
- template<class T> decltype(B{1,2},T()) fB1(T t) {}
- template<class T> decltype(B({1,2}),T()) fB2(T t) {}
- template<class T> decltype(C{{1,2}},T()) fC1(T t) {}
- template<class T> decltype(C({1,2}),T()) fC2(T t) {}
- template<class T> decltype(D{b},T()) fD1(T t) {}
- template<class T> decltype(D(b),T()) fD2(T t) {}
- template<class T> decltype(E{1,2},T()) fE1(T t) {}
- template<class T> decltype(E({1,2}),T()) fE2(T t) {}
- template<class T> decltype(F{{1,2}},T()) fF1(T t) {}
- template<class T> decltype(F({1,2}),T()) fF2(T t) {}
-
- template<class T> decltype(T{}) fT1(T t) {}
- template<class T> decltype(T()) fT2(T t) {}
- template<class T> decltype(T{1}) fT3(T t) {}
- template<class T> decltype(T(1)) fT4(T t) {}
- template<class T> decltype(T{1,2}) fT5(T t) {}
- template<class T> decltype(T(1,2)) fT6(T t) {}
- template<class T> decltype(T{{}}) fT7(T t) {}
- template<class T> decltype(T({})) fT8(T t) {}
- template<class T> decltype(T{{1}}) fT9(T t) {}
- template<class T> decltype(T({1})) fTA(T t) {}
- template<class T> decltype(T{{1,2}}) fTB(T t) {}
- template<class T> decltype(T({1,2})) fTC(T t) {}
-
- int main() {
+ template<class T> decltype(A{1,2},T()) fA1(T t) { return {}; }
+ template<class T> decltype(A({1,2}),T()) fA2(T t) { return {}; }
+ template<class T> decltype(B{1,2},T()) fB1(T t) { return {}; }
+ template<class T> decltype(B({1,2}),T()) fB2(T t) { return {}; }
+ template<class T> decltype(C{{1,2}},T()) fC1(T t) { return {}; }
+ template<class T> decltype(C({1,2}),T()) fC2(T t) { return {}; }
+ template<class T> decltype(D{b},T()) fD1(T t) { return {}; }
+ template<class T> decltype(D(b),T()) fD2(T t) { return {}; }
+ template<class T> decltype(E{1,2},T()) fE1(T t) { return {}; }
+ template<class T> decltype(E({1,2}),T()) fE2(T t) { return {}; }
+ template<class T> decltype(F{{1,2}},T()) fF1(T t) { return {}; }
+ template<class T> decltype(F({1,2}),T()) fF2(T t) { return {}; }
+
+ template<class T> decltype(T{}) fT1(T t) { return {}; }
+ template<class T> decltype(T()) fT2(T t) { return {}; }
+ template<class T> decltype(T{1}) fT3(T t) { return {}; }
+ template<class T> decltype(T(1)) fT4(T t) { return {}; }
+ template<class T> decltype(T{1,2}) fT5(T t) { return {}; }
+ template<class T> decltype(T(1,2)) fT6(T t) { return {}; }
+ template<class T> decltype(T{{}}) fT7(T t) { return {}; }
+ template<class T> decltype(T({})) fT8(T t) { return {}; }
+ template<class T> decltype(T{{1}}) fT9(T t) { return {}; }
+ template<class T> decltype(T({1})) fTA(T t) { return {}; }
+ template<class T> decltype(T{{1,2}}) fTB(T t) { return {}; }
+ template<class T> decltype(T({1,2})) fTC(T t) { return {}; }
+
+ void main() {
fA1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA1IiEEDTcmtlNS_1AELi1ELi2EEcvT__EES2_
fA2(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA2IiEEDTcmcvNS_1AEilLi1ELi2EEcvT__EES2_
fB1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fB1IiEEDTcmtlNS_1BELi1ELi2EEcvT__EES2_
diff --git a/clang/test/CodeGenCXX/mangle-variadic-templates.cpp b/clang/test/CodeGenCXX/mangle-variadic-templates.cpp
index 4a69c3d331d709..c2a01a62ac044f 100644
--- a/clang/test/CodeGenCXX/mangle-variadic-templates.cpp
+++ b/clang/test/CodeGenCXX/mangle-variadic-templates.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s
template<unsigned I, typename ...Types>
struct X { };
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp
index 0e88c546200f5d..c5b472670e8c05 100644
--- a/clang/test/CodeGenCXX/mangle.cpp
+++ b/clang/test/CodeGenCXX/mangle.cpp
@@ -839,7 +839,7 @@ namespace test36 {
template<unsigned> struct A { };
template<typename ...Types>
- auto f1(Types... values) -> A<sizeof...(values)> { }
+ auto f1(Types... values) -> A<sizeof...(values)> { return {}; }
// CHECK: define weak_odr {{.*}} @_ZN6test362f1IJifEEENS_1AIXsZfp_EEEDpT_
template A<2> f1(int, float);
diff --git a/clang/test/CodeGenCXX/matrix-type-operators.cpp b/clang/test/CodeGenCXX/matrix-type-operators.cpp
index 8854a718fb13ec..f6bb0636beac46 100644
--- a/clang/test/CodeGenCXX/matrix-type-operators.cpp
+++ b/clang/test/CodeGenCXX/matrix-type-operators.cpp
@@ -300,7 +300,7 @@ int test_extract_template(MyMatrix<int, 2, 2> Mat1) {
using double4x4 = double __attribute__((matrix_type(4, 4)));
template <class R, class C>
-auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) {}
+auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) { return {}; }
double test_matrix_subscript(double4x4 m) {
// CHECK-LABEL: @_Z21test_matrix_subscriptu11matrix_typeILm4ELm4EdE(
diff --git a/clang/test/CodeGenCXX/matrix-type.cpp b/clang/test/CodeGenCXX/matrix-type.cpp
index c3a299e7feee82..3764d188a991ec 100644
--- a/clang/test/CodeGenCXX/matrix-type.cpp
+++ b/clang/test/CodeGenCXX/matrix-type.cpp
@@ -166,19 +166,19 @@ template <int N>
struct selector {};
template <class T, unsigned long R, unsigned long C>
-selector<0> use_matrix(matrix<T, R, C> &m) {}
+selector<0> use_matrix(matrix<T, R, C> &m) { return {}; }
template <class T, unsigned long R>
-selector<1> use_matrix(matrix<T, R, 10> &m) {}
+selector<1> use_matrix(matrix<T, R, 10> &m) { return {}; }
template <class T>
-selector<2> use_matrix(matrix<T, 10, 10> &m) {}
+selector<2> use_matrix(matrix<T, 10, 10> &m) { return {}; }
template <class T, unsigned long C>
-selector<3> use_matrix(matrix<T, 10, C> &m) {}
+selector<3> use_matrix(matrix<T, 10, C> &m) { return {}; }
template <unsigned long R, unsigned long C>
-selector<4> use_matrix(matrix<float, R, C> &m) {}
+selector<4> use_matrix(matrix<float, R, C> &m) { return {}; }
void test_template_deduction() {
@@ -275,19 +275,19 @@ void test_auto_t() {
}
template <unsigned long R, unsigned long C>
-matrix<float, R + 1, C + 2> use_matrix_2(matrix<int, R, C> &m) {}
+matrix<float, R + 1, C + 2> use_matrix_2(matrix<int, R, C> &m) { return {}; }
template <unsigned long R, unsigned long C>
-selector<0> use_matrix_2(matrix<int, R + 2, C / 2> &m1, matrix<float, R, C> &m2) {}
+selector<0> use_matrix_2(matrix<int, R + 2, C / 2> &m1, matrix<float, R, C> &m2) { return {}; }
template <unsigned long R, unsigned long C>
-selector<1> use_matrix_2(matrix<int, R + C, C> &m1, matrix<float, R, C - R> &m2) {}
+selector<1> use_matrix_2(matrix<int, R + C, C> &m1, matrix<float, R, C - R> &m2) { return {}; }
template <unsigned long R>
-matrix<float, R + R, R - 3> use_matrix_2(matrix<int, R, 10> &m1) {}
+matrix<float, R + R, R - 3> use_matrix_2(matrix<int, R, 10> &m1) { return {}; }
template <unsigned long R>
-selector<2> use_matrix_3(matrix<int, R - 2, R> &m) {}
+selector<2> use_matrix_3(matrix<int, R - 2, R> &m) { return {}; }
void test_use_matrix_2() {
// CHECK-LABEL: define{{.*}} void @_Z17test_use_matrix_2v()
diff --git a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
index fa7670c7448145..55dc71a009857c 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
@@ -194,6 +194,7 @@ inline int switch_test(int x) {
return b + c++;
}
};
+ return 0;
}
int f();
diff --git a/clang/test/CodeGenCXX/new-alias.cpp b/clang/test/CodeGenCXX/new-alias.cpp
index 5310d47297bbdf..ced44097e9b3dd 100644
--- a/clang/test/CodeGenCXX/new-alias.cpp
+++ b/clang/test/CodeGenCXX/new-alias.cpp
@@ -3,6 +3,7 @@
using size_t = decltype(sizeof(0));
extern "C" char *something(long long x) {
+ return nullptr;
}
// CHECK: @_Znwm ={{.*}} alias ptr (i64), ptr @something
diff --git a/clang/test/CodeGenCXX/nrvo.cpp b/clang/test/CodeGenCXX/nrvo.cpp
index b4103297b02fea..1141bc35de5824 100644
--- a/clang/test/CodeGenCXX/nrvo.cpp
+++ b/clang/test/CodeGenCXX/nrvo.cpp
@@ -1,7 +1,7 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++03 -o - %s | FileCheck --check-prefixes=CHECK-EH-03 %s
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++11 -DCXX11 -o - %s | FileCheck --check-prefixes=CHECK-EH-11 %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++03 -o - %s | FileCheck --check-prefixes=CHECK-EH-03 %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++11 -DCXX11 -o - %s | FileCheck --check-prefixes=CHECK-EH-11 %s
// Test code generation for the named return value optimization.
class X {
@@ -603,7 +603,6 @@ X test4(bool B) {
return x; // NRVO happens
}
exit(1);
- __builtin_unreachable(); // for -Wreturn-type
}
#ifdef __EXCEPTIONS
@@ -1084,7 +1083,6 @@ X test8(bool b) {
//
Y<int> test9() {
Y<int>::f();
- __builtin_unreachable(); // for -Wreturn-type
}
// CHECK-LABEL: @_Z6test10b(
diff --git a/clang/test/CodeGenCXX/template-instantiation.cpp b/clang/test/CodeGenCXX/template-instantiation.cpp
index 8453bcefc7ebbf..9eea5dfac8a35b 100644
--- a/clang/test/CodeGenCXX/template-instantiation.cpp
+++ b/clang/test/CodeGenCXX/template-instantiation.cpp
@@ -119,7 +119,7 @@ namespace test3 {
struct S {
virtual void m();
};
-
+
template<typename T>
void S<T>::m() { }
@@ -140,7 +140,7 @@ namespace test4 {
B b;
}
- unsigned test() {
+ void test() {
A<int>::foo();
}
}
diff --git a/clang/test/CodeGenCXX/trap-fnattr.cpp b/clang/test/CodeGenCXX/trap-fnattr.cpp
index 21422bc94f6fbe..ed7162fc43a6c0 100644
--- a/clang/test/CodeGenCXX/trap-fnattr.cpp
+++ b/clang/test/CodeGenCXX/trap-fnattr.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC
-// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION
+// RUN: %clang_cc1 -O0 -emit-llvm -Wno-error=return-type -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC
+// RUN: %clang_cc1 -O0 -emit-llvm -Wno-error=return-type -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION
// TRAPFUNC-LABEL: define {{(dso_local )?}}void @{{_Z12test_builtinv|\"\?test_builtin@@YAXXZ\"}}
// TRAPFUNC: call void @llvm.trap() [[ATTR0:#[0-9]+]]
diff --git a/clang/test/CodeGenObjC/2008-11-25-Blocks.m b/clang/test/CodeGenObjC/2008-11-25-Blocks.m
index f0be6de338980b..60615f78a049b9 100644
--- a/clang/test/CodeGenObjC/2008-11-25-Blocks.m
+++ b/clang/test/CodeGenObjC/2008-11-25-Blocks.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -emit-llvm %s -o /dev/null
+// RUN: %clang_cc1 -Wno-error=return-type -fblocks -emit-llvm %s -o /dev/null
@interface bork
- (id)B:(void (^)(void))blk;
diff --git a/clang/test/CodeGenObjC/debug-info-crash.m b/clang/test/CodeGenObjC/debug-info-crash.m
index de2bc0048b6a51..ac2dc23ed9c63b 100644
--- a/clang/test/CodeGenObjC/debug-info-crash.m
+++ b/clang/test/CodeGenObjC/debug-info-crash.m
@@ -36,6 +36,6 @@ + (void)initialize {
}
+ (NSAttributedString *)attributedStringWithString:(id)string image:(NSImage *)image {
NSMutableAttributedString *attrStr;
- return nullptr;
+ return 0;
}
@end
diff --git a/clang/test/CodeGenObjC/encode-test.m b/clang/test/CodeGenObjC/encode-test.m
index 78a70a00e072e8..548e6097fba433 100644
--- a/clang/test/CodeGenObjC/encode-test.m
+++ b/clang/test/CodeGenObjC/encode-test.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
// RUN: FileCheck < %t %s
//
// CHECK: @OBJC_METH_VAR_TYPE_{{.*}} = private unnamed_addr constant [16 x i8] c"v12 at 0:4[3[4@]]8\00"
@@ -49,7 +49,7 @@ @implementation Base
@implementation Derived
@end
- at interface B1
+ at interface B1
{
struct objc_class *isa;
Int1 *sBase;
@@ -60,12 +60,12 @@ @interface B1
@implementation B1
@end
- at interface Test
+ at interface Test
{
int ivar;
__attribute__((objc_gc(weak))) SEL selector;
}
--(void) test3: (Test* [3] [4])b ;
+-(void) test3: (Test* [3] [4])b ;
- (SEL**) meth : (SEL) arg : (SEL*****) arg1 : (SEL*)arg2 : (SEL**) arg3;
@end
@@ -119,14 +119,14 @@ @interface Base1X {
int b: 3;
enum Enum1X c: 4;
unsigned d: 5;
-}
+}
@end
@interface Derived1X: Base1X {
signed e: 5;
int f: 4;
enum Enum1X g: 3;
-}
+}
@end
@implementation Base1X @end
diff --git a/clang/test/CodeGenObjC/metadata-symbols-32.m b/clang/test/CodeGenObjC/metadata-symbols-32.m
index 825b2c61c55dff..c3ef7a5f9b9701 100644
--- a/clang/test/CodeGenObjC/metadata-symbols-32.m
+++ b/clang/test/CodeGenObjC/metadata-symbols-32.m
@@ -53,7 +53,7 @@ -(void) im0;
@interface A<P> {
int _ivar;
}
-
+
@property (assign) int ivar;
+(void) fm0;
@@ -80,7 +80,7 @@ @interface J0
@implementation J0(Category) @end
-void *f0(void) {
+void f0(void) {
[B im0];
[C im1];
}
diff --git a/clang/test/CodeGenObjC/metadata-symbols-64.m b/clang/test/CodeGenObjC/metadata-symbols-64.m
index 96a79470bfdde4..bbea131018f2b9 100644
--- a/clang/test/CodeGenObjC/metadata-symbols-64.m
+++ b/clang/test/CodeGenObjC/metadata-symbols-64.m
@@ -58,7 +58,7 @@ -(void) im0;
@interface A<P> {
int _ivar;
}
-
+
@property (assign) int ivar;
+(void) fm0;
@@ -93,7 +93,7 @@ -(void) im2 {
@end
// Test for FP dispatch method APIs
- at interface Example
+ at interface Example
@end
float FLOAT;
@@ -116,7 +116,7 @@ - (long double) RET_LONGDOUBLE
}
@end
-void *f0(id x) {
+void f0(id x) {
Example* pe;
double dd = [pe RET_DOUBLE];
dd = [pe RET_FLOAT];
diff --git a/clang/test/CodeGenObjC/objc2-weak-compare.m b/clang/test/CodeGenObjC/objc2-weak-compare.m
index 093a78abc48921..76ad06ee946f5a 100644
--- a/clang/test/CodeGenObjC/objc2-weak-compare.m
+++ b/clang/test/CodeGenObjC/objc2-weak-compare.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
-// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
+// RUN: %clang_cc1 -Wno-error=return-type -x objective-c++ -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
- at interface PBXTarget
+ at interface PBXTarget
{
PBXTarget * __weak _lastKnownTarget;
diff --git a/clang/test/CodeGenObjC/strong-in-c-struct.m b/clang/test/CodeGenObjC/strong-in-c-struct.m
index d7febd27412179..36f50aa98561b1 100644
--- a/clang/test/CodeGenObjC/strong-in-c-struct.m
+++ b/clang/test/CodeGenObjC/strong-in-c-struct.m
@@ -819,10 +819,10 @@ id test_conditional0(int c) {
return (c ? g2 : g1).f1;
}
-// CHECK-LABEL: define{{.*}} ptr @test_conditional1(
+// CHECK-LABEL: define{{.*}} void @test_conditional1(
// CHECK-NOT: call void @__destructor
-id test_conditional1(int c) {
+void test_conditional1(int c) {
calleeStrongSmall(c ? g2 : g1);
}
@@ -836,10 +836,10 @@ id test_assignment0(void) {
return (g2 = g1).f1;
}
-// CHECK-LABEL: define{{.*}} ptr @test_assignment1(
+// CHECK-LABEL: define{{.*}} void @test_assignment1(
// CHECK-NOT: call void @__destructor
-id test_assignment1(void) {
+void test_assignment1(void) {
calleeStrongSmall(g2 = g1);
}
diff --git a/clang/test/CodeGenObjCXX/debug-info-line.mm b/clang/test/CodeGenObjCXX/debug-info-line.mm
index bb6eaa50d7cca3..9f543dbaf962d5 100644
--- a/clang/test/CodeGenObjCXX/debug-info-line.mm
+++ b/clang/test/CodeGenObjCXX/debug-info-line.mm
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-tables-only -fblocks -emit-llvm %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-directives-only -fblocks -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-tables-only -fblocks -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-directives-only -fblocks -emit-llvm %s -o - | FileCheck %s
void fn();
diff --git a/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm b/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm
index cfc6d78b6b8880..3e7d544c8f43c4 100644
--- a/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm
+++ b/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm
@@ -1,7 +1,7 @@
// PR 14474
-// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \
+// RUN: %clang_cc1 -Wno-error=return-type -triple i386-apple-macosx10.6.0 -emit-llvm \
// RUN: -debug-info-kind=line-tables-only -x objective-c++ -o /dev/null %s
-// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \
+// RUN: %clang_cc1 -Wno-error=return-type -triple i386-apple-macosx10.6.0 -emit-llvm \
// RUN: -debug-info-kind=line-directives-only -x objective-c++ -o /dev/null %s
typedef signed char BOOL;
@@ -9,9 +9,9 @@
@protocol NSObject - (BOOL)isEqual:(id)object;
@end
@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder;
- at end
+ at end
@interface NSObject <NSObject> { }
- at end
+ at end
@interface NSResponder : NSObject <NSCoding> { }
@end
@protocol NSValidatedUserInterfaceItem - (SEL)action;
diff --git a/clang/test/CodeGenObjCXX/property-dot-reference.mm b/clang/test/CodeGenObjCXX/property-dot-reference.mm
index 245aa4176c7df9..1bd67424d4c066 100644
--- a/clang/test/CodeGenObjCXX/property-dot-reference.mm
+++ b/clang/test/CodeGenObjCXX/property-dot-reference.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
struct TFENode {
void GetURL() const;
@@ -8,7 +8,7 @@ @interface TNodeIconAndNameCell
- (const TFENode&) node;
@end
- at implementation TNodeIconAndNameCell
+ at implementation TNodeIconAndNameCell
- (const TFENode&) node {
// CHECK: call noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) ptr @objc_msgSend
// CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(ptr {{[^,]*}} %{{.*}})
@@ -41,8 +41,8 @@ - (double) myGetter;
@end
void test2() {
Test2 *obj;
- (void) obj.myProperty;
- (void) obj.myGetter;
+ (void) obj.myProperty;
+ (void) obj.myGetter;
static_cast<void>(obj.myProperty);
static_cast<void>(obj.myGetter);
void(obj.myProperty);
diff --git a/clang/test/CodeGenObjCXX/return.mm b/clang/test/CodeGenObjCXX/return.mm
index fb77f336dfc00a..c544e541319080 100644
--- a/clang/test/CodeGenObjCXX/return.mm
+++ b/clang/test/CodeGenObjCXX/return.mm
@@ -1,6 +1,6 @@
/// -fstrict-return is the default.
-// RUN: %clang_cc1 -emit-llvm -fblocks -triple x86_64-apple-darwin -o - %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -fblocks -triple x86_64-apple-darwin -O -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -fblocks -triple x86_64-apple-darwin -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -fblocks -triple x86_64-apple-darwin -O -o - %s | FileCheck %s
@interface I
@end
diff --git a/clang/test/CoverageMapping/switch.cpp b/clang/test/CoverageMapping/switch.cpp
index db4cddbc6b9415..1d44e7adeee4c1 100644
--- a/clang/test/CoverageMapping/switch.cpp
+++ b/clang/test/CoverageMapping/switch.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name switch.cpp %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name switch.cpp %s | FileCheck %s
// CHECK: foo
void foo(int i) { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+11]]:2 = #0
diff --git a/clang/test/Frontend/absolute-paths.c b/clang/test/Frontend/absolute-paths.c
index 8a9687195c36b5..f47f0e6372c570 100644
--- a/clang/test/Frontend/absolute-paths.c
+++ b/clang/test/Frontend/absolute-paths.c
@@ -12,11 +12,11 @@
// directory in the path.
// NORMAL: SystemHeaderPrefix
// ABSOLUTE-NOT: SystemHeaderPrefix
-// CHECK: warning: non-void function does not return a value
+// CHECK: warning: declaration does not declare anything
// For files which don't exist, just print the filename.
#line 123 "non-existant.c"
-int g(void) {}
-// NORMAL: non-existant.c:123:14: warning: non-void function does not return a value
-// ABSOLUTE: non-existant.c:123:14: warning: non-void function does not return a value
+void g(void) { int; }
+// NORMAL: non-existant.c:123:17: warning: declaration does not declare anything
+// ABSOLUTE: non-existant.c:123:17: warning: declaration does not declare anything
diff --git a/clang/test/Frontend/ast-codegen.c b/clang/test/Frontend/ast-codegen.c
index 53721a463217fe..2e2e3d360dd177 100644
--- a/clang/test/Frontend/ast-codegen.c
+++ b/clang/test/Frontend/ast-codegen.c
@@ -8,6 +8,6 @@ __asm__("foo");
// CHECK: @g0 = dso_local global i32 0, align 4
int g0;
-// CHECK: define dso_local i32 @f0()
-int f0(void) {
+// CHECK: define dso_local void @f0()
+void f0(void) {
}
diff --git a/clang/test/Frontend/ast-main.cpp b/clang/test/Frontend/ast-main.cpp
index e6e2825bb332a5..fe47ce435f0683 100644
--- a/clang/test/Frontend/ast-main.cpp
+++ b/clang/test/Frontend/ast-main.cpp
@@ -1,6 +1,6 @@
-// RUN: env SDKROOT="/" %clang -emit-llvm -S -o %t1.ll -x c++ - < %s
-// RUN: env SDKROOT="/" %clang -fno-delayed-template-parsing -emit-ast -o %t.ast %s
-// RUN: env SDKROOT="/" %clang -emit-llvm -S -o %t2.ll -x ast - < %t.ast
+// RUN: env SDKROOT="/" %clang -Wno-error=return-type -emit-llvm -S -o %t1.ll -x c++ - < %s
+// RUN: env SDKROOT="/" %clang -Wno-error=return-type -fno-delayed-template-parsing -emit-ast -o %t.ast %s
+// RUN: env SDKROOT="/" %clang -Wno-error=return-type -emit-llvm -S -o %t2.ll -x ast - < %t.ast
// RUN: diff %t1.ll %t2.ll
// http://llvm.org/bugs/show_bug.cgi?id=15377
diff --git a/clang/test/Modules/redecl-merge.m b/clang/test/Modules/redecl-merge.m
index 746be5ec4e774e..d2a2490572610a 100644
--- a/clang/test/Modules/redecl-merge.m
+++ b/clang/test/Modules/redecl-merge.m
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -Wreturn-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -Wno-error=return-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class
@class C2;
@class C3;
diff --git a/clang/test/PCH/irgen-rdar13114142.mm b/clang/test/PCH/irgen-rdar13114142.mm
index d3687637eefab2..2257587290d7ce 100644
--- a/clang/test/PCH/irgen-rdar13114142.mm
+++ b/clang/test/PCH/irgen-rdar13114142.mm
@@ -20,11 +20,13 @@
public:
OOArray matchAll(const OOString &)const {
__attribute__((__blocks__(byref))) OOArray out;
+ return {};
}
};
OOArray operator & (const OOPattern & pattern) {
pattern.matchAll(0);
+ return {};
}
OOArray operator & (OOString, OOString);
diff --git a/clang/test/PCH/late-parsed-instantiations.cpp b/clang/test/PCH/late-parsed-instantiations.cpp
index dd54f647a6541b..080be09f6748cb 100644
--- a/clang/test/PCH/late-parsed-instantiations.cpp
+++ b/clang/test/PCH/late-parsed-instantiations.cpp
@@ -1,12 +1,12 @@
-// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -emit-pch %s -o %t.pch -verify
-// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify
+// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -emit-pch %s -o %t.pch -verify
+// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify
-// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify
-// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify
+// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify
+// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify
// Run this test for i686 as this is the target that modifies default FP options.
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify
+// RUN: %clang_cc1 -Wno-error=return-type -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify
+// RUN: %clang_cc1 -Wno-error=return-type -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify
#ifndef HEADER_INCLUDED
@@ -27,9 +27,8 @@ class ArrayBuffer {
char data() {
visit([](auto buffer) -> char { // expected-note {{in instantiation}}
buffer->data();
- }); // expected-error {{non-void lambda does not return a value}}
- return 0;
- }
+ }); // expected-warning {{non-void lambda does not return a value}}
+ } // expected-warning {{non-void function does not return a value}}
};
#else
diff --git a/clang/test/PCH/pr4489.c b/clang/test/PCH/pr4489.c
index 574e33f18c0d7b..a8f686ca445756 100644
--- a/clang/test/PCH/pr4489.c
+++ b/clang/test/PCH/pr4489.c
@@ -1,6 +1,6 @@
-// RUN: %clang -x c-header -o %t.pch %s
+// RUN: %clang -Wno-error=return-type -x c-header -o %t.pch %s
// RUN: echo > %t.empty.c
-// RUN: %clang -include %t -x c %t.empty.c -emit-llvm -S -o -
+// RUN: %clang -Wno-error=return-type -include %t -x c %t.empty.c -emit-llvm -S -o -
// PR 4489: Crash with PCH
// PR 4492: Crash with PCH (round two)
diff --git a/clang/test/PCH/va_arg.c b/clang/test/PCH/va_arg.c
index 2bbf3c5ebd75a3..44a7d2b8ba5b6d 100644
--- a/clang/test/PCH/va_arg.c
+++ b/clang/test/PCH/va_arg.c
@@ -10,10 +10,12 @@ char *g0(char** argv, int argc) { return argv[argc]; }
char *g(char **argv) {
f(g0, argv, 1, 2, 3);
+ return argv[0];
}
char *i0(char **argv, int argc) { return argv[argc]; }
char *i(char **argv) {
h(i0, argv, 1, 2, 3);
+ return argv[0];
}
diff --git a/clang/test/Sema/freemain.c b/clang/test/Sema/freemain.c
index 99bfd023620978..8d18014c58c5a7 100644
--- a/clang/test/Sema/freemain.c
+++ b/clang/test/Sema/freemain.c
@@ -6,5 +6,4 @@ void* allocate(long size);
void* main(void* context, long size) {
if (context) return allocate(size);
- return 0;
-} // expected-warning {{non-void function does not return a value in all control paths}}
+} // expected-error {{non-void function does not return a value in all control paths}}
diff --git a/clang/test/Sema/return-type-mismatch.c b/clang/test/Sema/return-type-mismatch.c
index 79a625d7df1f54..09347d188aa54c 100644
--- a/clang/test/Sema/return-type-mismatch.c
+++ b/clang/test/Sema/return-type-mismatch.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wreturn-type -Wno-return-mismatch -fsyntax-only -verify=return-type %s
+// RUN: %clang_cc1 -Wno-error=return-type -Wno-return-mismatch -fsyntax-only -verify=return-type %s
// RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify=return-mismatch %s
int foo(void) __attribute__((noreturn));
@@ -8,17 +8,17 @@ void test1(void) {
return 1; // return-mismatch-warning{{void function 'test1' should not return a value}}
}
-int test2(void) {
+int test2(void) {
return; // return-mismatch-warning{{non-void function 'test2' should return a value}}
-}
+}
-int test3(void) {
+int test3(void) {
// return-type-warning at +1 {{non-void function does not return a value}}
-}
+}
int test4(void) {
(void)(bar() || foo()); // return-type-warning at +1 {{non-void function does not return a value in all control paths}}
-}
+}
void test5(void) {
} // no-warning
diff --git a/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp b/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp
index e3228dddef5f66..713ba90a003494 100644
--- a/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp
+++ b/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++23 -fsyntax-only -Wimplicit-fallthrough -Wconsumed -verify %s
+// RUN: %clang_cc1 -Wno-error=return-type -std=c++23 -fsyntax-only -Wimplicit-fallthrough -Wconsumed -verify %s
constexpr int f() { } // expected-warning {{non-void function does not return a value}}
static_assert(__is_same(decltype([] constexpr -> int { }( )), int)); // expected-warning {{non-void lambda does not return a value}}
diff --git a/clang/test/SemaCXX/err-missing-noreturn-2.cpp b/clang/test/SemaCXX/err-missing-noreturn-2.cpp
index 6f0bf85d0213cc..b1888fbb33ccf2 100644
--- a/clang/test/SemaCXX/err-missing-noreturn-2.cpp
+++ b/clang/test/SemaCXX/err-missing-noreturn-2.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn -Wreturn-type
+// expected-no-diagnostics
namespace GH63009 {
struct S1 {
@@ -10,5 +11,5 @@ int foo();
int test_1() {
S1 s1;
foo();
-} // expected-error{{non-void function does not return a value}}
+}
}
diff --git a/clang/test/SemaCXX/return-noreturn.cpp b/clang/test/SemaCXX/return-noreturn.cpp
index b88e5a519d1bb0..873e4c7e12f23b 100644
--- a/clang/test/SemaCXX/return-noreturn.cpp
+++ b/clang/test/SemaCXX/return-noreturn.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
-// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -std=c++11 -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
+// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -verify -Wreturn-type -Wno-error=return-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
+// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -std=c++11 -verify -Wreturn-type -Wno-error=return-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
// A destructor may be marked noreturn and should still influence the CFG.
void pr6884_abort() __attribute__((noreturn));
diff --git a/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp b/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp
index 1484f7e9d36c2a..9f0ce72ef6a55f 100644
--- a/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp
+++ b/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp
@@ -11,7 +11,7 @@ void add_assign_test(unsigned int n, int *a, int y) {
p += 2;
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:7}:"p = p.subspan("
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:9-[[@LINE-2]]:9}:")"
-
+
int *r = p;
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:8}:"std::span<int> "
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:12-[[@LINE-2]]:12}:"{"
@@ -23,7 +23,7 @@ void add_assign_test(unsigned int n, int *a, int y) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:5-[[@LINE-1]]:9}:"r = r.subspan("
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:11}:")"
}
-
+
if (*p == 0) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:8}:""
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:9-[[@LINE-2]]:9}:"[0]"
@@ -31,29 +31,29 @@ void add_assign_test(unsigned int n, int *a, int y) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:5-[[@LINE-1]]:9}:"p = p.subspan("
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:11}:")"
}
-
+
if (*p == 1)
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:8}:""
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:9-[[@LINE-2]]:9}:"[0]"
p += 3;
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:5-[[@LINE-1]]:9}:"p = p.subspan("
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:11}:")"
-
+
a += -9;
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:5-[[@LINE-1]]:9}:"p = p.subspan("
-
+
a += y;
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:5-[[@LINE-1]]:9}:"p = p.subspan("
}
-int expr_test(unsigned x, int *q, int y) {
+void expr_test(unsigned x, int *q, int y) {
char *p = new char[8];
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:9}:"std::span<char> "
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:13-[[@LINE-2]]:13}:"{"
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:24-[[@LINE-3]]:24}:", 8}"
p += (x + 1);
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:7}:"p = p.subspan"
-
+
q += (y + 7);
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:7}:"q = q.subspan"
}
diff --git a/clang/test/SemaObjC/return-noreturn.m b/clang/test/SemaObjC/return-noreturn.m
index c7735ca211e6d1..32da51f1ca1b08 100644
--- a/clang/test/SemaObjC/return-noreturn.m
+++ b/clang/test/SemaObjC/return-noreturn.m
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -fsyntax-only -fobjc-exceptions -verify -Wreturn-type -Wmissing-noreturn
id f(id self) {
-} // expected-warning {{non-void function does not return a value}}
+} // expected-error {{non-void function does not return a value}}
id f2(id self) {
@try {
diff --git a/clang/test/SemaObjC/try-catch.m b/clang/test/SemaObjC/try-catch.m
index 0bea7a5150a498..bd607ac63fda22 100644
--- a/clang/test/SemaObjC/try-catch.m
+++ b/clang/test/SemaObjC/try-catch.m
@@ -34,7 +34,7 @@ - (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NS
@try {}
// the exception name is optional (weird)
@catch (NSException *) {}
-} // expected-warning {{non-void function does not return a value}}
+} // expected-error {{non-void function does not return a value}}
- (NSDictionary *)anotherFunction {
@try {}
diff --git a/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp b/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp
index 0e654768787aae..90f4d3261c5a28 100644
--- a/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp
+++ b/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++14 -verify %s
+// RUN: %clang_cc1 -Wno-error=return-type -std=c++14 -verify %s
// pr33561
class ArrayBuffer;
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index 75d6ca5ba17f8b..068cf667710279 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -665,6 +665,7 @@ void check_match_co_return() {
#include <coro_header>
void check_match_co_await() {
co_await a;
+ co_return 1;
}
)cpp";
EXPECT_TRUE(matchesConditionally(CoAwaitCode,
@@ -674,6 +675,7 @@ void check_match_co_await() {
#include <coro_header>
void check_match_co_yield() {
co_yield 1.0;
+ co_return 1;
}
)cpp";
EXPECT_TRUE(matchesConditionally(CoYieldCode,
@@ -714,7 +716,7 @@ void coro() {
void coro() try {
int thevar;
co_return 1;
-} catch (...) {}
+} catch (...) { co_return 1; }
)cpp";
EXPECT_TRUE(matchesConditionally(
CoroWithTryCatchDeclCode,
>From a3d6404b4d0ecf1f355e01ba52891baf1465b139 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Sat, 18 Jan 2025 16:15:54 +0100
Subject: [PATCH 3/4] Fix the remaining tests
---
clang/test/ARCMT/autoreleases.m | 2 +-
clang/test/ARCMT/autoreleases.m.result | 2 +-
clang/test/ARCMT/retains.m | 2 +-
clang/test/ARCMT/retains.m.result | 4 +-
.../expected-plists/plist-output.m.plist | 2 +-
...ceiver-undefined-larger-than-voidptr-ret.m | 34 ++++++------
clang/test/Analysis/plist-output.m | 2 +-
.../expr/expr.prim/expr.prim.lambda/p5.cpp | 10 ++--
.../expr/expr.prim/expr.prim.lambda/p7.cpp | 8 +--
clang/test/CodeGen/arm-cmse-secure.c | 2 +-
clang/test/CodeGen/sret.c | 2 +-
clang/test/CodeGen/ubsan-debuglog-return.c | 2 +-
clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp | 2 +-
.../CodeGenCXX/array-value-initialize.cpp | 10 ++--
clang/test/CodeGenCXX/mangle-exprs.cpp | 52 +++++++++----------
.../test/CodeGenCXX/matrix-type-operators.cpp | 6 ++-
clang/test/CodeGenCXX/matrix-type.cpp | 22 ++++----
clang/test/CodeGenCXX/new-alias.cpp | 2 +-
.../FixIt/fixit-availability-maccatalyst.m | 2 +-
clang/test/FixIt/fixit-c++11.cpp | 2 +-
clang/test/Frontend/absolute-paths.c | 12 ++---
clang/test/Misc/serialized-diags-stable.c | 4 +-
clang/test/PCH/va_arg.h | 2 +
clang/test/SemaCXX/attr-noreturn.cpp | 4 +-
24 files changed, 99 insertions(+), 93 deletions(-)
diff --git a/clang/test/ARCMT/autoreleases.m b/clang/test/ARCMT/autoreleases.m
index 4c268c09a715c6..7c046dc227a068 100644
--- a/clang/test/ARCMT/autoreleases.m
+++ b/clang/test/ARCMT/autoreleases.m
@@ -69,7 +69,7 @@ id test2(A* val) {
return val;
}
-id test3(void) {
+void test3(void) {
id a = [[A alloc] init];
[a autorelease];
}
diff --git a/clang/test/ARCMT/autoreleases.m.result b/clang/test/ARCMT/autoreleases.m.result
index b3aad804a45be6..29d00ea60deed8 100644
--- a/clang/test/ARCMT/autoreleases.m.result
+++ b/clang/test/ARCMT/autoreleases.m.result
@@ -64,6 +64,6 @@ id test2(A* val) {
return val;
}
-id test3(void) {
+void test3(void) {
id a = [[A alloc] init];
}
diff --git a/clang/test/ARCMT/retains.m b/clang/test/ARCMT/retains.m
index c5d54650a5182f..df1badf214b692 100644
--- a/clang/test/ARCMT/retains.m
+++ b/clang/test/ARCMT/retains.m
@@ -21,7 +21,7 @@ @implementation Foo
@synthesize bar;
--(id)something { return 0; }
+-(id)something { return (id)0; }
-(id)test:(id)obj {
id x = self.bar;
diff --git a/clang/test/ARCMT/retains.m.result b/clang/test/ARCMT/retains.m.result
index 4e720d6bb4c112..211c4b50f53519 100644
--- a/clang/test/ARCMT/retains.m.result
+++ b/clang/test/ARCMT/retains.m.result
@@ -21,7 +21,7 @@ id IhaveSideEffect(void);
@synthesize bar;
--(id)something {}
+-(id)something { return (id)0; }
-(id)test:(id)obj {
id x = self.bar;
@@ -39,7 +39,7 @@ id IhaveSideEffect(void);
// do stuff with x;
return self;
}
-
+
- (id)test1 {
id x=0;
return (((x)));
diff --git a/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist b/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist
index 32244329c434aa..8b8cc3239bd4bd 100644
--- a/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist
+++ b/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist
@@ -6151,7 +6151,7 @@
<key>type</key><string>Argument with 'nonnull' attribute passed null</string>
<key>check_name</key><string>core.NonNullParamChecker</string>
<!-- This hash is experimental and going to change! -->
- <key>issue_hash_content_of_line_in_context</key><string>c0b359a043c633f1b8d1581f68743361</string>
+ <key>issue_hash_content_of_line_in_context</key><string>4c580a2a9cf15947fa485a0a9e625306</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>RDar13295437</string>
<key>issue_hash_function_offset</key><string>3</string>
diff --git a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
index bfc3cb92b639af..0dfeb298db7426 100644
--- a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
+++ b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
@@ -1,8 +1,8 @@
-// RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1
+// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1
// RUN: FileCheck -input-file=%t.1 -check-prefix=CHECK-darwin8 %s
-// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1
+// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1
// RUN: FileCheck -input-file=%t.2 -check-prefix=CHECK-darwin9 %s
-// RUN: %clang_analyze_cc1 -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1
+// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1
// RUN: FileCheck -input-file=%t.3 -check-prefix=CHECK-darwin9 %s
@interface MyClass {}
@@ -25,53 +25,53 @@ - (void)voidM {}
@end
void createFoo(void) {
- MyClass *obj = 0;
-
+ MyClass *obj = 0;
+
void *v = [obj voidPtrM]; // no-warning
int i = [obj intM]; // no-warning
}
void createFoo2(void) {
- MyClass *obj = 0;
-
+ MyClass *obj = 0;
+
long double ld = [obj longDoubleM];
}
void createFoo3(void) {
MyClass *obj;
- obj = 0;
-
+ obj = 0;
+
long long ll = [obj longlongM];
}
void createFoo4(void) {
- MyClass *obj = 0;
-
+ MyClass *obj = 0;
+
double d = [obj doubleM];
}
void createFoo5(void) {
- MyClass *obj = (id)@"";
-
+ MyClass *obj = (id)@"";
+
double d = [obj doubleM]; // no-warning
}
void createFoo6(void) {
MyClass *obj;
- obj = 0;
-
+ obj = 0;
+
unsigned long long ull = [obj unsignedLongLongM];
}
void handleNilPruneLoop(MyClass *obj) {
if (!!obj)
return;
-
+
// Test if [obj intM] evaluates to 0, thus pruning the entire loop.
for (int i = 0; i < [obj intM]; i++) {
long long j = [obj longlongM];
}
-
+
long long j = [obj longlongM];
}
diff --git a/clang/test/Analysis/plist-output.m b/clang/test/Analysis/plist-output.m
index e7f2c9e441775a..b89aab0a7c4cfd 100644
--- a/clang/test/Analysis/plist-output.m
+++ b/clang/test/Analysis/plist-output.m
@@ -177,7 +177,7 @@ - (void)test {
struct RDar13295437_S { int *i; };
-void RDar13295437(void) {
+void RDar13295437(void) {
struct RDar13295437_S s = {0};
struct RDar13295437_S *sp = &s;
RDar13295437_f(sp->i);
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
index 2a99ff0ea44f90..a07ee2213ce40c 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
+++ b/clang/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{{on-void lambda does not return a value in all control paths}}
+ auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-error{{non-void lambda does not return a value in all control paths}}
// FIXME: GCC accepts the [[gnu::noreturn]] attribute here.
auto nrl2 = []() [[gnu::noreturn]] { return; }; // expected-warning{{attribute 'noreturn' ignored}}
@@ -25,7 +25,7 @@ void test_quals() {
lc();
auto ml = [=]() mutable{}; // expected-note{{method is not marked const}} \
- // expected-note{{method is not marked volatile}}
+ // expected-note{{method is not marked volatile}}
const decltype(ml) mlc = ml;
ml();
mlc(); // expected-error{{no matching function for call to object of type}}
@@ -56,8 +56,8 @@ void test_exception_spec() {
auto ntl1 = []() throw() {};
auto ntl2 = []() noexcept(true) {};
auto ntl3 = []() noexcept {};
- static_assert(noexcept(ntl1()), "lambda cannot throw");
- static_assert(noexcept(ntl2()), "lambda cannot throw");
- static_assert(noexcept(ntl3()), "lambda cannot throw");
+ static_assert(noexcept(ntl1()), "lambda cannot throw");
+ static_assert(noexcept(ntl2()), "lambda cannot throw");
+ static_assert(noexcept(ntl3()), "lambda cannot throw");
}
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
index 73714f1a947a10..3b1cb055ea6c2d 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
+++ b/clang/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{{non-void lambda does not return a value}}
+ (void)[]() -> int { }; // expected-error{{non-void lambda does not return a value}}
}
// Check that we get the right types of captured variables (the
@@ -14,12 +14,12 @@ void test_capture_constness(int i, const int ic) {
(void)[i,ic] ()->void {
float &fr1 = check_const_int(i);
float &fr2 = check_const_int(ic);
- };
+ };
(void)[=] ()->void {
float &fr1 = check_const_int(i);
float &fr2 = check_const_int(ic);
- };
+ };
(void)[i,ic] () mutable ->void {
int &ir = check_const_int(i);
@@ -51,6 +51,6 @@ struct S1 {
[&]()->int {
S1 &s1 = operator=(&this->x);
return operator()(this->x + y);
- }();
+ }();
}
};
diff --git a/clang/test/CodeGen/arm-cmse-secure.c b/clang/test/CodeGen/arm-cmse-secure.c
index ec66f4f6fa6481..305d25ad7388c5 100644
--- a/clang/test/CodeGen/arm-cmse-secure.c
+++ b/clang/test/CodeGen/arm-cmse-secure.c
@@ -54,7 +54,7 @@ typedef struct {
} Point;
void test_pointed_object(void *p) {
-// CHECK: define {{.*}} ptr @test_pointed_object
+// CHECK: define {{.*}} void @test_pointed_object
Point *pt = (Point *)p;
cmse_check_pointed_object(pt, CMSE_NONSECURE
| CMSE_MPU_READ
diff --git a/clang/test/CodeGen/sret.c b/clang/test/CodeGen/sret.c
index f12a7fdfd5ace9..83dce80aa279b4 100644
--- a/clang/test/CodeGen/sret.c
+++ b/clang/test/CodeGen/sret.c
@@ -12,7 +12,7 @@ struct abc foo1(void);
// CHECK-DAG: declare {{.*}} @foo1(ptr dead_on_unwind writable sret(%struct.abc)
struct abc foo2();
// CHECK-DAG: declare {{.*}} @foo2(ptr dead_on_unwind writable sret(%struct.abc)
-struct abc foo3(void) { return (abc){0}; }
+struct abc foo3(void) { return (struct abc){0}; }
// CHECK-DAG: define {{.*}} @foo3(ptr dead_on_unwind noalias writable sret(%struct.abc)
void bar(void) {
diff --git a/clang/test/CodeGen/ubsan-debuglog-return.c b/clang/test/CodeGen/ubsan-debuglog-return.c
index 253f0819be8ec3..0a96465d330e32 100644
--- a/clang/test/CodeGen/ubsan-debuglog-return.c
+++ b/clang/test/CodeGen/ubsan-debuglog-return.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-error-return-type -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s
// The UBSAN function call in the epilogue needs to have a debug location.
__attribute__((returns_nonnull)) void *allocate(void) {}
diff --git a/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp b/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp
index 91b6a3fb1b8fdf..ef589e0537974d 100644
--- a/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp
+++ b/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp
@@ -16,7 +16,7 @@ namespace std {
public:
typedef _Tp element_type;
auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
- element_type& operator*() const throw() { }
+ element_type& operator*() const throw() { return *_M_ptr; }
};
}
class Pointer32 {
diff --git a/clang/test/CodeGenCXX/array-value-initialize.cpp b/clang/test/CodeGenCXX/array-value-initialize.cpp
index 27607c1c754453..5896d3d883b7ba 100644
--- a/clang/test/CodeGenCXX/array-value-initialize.cpp
+++ b/clang/test/CodeGenCXX/array-value-initialize.cpp
@@ -9,20 +9,20 @@ struct S {
};
struct Foo {
- Foo(void) : bar_(), dbar_(), sbar_() {
+ Foo(void) : bar_(), dbar_(), sbar_() {
for (int i = 0; i < 5; i++) {
printf("bar_[%d] = %d\n", i, bar_[i]);
printf("dbar_[%d] = %f\n", i, dbar_[i]);
printf("sbar_[%d].filler = %f\n", i, sbar_[i].filler);
}
- }
+ }
int bar_[5];
double dbar_[5];
S sbar_[5];
};
-int test1(void) {
+void test1(void) {
Foo a;
}
@@ -44,9 +44,9 @@ struct Stuff
int main()
{
-
+
Stuff a;
Stuff b = a;
-
+
return 0;
}
diff --git a/clang/test/CodeGenCXX/mangle-exprs.cpp b/clang/test/CodeGenCXX/mangle-exprs.cpp
index 60e4c021b86b9b..d75e48b3bff3c1 100644
--- a/clang/test/CodeGenCXX/mangle-exprs.cpp
+++ b/clang/test/CodeGenCXX/mangle-exprs.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++11 -fclang-abi-compat=latest -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -std=c++11 -fclang-abi-compat=latest -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
namespace std {
typedef decltype(sizeof(int)) size_t;
@@ -301,31 +301,31 @@ namespace test7 {
struct E { E(std::initializer_list<int>); };
struct F { F(E); };
- template<class T> decltype(A{1,2},T()) fA1(T t) { return {}; }
- template<class T> decltype(A({1,2}),T()) fA2(T t) { return {}; }
- template<class T> decltype(B{1,2},T()) fB1(T t) { return {}; }
- template<class T> decltype(B({1,2}),T()) fB2(T t) { return {}; }
- template<class T> decltype(C{{1,2}},T()) fC1(T t) { return {}; }
- template<class T> decltype(C({1,2}),T()) fC2(T t) { return {}; }
- template<class T> decltype(D{b},T()) fD1(T t) { return {}; }
- template<class T> decltype(D(b),T()) fD2(T t) { return {}; }
- template<class T> decltype(E{1,2},T()) fE1(T t) { return {}; }
- template<class T> decltype(E({1,2}),T()) fE2(T t) { return {}; }
- template<class T> decltype(F{{1,2}},T()) fF1(T t) { return {}; }
- template<class T> decltype(F({1,2}),T()) fF2(T t) { return {}; }
-
- template<class T> decltype(T{}) fT1(T t) { return {}; }
- template<class T> decltype(T()) fT2(T t) { return {}; }
- template<class T> decltype(T{1}) fT3(T t) { return {}; }
- template<class T> decltype(T(1)) fT4(T t) { return {}; }
- template<class T> decltype(T{1,2}) fT5(T t) { return {}; }
- template<class T> decltype(T(1,2)) fT6(T t) { return {}; }
- template<class T> decltype(T{{}}) fT7(T t) { return {}; }
- template<class T> decltype(T({})) fT8(T t) { return {}; }
- template<class T> decltype(T{{1}}) fT9(T t) { return {}; }
- template<class T> decltype(T({1})) fTA(T t) { return {}; }
- template<class T> decltype(T{{1,2}}) fTB(T t) { return {}; }
- template<class T> decltype(T({1,2})) fTC(T t) { return {}; }
+ template<class T> decltype(A{1,2},T()) fA1(T t) { }
+ template<class T> decltype(A({1,2}),T()) fA2(T t) { }
+ template<class T> decltype(B{1,2},T()) fB1(T t) { }
+ template<class T> decltype(B({1,2}),T()) fB2(T t) { }
+ template<class T> decltype(C{{1,2}},T()) fC1(T t) { }
+ template<class T> decltype(C({1,2}),T()) fC2(T t) { }
+ template<class T> decltype(D{b},T()) fD1(T t) { }
+ template<class T> decltype(D(b),T()) fD2(T t) { }
+ template<class T> decltype(E{1,2},T()) fE1(T t) { }
+ template<class T> decltype(E({1,2}),T()) fE2(T t) { }
+ template<class T> decltype(F{{1,2}},T()) fF1(T t) { }
+ template<class T> decltype(F({1,2}),T()) fF2(T t) { }
+
+ template<class T> decltype(T{}) fT1(T t) { }
+ template<class T> decltype(T()) fT2(T t) { }
+ template<class T> decltype(T{1}) fT3(T t) { }
+ template<class T> decltype(T(1)) fT4(T t) { }
+ template<class T> decltype(T{1,2}) fT5(T t) { }
+ template<class T> decltype(T(1,2)) fT6(T t) { }
+ template<class T> decltype(T{{}}) fT7(T t) { }
+ template<class T> decltype(T({})) fT8(T t) { }
+ template<class T> decltype(T{{1}}) fT9(T t) { }
+ template<class T> decltype(T({1})) fTA(T t) { }
+ template<class T> decltype(T{{1,2}}) fTB(T t) { }
+ template<class T> decltype(T({1,2})) fTC(T t) { }
void main() {
fA1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA1IiEEDTcmtlNS_1AELi1ELi2EEcvT__EES2_
diff --git a/clang/test/CodeGenCXX/matrix-type-operators.cpp b/clang/test/CodeGenCXX/matrix-type-operators.cpp
index f6bb0636beac46..739008d3d0d372 100644
--- a/clang/test/CodeGenCXX/matrix-type-operators.cpp
+++ b/clang/test/CodeGenCXX/matrix-type-operators.cpp
@@ -300,7 +300,11 @@ int test_extract_template(MyMatrix<int, 2, 2> Mat1) {
using double4x4 = double __attribute__((matrix_type(4, 4)));
template <class R, class C>
-auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) { return {}; }
+auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) {
+ // FIXME: We can't actually do 'return m[r][c]' here currently.
+ static double d;
+ return d;
+}
double test_matrix_subscript(double4x4 m) {
// CHECK-LABEL: @_Z21test_matrix_subscriptu11matrix_typeILm4ELm4EdE(
diff --git a/clang/test/CodeGenCXX/matrix-type.cpp b/clang/test/CodeGenCXX/matrix-type.cpp
index 3764d188a991ec..de28dcd24507a5 100644
--- a/clang/test/CodeGenCXX/matrix-type.cpp
+++ b/clang/test/CodeGenCXX/matrix-type.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -no-enable-noundef-analysis -fenable-matrix -fclang-abi-compat=latest -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++17 | FileCheck %s
+// RUN: %clang_cc1 -Wno-error=return-type -no-enable-noundef-analysis -fenable-matrix -fclang-abi-compat=latest -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++17 | FileCheck %s
typedef double dx5x5_t __attribute__((matrix_type(5, 5)));
typedef float fx3x4_t __attribute__((matrix_type(3, 4)));
@@ -166,19 +166,19 @@ template <int N>
struct selector {};
template <class T, unsigned long R, unsigned long C>
-selector<0> use_matrix(matrix<T, R, C> &m) { return {}; }
+selector<0> use_matrix(matrix<T, R, C> &m) {}
template <class T, unsigned long R>
-selector<1> use_matrix(matrix<T, R, 10> &m) { return {}; }
+selector<1> use_matrix(matrix<T, R, 10> &m) {}
template <class T>
-selector<2> use_matrix(matrix<T, 10, 10> &m) { return {}; }
+selector<2> use_matrix(matrix<T, 10, 10> &m) {}
template <class T, unsigned long C>
-selector<3> use_matrix(matrix<T, 10, C> &m) { return {}; }
+selector<3> use_matrix(matrix<T, 10, C> &m) {}
template <unsigned long R, unsigned long C>
-selector<4> use_matrix(matrix<float, R, C> &m) { return {}; }
+selector<4> use_matrix(matrix<float, R, C> &m) {}
void test_template_deduction() {
@@ -275,19 +275,19 @@ void test_auto_t() {
}
template <unsigned long R, unsigned long C>
-matrix<float, R + 1, C + 2> use_matrix_2(matrix<int, R, C> &m) { return {}; }
+matrix<float, R + 1, C + 2> use_matrix_2(matrix<int, R, C> &m) {}
template <unsigned long R, unsigned long C>
-selector<0> use_matrix_2(matrix<int, R + 2, C / 2> &m1, matrix<float, R, C> &m2) { return {}; }
+selector<0> use_matrix_2(matrix<int, R + 2, C / 2> &m1, matrix<float, R, C> &m2) {}
template <unsigned long R, unsigned long C>
-selector<1> use_matrix_2(matrix<int, R + C, C> &m1, matrix<float, R, C - R> &m2) { return {}; }
+selector<1> use_matrix_2(matrix<int, R + C, C> &m1, matrix<float, R, C - R> &m2) {}
template <unsigned long R>
-matrix<float, R + R, R - 3> use_matrix_2(matrix<int, R, 10> &m1) { return {}; }
+matrix<float, R + R, R - 3> use_matrix_2(matrix<int, R, 10> &m1) {}
template <unsigned long R>
-selector<2> use_matrix_3(matrix<int, R - 2, R> &m) { return {}; }
+selector<2> use_matrix_3(matrix<int, R - 2, R> &m) {}
void test_use_matrix_2() {
// CHECK-LABEL: define{{.*}} void @_Z17test_use_matrix_2v()
diff --git a/clang/test/CodeGenCXX/new-alias.cpp b/clang/test/CodeGenCXX/new-alias.cpp
index ced44097e9b3dd..2496e383621811 100644
--- a/clang/test/CodeGenCXX/new-alias.cpp
+++ b/clang/test/CodeGenCXX/new-alias.cpp
@@ -10,5 +10,5 @@ extern "C" char *something(long long x) {
void *operator new(size_t) __attribute__((alias("something")));
// PR16715: don't assert here.
-// CHECK: call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) #3{{$}}
+// CHECK: call noalias noundef nonnull ptr @_Znwm(i64 noundef 4)
int *pr16715 = new int;
diff --git a/clang/test/FixIt/fixit-availability-maccatalyst.m b/clang/test/FixIt/fixit-availability-maccatalyst.m
index 1b4cec8a9fe4db..c63c9dd09c7431 100644
--- a/clang/test/FixIt/fixit-availability-maccatalyst.m
+++ b/clang/test/FixIt/fixit-availability-maccatalyst.m
@@ -5,7 +5,7 @@
void anotherFunction(int function);
-int use(void) {
+void use(void) {
function();
// CHECK: fix-it:{{.*}}:{[[@LINE-1]]:3-[[@LINE-1]]:3}:"if (@available(macCatalyst 13.2, *)) {\n "
// CHECK-NEXT: fix-it:{{.*}}:{[[@LINE-2]]:14-[[@LINE-2]]:14}:"\n } else {\n // Fallback on earlier versions\n }"
diff --git a/clang/test/FixIt/fixit-c++11.cpp b/clang/test/FixIt/fixit-c++11.cpp
index e635c14e0c2155..acbc1b11f88e43 100644
--- a/clang/test/FixIt/fixit-c++11.cpp
+++ b/clang/test/FixIt/fixit-c++11.cpp
@@ -59,7 +59,7 @@ void S2::f(int i) {
(void)[i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
(void)[&, i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
(void)[] mutable {};
- (void)[]->int{};
+ (void)[]->int{ return 0; };
#if __cplusplus <= 202002L
// expected-warning at -3{{is a C++23 extension}}
// expected-warning at -3{{is a C++23 extension}}
diff --git a/clang/test/Frontend/absolute-paths.c b/clang/test/Frontend/absolute-paths.c
index f47f0e6372c570..e06cf262dd8e2e 100644
--- a/clang/test/Frontend/absolute-paths.c
+++ b/clang/test/Frontend/absolute-paths.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=NORMAL -check-prefix=CHECK %s
-// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. -fdiagnostics-absolute-paths %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=ABSOLUTE -check-prefix=CHECK %s
+// RUN: %clang_cc1 -Wno-error=return-type -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=NORMAL -check-prefix=CHECK %s
+// RUN: %clang_cc1 -Wno-error=return-type -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. -fdiagnostics-absolute-paths %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=ABSOLUTE -check-prefix=CHECK %s
#include "absolute-paths-import.h"
// NORMAL: In file included from {{.*}}absolute-paths.c:4:
@@ -12,11 +12,11 @@
// directory in the path.
// NORMAL: SystemHeaderPrefix
// ABSOLUTE-NOT: SystemHeaderPrefix
-// CHECK: warning: declaration does not declare anything
+// 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"
-void g(void) { int; }
-// NORMAL: non-existant.c:123:17: warning: declaration does not declare anything
-// ABSOLUTE: non-existant.c:123:17: warning: declaration does not declare anything
+int g(void) {}
+// NORMAL: non-existant.c:123:14: warning: non-void function does not return a value
+// ABSOLUTE: non-existant.c:123:14: warning: non-void function does not return a value
diff --git a/clang/test/Misc/serialized-diags-stable.c b/clang/test/Misc/serialized-diags-stable.c
index 0ca29a2370d622..f2278a3ed9dc4f 100644
--- a/clang/test/Misc/serialized-diags-stable.c
+++ b/clang/test/Misc/serialized-diags-stable.c
@@ -1,11 +1,11 @@
// RUN: rm -f %t
-// RUN: not %clang -Wall -fsyntax-only %s --serialize-diagnostics %t.dia > /dev/null 2>&1
+// RUN: not %clang -Wno-error=return-type -Wall -fsyntax-only %s --serialize-diagnostics %t.dia > /dev/null 2>&1
// RUN: c-index-test -read-diagnostics %t.dia 2>&1 | FileCheck %s
// RUN: c-index-test -read-diagnostics %S/Inputs/serialized-diags-stable.dia 2>&1 | FileCheck %s
int foo(void) {
- // CHECK: serialized-diags-stable.c:[[@LINE+2]]:1: error: non-void function does not return a value [-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
}
diff --git a/clang/test/PCH/va_arg.h b/clang/test/PCH/va_arg.h
index 255c6589a7e856..beb49396f7b746 100644
--- a/clang/test/PCH/va_arg.h
+++ b/clang/test/PCH/va_arg.h
@@ -5,6 +5,7 @@ char *f (char * (*g) (char **, int), char **p, ...) {
char *s;
va_list v;
s = g (p, __builtin_va_arg(v, int));
+ return s;
}
typedef __builtin_ms_va_list __ms_va_list;
@@ -12,4 +13,5 @@ char *__attribute__((ms_abi)) h(char *(*i)(char **, int), char **p, ...) {
char *s;
__ms_va_list v;
s = i(p, __builtin_va_arg(v, int));
+ return s;
}
diff --git a/clang/test/SemaCXX/attr-noreturn.cpp b/clang/test/SemaCXX/attr-noreturn.cpp
index e6de5ad45d340a..844c4c1b617c18 100644
--- a/clang/test/SemaCXX/attr-noreturn.cpp
+++ b/clang/test/SemaCXX/attr-noreturn.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wno-error=return-type -fsyntax-only -verify %s
// Reachability tests have to come first because they get suppressed
// if any errors have occurred.
@@ -176,7 +176,7 @@ void test_f0a() {
void (*fp1)() __attribute__((noreturn)) = f0;
}
-// Taking the address of an overloaded noreturn function
+// Taking the address of an overloaded noreturn function
void f0(int) __attribute__((__noreturn__));
void test_f0b() {
>From 9539ec1994ae795a732f16ef229c73a7d4e7896e Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Sat, 18 Jan 2025 16:32:26 +0100
Subject: [PATCH 4/4] Remove spurious changes
---
clang/test/CodeGenCXX/mangle-exprs.cpp | 50 +++++++++++++-------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/clang/test/CodeGenCXX/mangle-exprs.cpp b/clang/test/CodeGenCXX/mangle-exprs.cpp
index d75e48b3bff3c1..13a7f46d06f62d 100644
--- a/clang/test/CodeGenCXX/mangle-exprs.cpp
+++ b/clang/test/CodeGenCXX/mangle-exprs.cpp
@@ -301,31 +301,31 @@ namespace test7 {
struct E { E(std::initializer_list<int>); };
struct F { F(E); };
- template<class T> decltype(A{1,2},T()) fA1(T t) { }
- template<class T> decltype(A({1,2}),T()) fA2(T t) { }
- template<class T> decltype(B{1,2},T()) fB1(T t) { }
- template<class T> decltype(B({1,2}),T()) fB2(T t) { }
- template<class T> decltype(C{{1,2}},T()) fC1(T t) { }
- template<class T> decltype(C({1,2}),T()) fC2(T t) { }
- template<class T> decltype(D{b},T()) fD1(T t) { }
- template<class T> decltype(D(b),T()) fD2(T t) { }
- template<class T> decltype(E{1,2},T()) fE1(T t) { }
- template<class T> decltype(E({1,2}),T()) fE2(T t) { }
- template<class T> decltype(F{{1,2}},T()) fF1(T t) { }
- template<class T> decltype(F({1,2}),T()) fF2(T t) { }
-
- template<class T> decltype(T{}) fT1(T t) { }
- template<class T> decltype(T()) fT2(T t) { }
- template<class T> decltype(T{1}) fT3(T t) { }
- template<class T> decltype(T(1)) fT4(T t) { }
- template<class T> decltype(T{1,2}) fT5(T t) { }
- template<class T> decltype(T(1,2)) fT6(T t) { }
- template<class T> decltype(T{{}}) fT7(T t) { }
- template<class T> decltype(T({})) fT8(T t) { }
- template<class T> decltype(T{{1}}) fT9(T t) { }
- template<class T> decltype(T({1})) fTA(T t) { }
- template<class T> decltype(T{{1,2}}) fTB(T t) { }
- template<class T> decltype(T({1,2})) fTC(T t) { }
+ template<class T> decltype(A{1,2},T()) fA1(T t) {}
+ template<class T> decltype(A({1,2}),T()) fA2(T t) {}
+ template<class T> decltype(B{1,2},T()) fB1(T t) {}
+ template<class T> decltype(B({1,2}),T()) fB2(T t) {}
+ template<class T> decltype(C{{1,2}},T()) fC1(T t) {}
+ template<class T> decltype(C({1,2}),T()) fC2(T t) {}
+ template<class T> decltype(D{b},T()) fD1(T t) {}
+ template<class T> decltype(D(b),T()) fD2(T t) {}
+ template<class T> decltype(E{1,2},T()) fE1(T t) {}
+ template<class T> decltype(E({1,2}),T()) fE2(T t) {}
+ template<class T> decltype(F{{1,2}},T()) fF1(T t) {}
+ template<class T> decltype(F({1,2}),T()) fF2(T t) {}
+
+ template<class T> decltype(T{}) fT1(T t) {}
+ template<class T> decltype(T()) fT2(T t) {}
+ template<class T> decltype(T{1}) fT3(T t) {}
+ template<class T> decltype(T(1)) fT4(T t) {}
+ template<class T> decltype(T{1,2}) fT5(T t) {}
+ template<class T> decltype(T(1,2)) fT6(T t) {}
+ template<class T> decltype(T{{}}) fT7(T t) {}
+ template<class T> decltype(T({})) fT8(T t) {}
+ template<class T> decltype(T{{1}}) fT9(T t) {}
+ template<class T> decltype(T({1})) fTA(T t) {}
+ template<class T> decltype(T{{1,2}}) fTB(T t) {}
+ template<class T> decltype(T({1,2})) fTC(T t) {}
void main() {
fA1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA1IiEEDTcmtlNS_1AELi1ELi2EEcvT__EES2_
More information about the cfe-commits
mailing list