The `IgnoreArray` flag was not used before while running the rule. Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=47288 | b/47288 ]]
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D101239
// Gather all fields (direct and indirect) that need to be initialized.
SmallPtrSet<const FieldDecl *, 16> FieldsToInit;
forEachField(ClassDecl, ClassDecl.fields(), [&](const FieldDecl *F) {
+ if (IgnoreArrays && F->getType()->isArrayType())
+ return;
if (!F->hasInClassInitializer() &&
utils::type_traits::isTriviallyDefaultConstructible(F->getType(),
Context) &&
--- /dev/null
+// RUN: %check_clang_tidy %s \
+// RUN: cppcoreguidelines-pro-type-member-init %t \
+// RUN: -config="{CheckOptions: \
+// RUN: [{key: cppcoreguidelines-pro-type-member-init.IgnoreArrays, value: true} ]}"
+
+typedef int TypedefArray[4];
+using UsingArray = int[4];
+
+struct HasArrayMember {
+ HasArrayMember() {}
+ // CHECK-MESSAGES: warning: constructor does not initialize these fields: Number
+ UsingArray U;
+ TypedefArray T;
+ int RawArray[4];
+ int Number;
+};