[clang-tools-extra] [clang-tidy] Enable `modernize-return-braced-init-list`'s tests in C++11 (PR #158196)
Victor Chernyakin via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 17 07:54:26 PDT 2025
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/158196
>From 404ddb7f7bf62680bfc8fbd4d6306525ac9dd8a7 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
Date: Thu, 11 Sep 2025 21:44:22 -0700
Subject: [PATCH 1/2] [clang-tidy] Enable `modernize-return-braced-init-list`'s
tests in C++11
---
.../clang-tidy/checkers/modernize/return-braced-init-list.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp
index 02e95e15499dc..1450a6d1e60ce 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -std=c++14-or-later %s modernize-return-braced-init-list %t
+// RUN: %check_clang_tidy %s modernize-return-braced-init-list %t
namespace std {
typedef decltype(sizeof(int)) size_t;
@@ -80,10 +80,12 @@ Foo f2() {
return {b2};
}
+#if __cplusplus >= 201402L
auto f3() {
Bar b3;
return Foo(b3);
}
+#endif
#define A(b) Foo(b)
>From 7b6a23aafd94caa0127f06f2847a0eed80a85a86 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
Date: Wed, 17 Sep 2025 08:54:18 -0600
Subject: [PATCH 2/2] Specify std explicitly
---
.../clang-tidy/checkers/modernize/return-braced-init-list.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp
index 1450a6d1e60ce..ae33d25d49152 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/return-braced-init-list.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s modernize-return-braced-init-list %t
+// RUN: %check_clang_tidy -std=c++11-or-later %s modernize-return-braced-init-list %t
namespace std {
typedef decltype(sizeof(int)) size_t;
More information about the cfe-commits
mailing list