[clang] [clang-tools-extra] [compiler-rt] [Clang] Make `-Wreturn-type` default to an error in all language modes (PR #123470)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 19 13:07:45 PST 2025
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/123470
>From 441385e14210f23a4fe5368d44620073a4347a31 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Sat, 18 Jan 2025 19:35:01 +0100
Subject: [PATCH 1/8] [Clang] Make -Wreturn-type default to an error in all
language modes
---
clang/docs/ReleaseNotes.rst | 4 ++++
clang/include/clang/Basic/DiagnosticSemaKinds.td | 12 ++++++------
clang/test/Index/warning-flags.c | 2 +-
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index aa1c02d04f7ca..a086c44398440 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -81,6 +81,10 @@ code bases.
``-fno-strict-overflow`` to opt-in to a language dialect where signed integer
and pointer overflow are well-defined.
+- ``-Wreturn-type`` now defaults to an error in all language modes; like other
+ warnings, it can be reverted to just being a warning by specifying
+ ``-Wno-error=return-type``.
+
C/C++ Language Potentially Breaking Changes
-------------------------------------------
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index db54312ad965e..b70d152781a2a 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -709,10 +709,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>;
@@ -726,10 +726,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;
@@ -8365,10 +8365,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/Index/warning-flags.c b/clang/test/Index/warning-flags.c
index 1694c6abab562..3229f000c4ae0 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
>From 5200de410b12463a7c8ba7fdbb75e9156f2cb116 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Sat, 18 Jan 2025 21:43:37 +0100
Subject: [PATCH 2/8] Fix two tests
---
clang/test/CodeGen/armv7k-abi.c | 10 +++++-----
clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/clang/test/CodeGen/armv7k-abi.c b/clang/test/CodeGen/armv7k-abi.c
index fd18dafa7d03f..872e6423a4a99 100644
--- a/clang/test/CodeGen/armv7k-abi.c
+++ b/clang/test/CodeGen/armv7k-abi.c
@@ -16,7 +16,7 @@ typedef struct {
void simple_hfa(HFA h) {}
// CHECK: define{{.*}} %struct.HFA @return_simple_hfa
-HFA return_simple_hfa() {}
+HFA return_simple_hfa() { return (HFA){0}; }
typedef struct {
double arr[4];
@@ -43,7 +43,7 @@ typedef struct {
void big_struct_indirect(BigStruct b) {}
// CHECK: define{{.*}} void @return_big_struct_indirect(ptr dead_on_unwind noalias writable sret
-BigStruct return_big_struct_indirect() {}
+BigStruct return_big_struct_indirect() { return (BigStruct){0}; }
// Structs smaller than 16 bytes should be passed directly, and coerced to
// either [N x i32] or [N x i64] depending on alignment requirements.
@@ -58,7 +58,7 @@ typedef struct {
void small_struct_direct(SmallStruct s) {}
// CHECK: define{{.*}} [4 x i32] @return_small_struct_direct()
-SmallStruct return_small_struct_direct() {}
+SmallStruct return_small_struct_direct() { return (SmallStruct){0}; }
typedef struct {
float x;
@@ -75,14 +75,14 @@ typedef struct {
} PaddedSmallStruct;
// CHECK: define{{.*}} i32 @return_padded_small_struct()
-PaddedSmallStruct return_padded_small_struct() {}
+PaddedSmallStruct return_padded_small_struct() { return (PaddedSmallStruct){0}; }
typedef struct {
char arr[7];
} OddlySizedStruct;
// CHECK: define{{.*}} [2 x i32] @return_oddly_sized_struct()
-OddlySizedStruct return_oddly_sized_struct() {}
+OddlySizedStruct return_oddly_sized_struct() { return (OddlySizedStruct){0}; }
// CHECK: define{{.*}} <4 x float> @test_va_arg_vec(ptr noundef %l)
diff --git a/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl b/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl
index 72027eda4571d..59bf87b554af3 100644
--- a/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl
+++ b/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl
@@ -36,7 +36,7 @@ typedef enum memory_scope {
// GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("agent-one-as") monotonic
// GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("one-as") monotonic
// GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("wavefront-one-as") monotonic
-float atomic_cas(__global atomic_float *d, float a) {
+void atomic_cas(__global atomic_float *d, float a) {
float ret1 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_work_group);
float ret2 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_device);
float ret3 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_all_svm_devices);
>From e8fcfc0571639176fcb2e3992577f872c3e21df3 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Sun, 19 Jan 2025 00:42:05 +0100
Subject: [PATCH 3/8] Fix three compiler-rt tests
---
compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c | 2 +-
.../test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp | 4 ++--
compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c b/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c
index e6d1731f30e37..94432f820211f 100644
--- a/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c
+++ b/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c
@@ -1,4 +1,4 @@
-// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=random_tags=1 %run %t
+// RUN: %clang_hwasan -Wno-error=return-type %s -o %t && %env_hwasan_opts=random_tags=1 %run %t
#include <pthread.h>
#include <sanitizer/hwasan_interface.h>
diff --git a/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp b/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp
index 8b7cb6ade35ac..296171848255f 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp
+++ b/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp
@@ -2,10 +2,10 @@
// UNSUPPORTED: target=thumb{{.*}}
// UNSUPPORTED: android
-// RUN: %clangxx -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fasynchronous-unwind-tables %s -o %t
+// RUN: %clangxx -Wno-error=return-type -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fasynchronous-unwind-tables %s -o %t
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=0 not %run %t 2>&1 | FileCheck %s
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=1 not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %s -o %t
+// RUN: %clangxx -Wno-error=return-type -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %s -o %t
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=0 not %run %t 2>&1 | FileCheck %s
// RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=1 not %run %t 2>&1 | FileCheck %s
diff --git a/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp b/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp
index 2ea76daf1fc16..6c1bc5525cd17 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp
+++ b/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -fsanitize=return %gmlt %s -O3 -o %t
+// RUN: %clangxx -Wno-error=return-type -fsanitize=return %gmlt %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-STACKTRACE
// Error message does not exact what expected
>From 9b8097731fa55651879688529d99ea19b4412353 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Wed, 19 Feb 2025 21:35:07 +0100
Subject: [PATCH 4/8] Fix clang-tidy tests
---
.../Inputs/absl/strings/internal-file.h | 2 +-
.../checkers/boost/use-to-string.cpp | 4 +--
.../bugprone/exception-escape-coro.cpp | 2 +-
.../bugprone/exception-escape-rethrow.cpp | 2 ++
.../checkers/bugprone/exception-escape.cpp | 1 +
.../checkers/bugprone/fold-init-type.cpp | 9 +++---
.../inc-dec-in-conditions-bitint-no-crash.c | 3 +-
.../bugprone/spuriously-wake-up-functions.c | 4 +--
.../bugprone/spuriously-wake-up-functions.cpp | 8 +++---
.../checkers/bugprone/stringview-nullptr.cpp | 2 +-
.../bugprone/suspicious-string-compare.cpp | 2 ++
.../fuchsia/default-arguments-calls.cpp | 4 +--
.../checkers/fuchsia/multiple-inheritance.cpp | 2 +-
.../checkers/google/runtime-int-std.cpp | 1 +
.../google/upgrade-googletest-case.cpp | 28 +++++++++----------
.../const-correctness-transform-values.cpp | 4 +--
.../misc/const-correctness-values.cpp | 4 +--
.../checkers/misc/unused-parameters.cpp | 4 +--
.../misc/use-internal-linkage-func.cpp | 20 ++++++-------
.../modernize/Inputs/use-auto/containers.h | 4 +--
.../checkers/modernize/avoid-bind.cpp | 4 +--
.../modernize/avoid-c-arrays-c++20.cpp | 8 +++---
.../modernize/avoid-c-arrays-ignores-main.cpp | 8 ++++--
.../avoid-c-arrays-ignores-three-arg-main.cpp | 16 +++++++----
.../checkers/modernize/loop-convert-basic.cpp | 2 ++
.../checkers/modernize/use-emplace.cpp | 24 ++++++++--------
.../modernize/use-equals-default-copy.cpp | 2 +-
.../checkers/modernize/use-override.cpp | 8 +++---
.../checkers/modernize/use-std-format.cpp | 2 +-
.../modernize/use-trailing-return-type.cpp | 28 +++++++++----------
.../unnecessary-value-param/header-fixed.h | 2 +-
.../Inputs/unnecessary-value-param/header.h | 2 +-
.../inefficient-string-concatenation.cpp | 6 ++--
.../unnecessary-value-param-header.cpp | 6 ++--
.../identifier-naming/global-style1/header.h | 2 +-
.../identifier-naming/global-style2/header.h | 2 +-
.../readability/const-return-type-macros.cpp | 6 ++--
.../readability/const-return-type.cpp | 2 +-
.../convert-member-functions-to-static.cpp | 1 +
.../readability/identifier-naming.cpp | 5 ++--
.../readability/implicit-bool-conversion.cpp | 2 +-
.../checkers/readability/named-parameter.cpp | 21 +++++++-------
.../readability/redundant-declaration.c | 2 +-
.../readability/redundant-declaration.cpp | 2 +-
.../static-accessed-through-instance.cpp | 2 +-
.../readability/suspicious-call-argument.cpp | 2 +-
.../duplicate-fixes-of-alias-checkers.cpp | 2 +-
47 files changed, 150 insertions(+), 129 deletions(-)
diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h
index 31798661a80fc..b9ce1c875ed13 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h
+++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h
@@ -10,7 +10,7 @@ std::string StringsFunction(std::string s1) { return s1; }
class SomeContainer {};
namespace strings_internal {
void InternalFunction() {}
-template <class P> P InternalTemplateFunction(P a) {}
+template <class P> void InternalTemplateFunction(P a) { int; }
} // namespace strings_internal
namespace container_internal {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp b/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp
index 44ba172c2ff0b..f888c430e6883 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp
@@ -18,7 +18,7 @@ T lexical_cast(const V &) {
struct my_weird_type {};
-std::string fun(const std::string &) {}
+std::string fun(const std::string &) { return {}; }
void test_to_string1() {
@@ -75,7 +75,7 @@ void test_to_string2() {
fun(boost::lexical_cast<std::string>(j));
}
-std::string fun(const std::wstring &) {}
+std::string fun(const std::wstring &);
void test_to_wstring() {
int a;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
index 222577b124dce..aff13d19fd209 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
@@ -1,5 +1,5 @@
// RUN: %check_clang_tidy -std=c++20 %s bugprone-exception-escape %t -- \
-// RUN: -- -fexceptions
+// RUN: -- -fexceptions -Wno-error=return-type
namespace std {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp
index b20333d5b0b3b..6f961a247b9d2 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp
@@ -20,6 +20,7 @@ int throwsAndCallsRethrower() noexcept {
} catch(...) {
rethrower();
}
+ return 1;
}
int throwsAndCallsCallsRethrower() noexcept {
@@ -29,6 +30,7 @@ int throwsAndCallsCallsRethrower() noexcept {
} catch(...) {
callsRethrower();
}
+ return 1;
}
void rethrowerNoexcept() noexcept {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp
index 26c443b139629..aae957dd7e090 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp
@@ -665,6 +665,7 @@ int indirectly_recursive(int n) noexcept;
int recursion_helper(int n) {
indirectly_recursive(n);
+ return 0;
}
int indirectly_recursive(int n) noexcept {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp
index 2a49960e02895..c813213c3dd0f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp
@@ -8,24 +8,25 @@ T accumulate(InputIt first, InputIt last, T init) {
// is instantiated. In practice this happens somewhere in the implementation
// of `accumulate`. For tests, do it here.
(void)*first;
+ return init;
}
template <class InputIt, class T>
-T reduce(InputIt first, InputIt last, T init) { (void)*first; }
+T reduce(InputIt first, InputIt last, T init) { (void)*first; return init; }
template <class ExecutionPolicy, class InputIt, class T>
T reduce(ExecutionPolicy &&policy,
- InputIt first, InputIt last, T init) { (void)*first; }
+ InputIt first, InputIt last, T init) { (void)*first; return init; }
struct parallel_execution_policy {};
constexpr parallel_execution_policy par{};
template <class InputIt1, class InputIt2, class T>
T inner_product(InputIt1 first1, InputIt1 last1,
- InputIt2 first2, T value) { (void)*first1; (void)*first2; }
+ InputIt2 first2, T value) { (void)*first1; (void)*first2; return value; }
template <class ExecutionPolicy, class InputIt1, class InputIt2, class T>
T inner_product(ExecutionPolicy &&policy, InputIt1 first1, InputIt1 last1,
- InputIt2 first2, T value) { (void)*first1; (void)*first2; }
+ InputIt2 first2, T value) { (void)*first1; (void)*first2; return value; }
} // namespace std
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c
index cfb64c10fe46c..5cfa264e42d68 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c
@@ -5,5 +5,6 @@ _BitInt(8) v_401_0() {
_BitInt(5) y = 0;
16777215wb ?: ++y;
});
+ return 0;
}
-// CHECK-MESSAGES: warning
+// CHECK-MESSAGES: warning
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c
index 8b84474d3f2d3..36b1215978603 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c
@@ -12,9 +12,9 @@ typedef struct cnd_t {
} cnd_t;
struct timespec {};
-int cnd_wait(cnd_t *cond, mtx_t *mutex){};
+int cnd_wait(cnd_t *cond, mtx_t *mutex){ return 0; };
int cnd_timedwait(cnd_t *cond, mtx_t *mutex,
- const struct timespec *time_point){};
+ const struct timespec *time_point){ return 0; };
struct Node1 list_c;
static mtx_t lock;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp
index 6db92ef939fa3..d7508009e19ad 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp
@@ -90,18 +90,18 @@ class condition_variable {
void wait(unique_lock<mutex> &lock, Predicate pred);
template <class Clock, class Duration>
cv_status wait_until(unique_lock<mutex> &lock,
- const chrono::time_point<Clock, Duration> &abs_time){};
+ const chrono::time_point<Clock, Duration> &abs_time){ return cv_status::no_timeout; };
template <class Clock, class Duration, class Predicate>
bool wait_until(unique_lock<mutex> &lock,
const chrono::time_point<Clock, Duration> &abs_time,
- Predicate pred){};
+ Predicate pred){ return false; };
template <class Rep, class Period>
cv_status wait_for(unique_lock<mutex> &lock,
- const chrono::duration<Rep, Period> &rel_time){};
+ const chrono::duration<Rep, Period> &rel_time){ return cv_status::no_timeout; };
template <class Rep, class Period, class Predicate>
bool wait_for(unique_lock<mutex> &lock,
const chrono::duration<Rep, Period> &rel_time,
- Predicate pred){};
+ Predicate pred){ return false; };
};
} // namespace std
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp
index 02fcab31dcf3e..ff5b256e71781 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp
@@ -27,7 +27,7 @@ class basic_string_view {
constexpr basic_string_view(const basic_string_view &) {}
- constexpr basic_string_view &operator=(const basic_string_view &) {}
+ constexpr basic_string_view &operator=(const basic_string_view &) { return *this; }
};
template <typename CharT>
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp
index 7e1dd6b444393..c14b094f3fca3 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp
@@ -89,6 +89,8 @@ int test_warning_patterns() {
if (strcmp(A, "a") < 0.)
return 0;
// CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcmp' has suspicious implicit cast
+
+ return 1;
}
int test_valid_patterns() {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp
index 50b6d4c5676c3..ed7bcc7dacc30 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp
@@ -2,7 +2,7 @@
int foo(int value = 5) { return value; }
-int f() {
+void f() {
foo();
// CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
// CHECK-NOTES: [[@LINE-5]]:9: note: default parameter was declared here
@@ -10,7 +10,7 @@ int f() {
int bar(int value) { return value; }
-int n() {
+void n() {
foo(0);
bar(0);
}
diff --git a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp
index 6ce9ce8e65536..d53b3fde7736b 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp
@@ -144,7 +144,7 @@ struct WithTemplBase : T {
WithTemplBase();
};
-int test_no_crash() {
+void test_no_crash() {
auto foo = []() {};
WithTemplBase<decltype(foo)>();
}
diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp b/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp
index 30f9b3cf1e90c..cd65de51a5ce9 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp
@@ -54,4 +54,5 @@ short bar(const short, unsigned short) {
tmpl<short>();
// CHECK-MESSAGES: [[@LINE-1]]:8: warning: consider replacing 'short' with 'std::int16_t'
+ return 0;
}
diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp b/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp
index ce70e79183521..39ff9b7f39634 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp
@@ -221,9 +221,9 @@ class FooTestInfo : public testing::TestInfo {
// CHECK-FIXES: const char *test_suite_name() const;
};
-const char *FooTestInfo::test_case_name() const {}
+const char *FooTestInfo::test_case_name() const { return nullptr; }
// CHECK-MESSAGES: [[@LINE-1]]:26: warning: Google Test APIs named with 'case'
-// CHECK-FIXES: const char *FooTestInfo::test_suite_name() const {}
+// CHECK-FIXES: const char *FooTestInfo::test_suite_name() const { return nullptr; }
class BarTestInfo : public testing::TestInfo {
public:
@@ -491,26 +491,26 @@ class FooUnitTest : public testing::UnitTest {
// CHECK-FIXES: const testing::TestSuite *GetTestSuite(int) const;
};
-testing::TestCase *FooUnitTest::current_test_case() const {}
+testing::TestCase *FooUnitTest::current_test_case() const { return nullptr; }
// CHECK-MESSAGES: [[@LINE-1]]:10: warning: Google Test APIs named with 'case'
// CHECK-MESSAGES: [[@LINE-2]]:33: warning: Google Test APIs named with 'case'
-// CHECK-FIXES: testing::TestSuite *FooUnitTest::current_test_suite() const {}
-int FooUnitTest::successful_test_case_count() const {}
+// CHECK-FIXES: testing::TestSuite *FooUnitTest::current_test_suite() const { return nullptr; }
+int FooUnitTest::successful_test_case_count() const { return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case'
-// CHECK-FIXES: int FooUnitTest::successful_test_suite_count() const {}
-int FooUnitTest::failed_test_case_count() const {}
+// CHECK-FIXES: int FooUnitTest::successful_test_suite_count() const { return 0; }
+int FooUnitTest::failed_test_case_count() const { return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case'
-// CHECK-FIXES: int FooUnitTest::failed_test_suite_count() const {}
-int FooUnitTest::total_test_case_count() const {}
+// CHECK-FIXES: int FooUnitTest::failed_test_suite_count() const { return 0; }
+int FooUnitTest::total_test_case_count() const { return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case'
-// CHECK-FIXES: int FooUnitTest::total_test_suite_count() const {}
-int FooUnitTest::test_case_to_run_count() const {}
+// CHECK-FIXES: int FooUnitTest::total_test_suite_count() const { return 0; }
+int FooUnitTest::test_case_to_run_count() const { return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case'
-// CHECK-FIXES: int FooUnitTest::test_suite_to_run_count() const {}
-const testing::TestCase *FooUnitTest::GetTestCase(int) const {}
+// CHECK-FIXES: int FooUnitTest::test_suite_to_run_count() const { return 0; }
+const testing::TestCase *FooUnitTest::GetTestCase(int) const { return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:16: warning: Google Test APIs named with 'case'
// CHECK-MESSAGES: [[@LINE-2]]:39: warning: Google Test APIs named with 'case'
-// CHECK-FIXES: const testing::TestSuite *FooUnitTest::GetTestSuite(int) const {}
+// CHECK-FIXES: const testing::TestSuite *FooUnitTest::GetTestSuite(int) const { return 0; }
// Type derived from testing::TestCase
class BarUnitTest : public testing::UnitTest {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp
index 9a4eb010609b4..109eddc195558 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp
@@ -54,8 +54,8 @@ void template_instantiation() {
struct ConstNonConstClass {
ConstNonConstClass();
ConstNonConstClass(double &np_local0);
- double nonConstMethod() {}
- double constMethod() const {}
+ double nonConstMethod() { return 0; }
+ double constMethod() const { return 0; }
double modifyingMethod(double &np_arg0) const;
double NonConstMember;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp
index 0d1ff0db58371..5efb64bca2374 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp
@@ -283,8 +283,8 @@ void template_instantiation() {
struct ConstNonConstClass {
ConstNonConstClass();
ConstNonConstClass(double &np_local0);
- double nonConstMethod() {}
- double constMethod() const {}
+ double nonConstMethod() { return 0; }
+ double constMethod() const { return 0; }
double modifyingMethod(double &np_arg0) const;
double NonConstMember;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp
index 524de45463e36..9b3dd070405b5 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp
@@ -33,9 +33,9 @@ void f(void (*fn)()) {;}
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: parameter 'fn' is unused [misc-unused-parameters]
// CHECK-FIXES: {{^}}void f(void (* /*fn*/)()) {;}{{$}}
-int *k([[clang::lifetimebound]] int *i) {;}
+int *k([[clang::lifetimebound]] int *i) { return nullptr; }
// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: parameter 'i' is unused [misc-unused-parameters]
-// CHECK-FIXES: {{^}}int *k({{\[\[clang::lifetimebound\]\]}} int * /*i*/) {;}{{$}}
+// CHECK-FIXES: {{^}}int *k({{\[\[clang::lifetimebound\]\]}} int * /*i*/) { return nullptr; }{{$}}
#define ATTR_BEFORE(x) [[clang::lifetimebound]] x
int* m(ATTR_BEFORE(const int *i)) { return nullptr; }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp
index 68951fcf0aaac..abf95b857c192 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp
@@ -17,25 +17,25 @@ void func_cpp_inc() {}
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_cpp_inc'
// CHECK-FIXES: static void func_cpp_inc() {}
-int* func_cpp_inc_return_ptr() {}
+int* func_cpp_inc_return_ptr() { return nullptr; }
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_cpp_inc_return_ptr'
-// CHECK-FIXES: static int* func_cpp_inc_return_ptr() {}
+// CHECK-FIXES: static int* func_cpp_inc_return_ptr() { return nullptr; }
-const int* func_cpp_inc_return_const_ptr() {}
+const int* func_cpp_inc_return_const_ptr() { return nullptr; }
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: function 'func_cpp_inc_return_const_ptr'
-// CHECK-FIXES: static const int* func_cpp_inc_return_const_ptr() {}
+// CHECK-FIXES: static const int* func_cpp_inc_return_const_ptr() { return nullptr; }
-int const* func_cpp_inc_return_ptr_const() {}
+int const* func_cpp_inc_return_ptr_const() { return nullptr; }
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: function 'func_cpp_inc_return_ptr_const'
-// CHECK-FIXES: static int const* func_cpp_inc_return_ptr_const() {}
+// CHECK-FIXES: static int const* func_cpp_inc_return_ptr_const() { return nullptr; }
-int * const func_cpp_inc_return_const() {}
+int * const func_cpp_inc_return_const() { return nullptr; }
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: function 'func_cpp_inc_return_const'
-// CHECK-FIXES: static int * const func_cpp_inc_return_const() {}
+// CHECK-FIXES: static int * const func_cpp_inc_return_const() { return nullptr; }
-volatile const int* func_cpp_inc_return_volatile_const_ptr() {}
+volatile const int* func_cpp_inc_return_volatile_const_ptr() { return nullptr; }
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: function 'func_cpp_inc_return_volatile_const_ptr'
-// CHECK-FIXES: static volatile const int* func_cpp_inc_return_volatile_const_ptr() {}
+// CHECK-FIXES: static volatile const int* func_cpp_inc_return_volatile_const_ptr() { return nullptr; }
[[nodiscard]] void func_nodiscard() {}
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: function 'func_nodiscard'
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h
index c99b7a4407d5c..2c90d762f5d8a 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h
@@ -214,8 +214,8 @@ class map : public bidirectional_iterable<iterator<pair<key, value>>> {
public:
map() {}
- iterator<pair<key, value>> find(const key &) {}
- const_iterator<iterator<pair<key, value>>> find(const key &) const {}
+ iterator<pair<key, value>> find(const key &);
+ const_iterator<iterator<pair<key, value>>> find(const key &) const;
};
template <typename key, typename value>
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp
index 22b24d45fe63f..0d100ffa38b27 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp
@@ -46,7 +46,7 @@ struct D {
operator bool() const { return true; }
void MemberFunction(int x) {}
- int MemberFunctionWithReturn(int x) {}
+ int MemberFunctionWithReturn(int x) { return 0; }
static D *create();
};
@@ -342,7 +342,7 @@ void testCapturedSubexpressions() {
struct E {
void MemberFunction(int x) {}
- int MemberFunctionWithReturn(int x) {}
+ int MemberFunctionWithReturn(int x) { return 0; }
int operator()(int x, int y) const { return x + y; }
void testMemberFunctions() {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp
index 1eb8ebe3d51e3..c9391e3339623 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp
@@ -1,11 +1,11 @@
// RUN: %check_clang_tidy -std=c++20 %s modernize-avoid-c-arrays %t
-int f1(int data[], int size) {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: do not declare C-style arrays, use 'std::span' instead
+void f1(int data[], int size) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: do not declare C-style arrays, use 'std::span' instead
int f4[] = {1, 2};
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead
}
-int f2(int data[100]) {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: do not declare C-style arrays, use 'std::array' instead
+void f2(int data[100]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: do not declare C-style arrays, use 'std::array' instead
}
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp
index a0c79bb55a686..8e1890c234223 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp
@@ -1,9 +1,13 @@
// RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t
-int not_main(int argc, char *argv[]) {
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
+namespace X {
+// Not main
+int main(int argc, char *argv[]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
int f4[] = {1, 2};
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead
+ return 0;
+}
}
int main(int argc, char *argv[]) {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp
index bd39f0fb4f1c8..58eced408733a 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp
@@ -1,19 +1,23 @@
// RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t
-int not_main(int argc, char *argv[], char *argw[]) {
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
- // CHECK-MESSAGES: :[[@LINE-2]]:38: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
+namespace X {
+// Not main.
+int main(int argc, char *argv[], char *argw[]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
+ // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
int f4[] = {1, 2};
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead
+ return 0;
+}
}
int main(int argc, char *argv[], char *argw[]) {
int f5[] = {1, 2};
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead
- auto not_main = [](int argc, char *argv[], char *argw[]) {
- // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
- // CHECK-MESSAGES: :[[@LINE-2]]:46: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
+ auto main = [](int argc, char *argv[], char *argw[]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
+ // CHECK-MESSAGES: :[[@LINE-2]]:42: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead
int f6[] = {1, 2};
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use 'std::array' instead
};
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp
index df2a2c1af1f54..8d1d7378e5cff 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp
@@ -170,6 +170,8 @@ const int *constArray() {
// CHECK-FIXES: for (const int & I : ConstArr)
// CHECK-FIXES-NEXT: if (Something)
// CHECK-FIXES-NEXT: return &I;
+
+ return nullptr;
}
struct HasArr {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp
index 3f4a14cd9bb64..e6562cd18dbab 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp
@@ -49,7 +49,7 @@ class vector {
template <typename... Args>
void emplace_back(Args &&... args){};
template <typename... Args>
- iterator emplace(const_iterator pos, Args &&...args){};
+ iterator emplace(const_iterator pos, Args &&...args);
~vector();
};
@@ -69,7 +69,7 @@ class list {
void push_back(T &&) {}
template <typename... Args>
- iterator emplace(const_iterator pos, Args &&...args){};
+ iterator emplace(const_iterator pos, Args &&...args);
template <typename... Args>
void emplace_back(Args &&... args){};
template <typename... Args>
@@ -93,7 +93,7 @@ class deque {
void push_front(T &&) {}
template <typename... Args>
- iterator emplace(const_iterator pos, Args &&...args){};
+ iterator emplace(const_iterator pos, Args &&...args);
template <typename... Args>
void emplace_back(Args &&... args){};
template <typename... Args>
@@ -116,7 +116,7 @@ class forward_list {
template <typename... Args>
void emplace_front(Args &&...args){};
template <typename... Args>
- iterator emplace_after(const_iterator pos, Args &&...args){};
+ iterator emplace_after(const_iterator pos, Args &&...args);
};
template <typename T>
@@ -131,7 +131,7 @@ class set {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename Key, typename T>
@@ -146,7 +146,7 @@ class map {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename T>
@@ -161,7 +161,7 @@ class multiset {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename Key, typename T>
@@ -176,7 +176,7 @@ class multimap {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename T>
@@ -191,7 +191,7 @@ class unordered_set {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename Key, typename T>
@@ -206,7 +206,7 @@ class unordered_map {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename T>
@@ -221,7 +221,7 @@ class unordered_multiset {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename Key, typename T>
@@ -236,7 +236,7 @@ class unordered_multimap {
template <typename... Args>
void emplace(Args &&...args){};
template <typename... Args>
- iterator emplace_hint(const_iterator pos, Args &&...args){};
+ iterator emplace_hint(const_iterator pos, Args &&...args);
};
template <typename T>
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp
index 4abb9c8555970..7f737148a7cd1 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp
@@ -1,6 +1,6 @@
// RUN: %check_clang_tidy %s modernize-use-equals-default %t -- \
// RUN: -config="{CheckOptions: {modernize-use-equals-default.IgnoreMacros: false}}" \
-// RUN: -- -fno-delayed-template-parsing -fexceptions
+// RUN: -- -fno-delayed-template-parsing -fexceptions -Wno-error=return-type
// Out of line definition.
struct OL {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp
index 89d1aa48c46a3..bad8b7a8d7f08 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp
@@ -203,13 +203,13 @@ struct InlineDefinitions : public Base {
// CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using
// CHECK-FIXES: {{^}} void j() const override
- virtual MustUseResultObject k() {} // Has an implicit attribute.
+ virtual MustUseResultObject k(); // Has an implicit attribute.
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: prefer using
- // CHECK-FIXES: {{^}} MustUseResultObject k() override {}
+ // CHECK-FIXES: {{^}} MustUseResultObject k() override;
- virtual bool l() MUST_USE_RESULT UNUSED {}
+ virtual bool l() MUST_USE_RESULT UNUSED;
// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
- // CHECK-FIXES: {{^}} bool l() override MUST_USE_RESULT UNUSED {}
+ // CHECK-FIXES: {{^}} bool l() override MUST_USE_RESULT UNUSED;
virtual void r() &
{}
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp
index 0a5a63eba2596..2af2e8949a814 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp
@@ -100,7 +100,7 @@ std::string StrFormat_field_width_and_precision() {
return s1 + s2 + s3 + s4 + s5 + s6;
}
-std::string StrFormat_macros() {
+void StrFormat_macros() {
// The function call is replaced even though it comes from a macro.
#define FORMAT absl::StrFormat
auto s1 = FORMAT("Hello %d", 42);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp
index d9efc006b22ef..e1f36c52a7c01 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp
@@ -106,9 +106,9 @@ extern "C" int d2(int arg);
inline int d3(int arg) noexcept(true);
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}}inline auto d3(int arg) noexcept(true) -> int;{{$}}
-inline int d4(int arg) try { } catch(...) { }
+inline int d4(int arg) try { return 0; } catch(...) { return 0; }
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
-// CHECK-FIXES: {{^}}inline auto d4(int arg) -> int try { } catch(...) { }{{$}}
+// CHECK-FIXES: {{^}}inline auto d4(int arg) -> int try { return 0; } catch(...) { return 0; }{{$}}
int d5(int arg) throw();
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}}auto d5(int arg) throw() -> int;{{$}}
@@ -167,9 +167,9 @@ namespace N {
}
// CHECK-MESSAGES: :[[@LINE-2]]:9: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}} auto e1() -> int;{{$}}
-int N::e1() {}
+int N::e1() { return 0; }
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
-// CHECK-FIXES: {{^}}auto N::e1() -> int {}{{$}}
+// CHECK-FIXES: {{^}}auto N::e1() -> int { return 0; }{{$}}
//
// Functions with unsupported return types
@@ -260,14 +260,14 @@ struct B {
B& operator=(const B&);
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}} auto operator=(const B&) -> B&;{{$}}
-
+
double base1(int, bool b);
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}} auto base1(int, bool b) -> double;{{$}}
- virtual double base2(int, bool b) {}
+ virtual double base2(int, bool b) { return 0; }
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
-// CHECK-FIXES: {{^}} virtual auto base2(int, bool b) -> double {}{{$}}
+// CHECK-FIXES: {{^}} virtual auto base2(int, bool b) -> double { return 0; }{{$}}
virtual float base3() const = 0;
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
@@ -298,9 +298,9 @@ struct B {
// CHECK-FIXES: {{^}} virtual auto base9() const noexcept -> const char * { return ""; }{{$}}
};
-double B::base1(int, bool b) {}
+double B::base1(int, bool b) { return 0; }
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
-// CHECK-FIXES: {{^}}auto B::base1(int, bool b) -> double {}{{$}}
+// CHECK-FIXES: {{^}}auto B::base1(int, bool b) -> double { return 0; }{{$}}
struct D : B {
virtual double f1(int, bool b) final;
@@ -311,9 +311,9 @@ struct D : B {
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}} virtual auto base2(int, bool b) -> double override;{{$}}
- virtual float base3() const override final { }
+ virtual float base3() const override final { return 0; }
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
-// CHECK-FIXES: {{^}} virtual auto base3() const -> float override final { }{{$}}
+// CHECK-FIXES: {{^}} virtual auto base3() const -> float override final { return 0; }{{$}}
const char * base9() const noexcept override { return ""; }
// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
@@ -586,13 +586,13 @@ void c(int arg) { return; }
struct D2 : B {
D2();
virtual ~D2();
-
+
virtual auto f1(int, bool b) -> double final;
virtual auto base2(int, bool b) -> double override;
- virtual auto base3() const -> float override final { }
+ virtual auto base3() const -> float override final { return 0; }
operator double();
};
auto l1 = [](int arg) {};
-auto l2 = [](int arg) -> double {};
+auto l2 = [](int arg) -> double { return 0; };
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h
index a40b2b2ece52e..1dcdd7a5ea4b4 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h
@@ -12,4 +12,4 @@ int f1(int n, ABC v1); // line 11
-int f2( int n, const ABC& v2); // line 15
+void f2( int n, const ABC& v2); // line 15
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h
index 94916755ddafe..d6f6e65ace79d 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h
@@ -12,4 +12,4 @@ int f1(int n, ABC v1); // line 11
-int f2( int n, ABC v2); // line 15
+void f2( int n, ABC v2); // line 15
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp
index 1dbd56b322202..a1edf5fae2f9e 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp
@@ -6,15 +6,15 @@ class basic_string {
public:
basic_string() {}
~basic_string() {}
- basic_string<T> *operator+=(const basic_string<T> &) {}
- friend basic_string<T> operator+(const basic_string<T> &, const basic_string<T> &) {}
+ basic_string<T> *operator+=(const basic_string<T> &);
+ friend basic_string<T> operator+(const basic_string<T> &, const basic_string<T> &);
};
typedef basic_string<char> string;
typedef basic_string<wchar_t> wstring;
}
void f(std::string) {}
-std::string g(std::string) {}
+std::string g(std::string);
int main() {
std::string mystr1, mystr2;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp
index 2b45bb719dbc5..8461248982447 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp
@@ -14,7 +14,7 @@ int f1(int n, ABC v1, ABC v2) {
// CHECK-FIXES: int f1(int n, const ABC& v1, const ABC& v2) {
return v1.get(n) + v2.get(n);
}
-int f2(int n, ABC v2) {
- // CHECK-MESSAGES: [[@LINE-1]]:19: warning: the parameter 'v2' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
- // CHECK-FIXES: int f2(int n, const ABC& v2) {
+void f2(int n, ABC v2) {
+ // CHECK-MESSAGES: [[@LINE-1]]:20: warning: the parameter 'v2' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
+ // CHECK-FIXES: void f2(int n, const ABC& v2) {
}
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h
index abbf7dfa48395..bbedc9b1df2dc 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h
@@ -4,4 +4,4 @@ void style_first_good();
void styleFirstBad();
-int thisIsMainLikeIgnored(int argc, const char *argv[]) {}
+int thisIsMainLikeIgnored(int argc, const char *argv[]) { return 0; }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h
index 9d3e846a080b9..3b3b1e9508e8f 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h
@@ -4,4 +4,4 @@ void STYLE_SECOND_GOOD();
void styleSecondBad();
-int thisIsMainLikeNotIgnored(int argc, const char *argv[]) {}
+int thisIsMainLikeNotIgnored(int argc, const char *argv[]) { return 0; }
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp
index 5131011118f30..0a154c5d23d47 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp
@@ -6,16 +6,16 @@
// Regression tests involving macros
#define CONCAT(a, b) a##b
-CONCAT(cons, t) int p22(){}
+CONCAT(cons, t) int p22(){ return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
// We warn, but we can't give a fix
#define CONSTINT const int
-CONSTINT p23() {}
+CONSTINT p23() { return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
#define CONST const
-CONST int p24() {}
+CONST int p24() { return 0; }
// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
#define CREATE_FUNCTION() \
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp
index 76a3555663b18..d913ab4dee9ba 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -std=c++14-or-later %s readability-const-return-type %t
+// RUN: %check_clang_tidy -std=c++14-or-later %s readability-const-return-type %t -- -- -Wno-error=return-type
// p# = positive test
// n# = negative test
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp
index 5ec1f221b2207..a6b95bdb57e4d 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp
@@ -32,6 +32,7 @@ class A {
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 'call_static_member' can be made static
// CHECK-FIXES: {{^}} static int call_static_member() {
already_static();
+ return 0;
}
int read_static() {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp
index be5ba54513c67..1771836539d86 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp
@@ -547,6 +547,7 @@ struct_type GlobalTypedefTestFunction(struct_type a_argument1) {
// CHECK-FIXES: {{^}}struct_type_t GlobalTypedefTestFunction(struct_type_t a_argument1) {
struct_type typedef_test_1;
// CHECK-FIXES: {{^}} struct_type_t typedef_test_1;
+ return {};
}
using my_struct_type = THIS___Structure;
@@ -777,8 +778,8 @@ STATIC_MACRO void someFunc(ValueType a_v1, const ValueType& a_v2) {}
// CHECK-FIXES: {{^}}STATIC_MACRO void someFunc(value_type_t a_v1, const value_type_t& a_v2) {}
STATIC_MACRO void someFunc(const ValueType** p_a_v1, ValueType (*p_a_v2)()) {}
// CHECK-FIXES: {{^}}STATIC_MACRO void someFunc(const value_type_t** p_a_v1, value_type_t (*p_a_v2)()) {}
-STATIC_MACRO ValueType someFunc() {}
-// CHECK-FIXES: {{^}}STATIC_MACRO value_type_t someFunc() {}
+STATIC_MACRO ValueType someFunc() { return {}; }
+// CHECK-FIXES: {{^}}STATIC_MACRO value_type_t someFunc() { return {}; }
STATIC_MACRO void someFunc(MyFunPtr, const MyFunPtr****) {}
// CHECK-FIXES: {{^}}STATIC_MACRO void someFunc(my_fun_ptr_t, const my_fun_ptr_t****) {}
#undef STATIC_MACRO
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp
index c4b7a77b92f0a..75f666e3e07e5 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp
@@ -465,7 +465,7 @@ struct S {
// CHECK-FIXES: S(bool a, bool b, bool c) : a(static_cast<int>(a)), b(b), c(static_cast<int>(c)) {}
};
-bool f(S& s) {
+void f(S& s) {
functionTaking<bool>(s.a);
// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> 'bool'
// CHECK-FIXES: functionTaking<bool>(s.a != 0);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp
index 8c6fb123ac023..c22e9c564e3ee 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp
@@ -37,8 +37,8 @@ void operator delete[](void *x) throw();
void operator delete[](void * /*x*/) throw();
struct X {
- X operator++(int) {}
- X operator--(int) {}
+ X operator++(int) { throw 0; }
+ X operator--(int) { throw 0; }
X(X&) = delete;
X &operator=(X&) = default;
@@ -86,22 +86,23 @@ void FDef2(int n, int) {}
void FNoDef(int);
class Z {};
+Z the_z;
-Z &operator++(Z&) {}
+Z &operator++(Z&) { return the_z; }
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
-// CHECK-FIXES: Z &operator++(Z& /*unused*/) {}
+// CHECK-FIXES: Z &operator++(Z& /*unused*/) { return the_z; }
-Z &operator++(Z&, int) {}
+Z &operator++(Z&, int) { return the_z; }
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
-// CHECK-FIXES: Z &operator++(Z& /*unused*/, int) {}
+// CHECK-FIXES: Z &operator++(Z& /*unused*/, int) { return the_z; }
-Z &operator--(Z&) {}
+Z &operator--(Z&) { return the_z; }
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
-// CHECK-FIXES: Z &operator--(Z& /*unused*/) {}
+// CHECK-FIXES: Z &operator--(Z& /*unused*/) { return the_z; }
-Z &operator--(Z&, int) {}
+Z &operator--(Z&, int) { return the_z; }
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
-// CHECK-FIXES: Z &operator--(Z& /*unused*/, int) {}
+// CHECK-FIXES: Z &operator--(Z& /*unused*/, int) { return the_z; }
namespace testing {
namespace internal {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c
index c2e8bf68b4ad7..dbcc4cf6d1022 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c
@@ -20,7 +20,7 @@ static int f(void);
static int f(void); // f
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration
// CHECK-FIXES: {{^}}// f{{$}}
-static int f(void) {}
+static int f(void) { return 0; }
inline void g(void) {}
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp
index be505f55b86b0..595eccf8854ba 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp
@@ -38,7 +38,7 @@ static int f();
static int f(); // f
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration
// CHECK-FIXES: {{^}}// f{{$}}
-static int f() {}
+static int f() { return 0; }
// Original check crashed for the code below.
namespace std {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp
index 202fe9be6d00c..a0d51dec7f32d 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp
@@ -264,7 +264,7 @@ struct Qptr {
}
};
-int func(Qptr qp) {
+void func(Qptr qp) {
qp->y = 10;
qp->K = 10;
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through instance [readability-static-accessed-through-instance]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp
index edd3591517af3..27db92be21f20 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp
@@ -382,7 +382,7 @@ enum opcode { Foo,
Bar };
static value *SimplifyRightShift(
opcode Opcode, value *Op0, value *Op1, bool isExact,
- const type1 &Q, unsigned MaxRecurse) {}
+ const type1 &Q, unsigned MaxRecurse) { return nullptr; }
static value *SimplifyLShrInst(value *Op0, value *Op1, bool isExact,
const type1 &Q, unsigned MaxRecurse) {
if (value *V = SimplifyRightShift(Foo, Op0, Op1, isExact, Q, MaxRecurse))
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp
index f67c20635064a..ff216298cfd60 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp
@@ -31,7 +31,7 @@ class Foo {
// CHECK-FIXES: _num2{};
};
-int should_use_emplace(std::vector<Foo> &v) {
+void should_use_emplace(std::vector<Foo> &v) {
v.push_back(Foo());
// CHECK-FIXES: v.emplace_back();
// CHECK-MESSAGES: warning: use emplace_back instead of push_back [hicpp-use-emplace,modernize-use-emplace]
>From 091a7313edf1fd5933c701813a0eb3fb196c693c Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Wed, 19 Feb 2025 21:45:38 +0100
Subject: [PATCH 5/8] Fix clangd tests
---
clang-tools-extra/clangd/unittests/ASTTests.cpp | 4 ++--
.../clangd/unittests/FindSymbolsTests.cpp | 6 ++++--
.../clangd/unittests/ParsedASTTests.cpp | 2 +-
.../clangd/unittests/QualityTests.cpp | 2 +-
clang-tools-extra/clangd/unittests/RenameTests.cpp | 10 +++++-----
.../clangd/unittests/SemanticHighlightingTests.cpp | 1 +
.../clangd/unittests/SemanticSelectionTests.cpp | 9 +++++----
.../clangd/unittests/SymbolInfoTests.cpp | 8 ++++++++
clang-tools-extra/clangd/unittests/XRefsTests.cpp | 14 ++++++++------
.../clangd/unittests/tweaks/DefineInlineTests.cpp | 4 ++--
.../unittests/tweaks/ExpandDeducedTypeTests.cpp | 4 ++--
.../unittests/tweaks/ExtractVariableTests.cpp | 1 +
12 files changed, 40 insertions(+), 25 deletions(-)
diff --git a/clang-tools-extra/clangd/unittests/ASTTests.cpp b/clang-tools-extra/clangd/unittests/ASTTests.cpp
index 32c8e8a63a215..d0bc3c4d7db98 100644
--- a/clang-tools-extra/clangd/unittests/ASTTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ASTTests.cpp
@@ -329,7 +329,7 @@ TEST(ClangdAST, GetContainedAutoParamType) {
auto &&d,
auto *&e,
auto (*f)(int)
- ){};
+ ){ return 0; };
int withoutAuto(
int a,
@@ -338,7 +338,7 @@ TEST(ClangdAST, GetContainedAutoParamType) {
int &&d,
int *&e,
int (*f)(int)
- ){};
+ ){ return 0; };
)cpp");
TU.ExtraArgs.push_back("-std=c++20");
auto AST = TU.build();
diff --git a/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp b/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp
index 4276a44275f53..282859c51a66f 100644
--- a/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp
@@ -113,7 +113,7 @@ TEST(WorkspaceSymbols, Unnamed) {
TEST(WorkspaceSymbols, InMainFile) {
TestTU TU;
TU.Code = R"cpp(
- int test() {}
+ int test() { return 0; }
static void test2() {}
)cpp";
EXPECT_THAT(getSymbols(TU, "test"),
@@ -537,12 +537,14 @@ TEST(DocumentSymbols, InHeaderFile) {
TestTU TU;
TU.AdditionalFiles["bar.h"] = R"cpp(
int foo() {
+ return 0;
}
)cpp";
TU.Code = R"cpp(
int i; // declaration to finish preamble
#include "bar.h"
int test() {
+ return 0;
}
)cpp";
EXPECT_THAT(getSymbols(TU.build()),
@@ -780,7 +782,7 @@ TEST(DocumentSymbols, FuncTemplates) {
TestTU TU;
Annotations Source(R"cpp(
template <class T>
- T foo() {}
+ T foo() { return T{}; }
auto x = foo<int>();
auto y = foo<double>();
diff --git a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
index 6ee641caeefe3..f9752d5d44f97 100644
--- a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
@@ -251,7 +251,7 @@ TEST(ParsedASTTest, NoCrashOnTokensWithTidyCheck) {
// this check runs the preprocessor, we need to make sure it does not break
// our recording logic.
TU.ClangTidyProvider = addTidyChecks("modernize-use-trailing-return-type");
- TU.Code = "inline int foo() {}";
+ TU.Code = "inline int foo() { return 0; }";
auto AST = TU.build();
const syntax::TokenBuffer &T = AST.getTokens();
diff --git a/clang-tools-extra/clangd/unittests/QualityTests.cpp b/clang-tools-extra/clangd/unittests/QualityTests.cpp
index 576779fa3270a..619ea32115357 100644
--- a/clang-tools-extra/clangd/unittests/QualityTests.cpp
+++ b/clang-tools-extra/clangd/unittests/QualityTests.cpp
@@ -108,7 +108,7 @@ TEST(QualityTests, SymbolRelevanceSignalExtraction) {
using flags::FLAGS_FOO;
- int ::header_main() {}
+ int ::header_main() { return 0; }
int main();
[[deprecated]]
diff --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 142ed171d1a1c..15866f43affa0 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -214,7 +214,7 @@ TEST(RenameTest, WithinFileRename) {
template<typename T>
class Foo {
public:
- static T [[f^oo]]() {}
+ static T [[f^oo]]() { return T(); }
};
void bar() {
@@ -225,7 +225,7 @@ TEST(RenameTest, WithinFileRename) {
template<typename T>
class Foo {
public:
- T [[f^oo]]() {}
+ T [[f^oo]]() { return T(); }
};
void bar() {
@@ -827,7 +827,7 @@ TEST(RenameTest, WithinFileRename) {
// Issue 170: Rename symbol introduced by UsingDecl
R"cpp(
- namespace ns { void [[f^oo]](); }
+ namespace ns { void [[f^oo]](); }
using ns::[[f^oo]];
@@ -1307,7 +1307,7 @@ TEST(RenameTest, Renameable) {
"no symbol", false},
{R"cpp(// FIXME we probably want to rename both overloads here,
- // but renaming currently assumes there's only a
+ // but renaming currently assumes there's only a
// single canonical declaration.
namespace ns { int foo(int); char foo(char); }
using ns::^foo;
@@ -1776,7 +1776,7 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) {
void [[foo]]() override {};
};
- void func(Base* b, Derived1* d1,
+ void func(Base* b, Derived1* d1,
Derived2* d2, NotDerived* nd) {
b->[[foo]]();
d1->[[foo]]();
diff --git a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
index 1ec51d862d0a6..94cecce1f038c 100644
--- a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -741,6 +741,7 @@ sizeof...($TemplateParameter[[Elements]]);
$Class[[Foo]].$Field_static[[sharedInstance]].$Field[[someProperty]] $Operator[[=]] 1;
self.$Field[[someProperty]] $Operator[[=]] self.$Field[[someProperty]] $Operator[[+]] self.$Field[[otherMethod]] $Operator[[+]] 1;
self->$Field[[_someProperty]] $Operator[[=]] $Field[[_someProperty]] $Operator[[+]] 1;
+ return 0;
}
@end
)cpp",
diff --git a/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp b/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
index 7faef6f95d8f9..7ede19c321bc6 100644
--- a/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
@@ -201,6 +201,7 @@ TEST(FoldingRanges, ASTAll) {
R"cpp(
#define FOO int foo() {\
int Variable = 42; \
+ return 0; \
}
// Do not generate folding range for braces within macro expansion.
@@ -336,18 +337,18 @@ TEST(FoldingRanges, PseudoParserWithoutLineFoldings) {
]]};
)cpp",
R"cpp(
- /*[[ Multi
+ /*[[ Multi
* line
- * comment
+ * comment
]]*/
)cpp",
R"cpp(
//[[ Comment
// 1]]
-
+
//[[ Comment
// 2]]
-
+
// No folding for single line comment.
/*[[ comment 3
diff --git a/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp b/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp
index 6c91f3783a622..95b6eaedce97c 100644
--- a/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp
@@ -36,6 +36,7 @@ TEST(SymbolInfoTests, All) {
void $decl[[foo]]();
int bar() {
fo^o();
+ return 0;
}
)cpp",
{ExpectedSymbolDetails{"foo", "", "c:@F at foo#", "decl"}}},
@@ -44,6 +45,7 @@ TEST(SymbolInfoTests, All) {
void $def[[foo]]() {}
int bar() {
fo^o();
+ return 0;
}
)cpp",
{ExpectedSymbolDetails{"foo", "", "c:@F at foo#", "def", "def"}}},
@@ -53,6 +55,7 @@ TEST(SymbolInfoTests, All) {
void $def[[foo]]() {}
int bar() {
fo^o();
+ return 0;
}
)cpp",
{ExpectedSymbolDetails{"foo", "", "c:@F at foo#", "decl", "def"}}},
@@ -83,6 +86,7 @@ TEST(SymbolInfoTests, All) {
void $decl[[foo]]();
int baz() {
fo^o();
+ return 0;
}
}
)cpp",
@@ -96,6 +100,7 @@ TEST(SymbolInfoTests, All) {
namespace barbar {
int baz() {
bar::fo^o();
+ return 0;
}
}
)cpp",
@@ -108,6 +113,7 @@ TEST(SymbolInfoTests, All) {
namespace Nbaz {
int baz() {
::fo^o();
+ return 0;
}
}
}
@@ -121,6 +127,7 @@ TEST(SymbolInfoTests, All) {
namespace barbar {
int baz() {
fo^o();
+ return 0;
}
}
)cpp",
@@ -136,6 +143,7 @@ TEST(SymbolInfoTests, All) {
int baz() {
bar::BarType b;
fo^o(b);
+ return 0;
}
}
)cpp",
diff --git a/clang-tools-extra/clangd/unittests/XRefsTests.cpp b/clang-tools-extra/clangd/unittests/XRefsTests.cpp
index 7d824d659ad2c..8d9838e8c40a2 100644
--- a/clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -95,7 +95,7 @@ TEST(HighlightsTest, All) {
)cpp",
R"cpp(// Function
- int [[^foo]](int) {}
+ int [[^foo]](int) { return 0; }
int main() {
[[foo]]([[foo]](42));
auto *X = &[[foo]];
@@ -2025,7 +2025,7 @@ TEST(FindReferences, WithinAST) {
)cpp",
R"cpp(// Function
- int $def[[foo]](int) {}
+ int $def[[foo]](int) { return 0; }
int main() {
auto *X = &$(main)[[^foo]];
$(main)[[foo]](42);
@@ -2045,7 +2045,7 @@ TEST(FindReferences, WithinAST) {
R"cpp(// Method call
struct Foo { int $decl(Foo)[[foo]](); };
- int Foo::$def(Foo)[[foo]]() {}
+ int Foo::$def(Foo)[[foo]]() { return 0; }
int main() {
Foo f;
f.$(main)[[^foo]]();
@@ -2143,7 +2143,7 @@ TEST(FindReferences, WithinAST) {
)cpp",
R"cpp(// Dependent code
template <typename T> void $decl[[foo]](T t);
- template <typename T> void bar(T t) { $(bar)[[foo]](t); } // foo in bar is uninstantiated.
+ template <typename T> void bar(T t) { $(bar)[[foo]](t); } // foo in bar is uninstantiated.
void baz(int x) { $(baz)[[f^oo]](x); }
)cpp",
R"cpp(
@@ -2353,6 +2353,7 @@ TEST(FindReferences, ExplicitSymbols) {
X $def(test)[[a]];
$(test)[[a]].operator bool();
if ($(test)[[a^]]) {} // ignore implicit conversion-operator AST node
+ return 0;
}
)cpp",
};
@@ -2388,7 +2389,7 @@ TEST(FindReferences, UsedSymbolsFromInclude) {
#define BAR 5
int bar1();
int bar2();
- class Bar {};
+ class Bar {};
)cpp");
TU.AdditionalFiles["system/vector"] = guard(R"cpp(
namespace std {
@@ -2405,7 +2406,7 @@ TEST(FindReferences, UsedSymbolsFromInclude) {
std::vector<Matcher<ReferencesResult::Reference>> ExpectedLocations;
for (const auto &R : T.ranges())
ExpectedLocations.push_back(AllOf(rangeIs(R), attrsAre(0u)));
- for (const auto &P : T.points())
+ for (const auto &P : T.points())
EXPECT_THAT(findReferences(AST, P, 0).References,
UnorderedElementsAreArray(ExpectedLocations))
<< "Failed for Refs at " << P << "\n"
@@ -2480,6 +2481,7 @@ TEST(FindReferences, NeedsIndexForMacro) {
Annotations IndexedMain(R"cpp(
int indexed_main() {
int a = [[MACRO]](1);
+ return 0;
}
)cpp");
diff --git a/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
index 8d496b2a3ee73..4e5e5a37ba60e 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
@@ -935,10 +935,10 @@ TEST_F(DefineInlineTest, AddInline) {
// Check we put inline before cv-qualifiers.
ExtraFiles["a.h"] = "const int foo();";
apply(R"cpp(#include "a.h"
- const int fo^o() {})cpp",
+ const int fo^o() { return 0; })cpp",
&EditedFiles);
EXPECT_THAT(EditedFiles, testing::ElementsAre(FileWithContents(
- testPath("a.h"), "inline const int foo(){}")));
+ testPath("a.h"), "inline const int foo(){ return 0; }")));
// No double inline.
ExtraFiles["a.h"] = "inline void foo();";
diff --git a/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp
index 3730ab4a87136..8da394d74b54d 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp
@@ -69,8 +69,8 @@ TEST_F(ExpandDeducedTypeTest, Test) {
EXPECT_THAT(apply(R"cpp(au^to s = &"foobar";)cpp"),
StartsWith("fail: Could not expand type"));
- EXPECT_EQ(apply("ns::Class * foo() { au^to c = foo(); }"),
- "ns::Class * foo() { ns::Class * c = foo(); }");
+ EXPECT_EQ(apply("ns::Class * foo() { au^to c = foo(); return nullptr; }"),
+ "ns::Class * foo() { ns::Class * c = foo(); return nullptr; }");
EXPECT_EQ(
apply("void ns::Func() { au^to x = new ns::Class::Nested{}; }"),
"void ns::Func() { ns::Class::Nested * x = new ns::Class::Nested{}; }");
diff --git a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
index 552e693c0363a..3c65a58d6c945 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
@@ -116,6 +116,7 @@ TEST_F(ExtractVariableTest, Test) {
struct T {
int bar(int a = [[1]]) {
int b = [[z]];
+ return 0;
}
int z = [[1]];
} t;
>From e42e46a1f1a2606a207c897263be64e266d9a702 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Wed, 19 Feb 2025 21:57:38 +0100
Subject: [PATCH 6/8] Fix compiler-rt test
---
compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c b/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c
index 94432f820211f..e95f4c8c4fd43 100644
--- a/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c
+++ b/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c
@@ -1,4 +1,4 @@
-// RUN: %clang_hwasan -Wno-error=return-type %s -o %t && %env_hwasan_opts=random_tags=1 %run %t
+// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=random_tags=1 %run %t
#include <pthread.h>
#include <sanitizer/hwasan_interface.h>
@@ -11,6 +11,7 @@ void *ThreadFn(void *) {
__hwasan_enable_allocator_tagging();
// This will trigger memory deallocation in __strerror_thread_freeres,
// at a point when HwasanThread is already gone.
+ return NULL;
}
int main() {
>From 7fefe948f204a3a3deaee654b9e727061f459885 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Wed, 19 Feb 2025 22:01:13 +0100
Subject: [PATCH 7/8] Remove non-test changes for now
---
clang/docs/ReleaseNotes.rst | 4 ----
clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index a2b1adbd1c070..5780f5d61d579 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -36,10 +36,6 @@ Potentially Breaking Changes
- The Objective-C ARC migrator (ARCMigrate) has been removed.
-- ``-Wreturn-type`` now defaults to an error in all language modes; like other
- warnings, it can be reverted to just being a warning by specifying
- ``-Wno-error=return-type``.
-
C/C++ Language Potentially Breaking Changes
-------------------------------------------
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index eae616db64e66..feef50812eca9 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -717,7 +717,7 @@ def warn_falloff_nonvoid : Warning<
"non-void "
"%enum_select<FalloffFunctionKind>{%Function{function}|%Block{block}|%Lambda{lambda}|%Coroutine{coroutine}}0"
" does not return a value%select{| in all control paths}1">,
- InGroup<ReturnType>, DefaultError;
+ InGroup<ReturnType>;
def err_falloff_nonvoid : Error<
"non-void %select{function|block|lambda|coroutine}0 "
"does not return a value%select{| in all control paths}1">;
>From c71980955340457319130d16780d4194673f9550 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Wed, 19 Feb 2025 22:07:26 +0100
Subject: [PATCH 8/8] Revert this test for now
---
clang/test/Index/warning-flags.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/Index/warning-flags.c b/clang/test/Index/warning-flags.c
index 3229f000c4ae0..1694c6abab562 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: error: non-void function does not return a value
+// CHECK-BOTH-WARNINGS: warning: non-void function does not return a value
// CHECK-BOTH-WARNINGS: warning: incompatible pointer types returning 'float *' from a function with result type 'int *'
// CHECK-SECOND-WARNING-NOT:non-void function does not return a value
More information about the llvm-commits
mailing list