Skip to content
Snippets Groups Projects
Unverified Commit 16332508 authored by Hana Joo's avatar Hana Joo Committed by Nathan James
Browse files

[clang-tidy] Enable the use of IgnoreArray flag in pro-type-member-init rule

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
parent 0fb364a9
No related branches found
No related tags found
No related merge requests found
......@@ -402,6 +402,8 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
// 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) &&
......
// 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;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment