[clang-tools-extra] [clang-tidy] modernize-return-braced-init-list: skip types with an initializer_list constructor (PR #205440)

Yuxuan Chen via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 12:07:32 PDT 2026


================
@@ -16,6 +18,25 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::modernize {
 
+static bool hasInitListConstructor(const CXXRecordDecl *RD) {
+  if (RD == nullptr || !RD->hasDefinition())
+    return false;
+  auto IsInitListCtor = [](const CXXConstructorDecl *Ctor) {
+    return Ctor->hasOneParamOrDefaultArgs() &&
+           utils::type_traits::isStdInitializerList(
+               Ctor->getParamDecl(0)->getType().getNonReferenceType());
----------------
yuxuanchen1997 wrote:

Are we concerned about the case where `getNumParams() == 0`?

https://github.com/llvm/llvm-project/pull/205440


More information about the cfe-commits mailing list