[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)
Carlos Galvez via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 7 23:47:43 PDT 2025
================
@@ -119,13 +119,18 @@ UseDesignatedInitializersCheck::UseDesignatedInitializersCheck(
void UseDesignatedInitializersCheck::registerMatchers(MatchFinder *Finder) {
const auto HasBaseWithFields =
hasAnyBase(hasType(cxxRecordDecl(has(fieldDecl()))));
+
+ // see #133715
+ const auto IsSTLArray =
+ hasType(qualType(hasDeclaration(recordDecl(hasName("::std::array")))));
----------------
carlosgalvezp wrote:
I can imagine this issue can trigger on other similar cases, for example if one creates their own `std::array` class.
Can we make this a bit more generic, for example not warn of 1) the class is an aggregate and 2) it contains only one member and 3) that member is an array type?
https://github.com/llvm/llvm-project/pull/134774
More information about the cfe-commits
mailing list