Sockke added a comment. Any thoughts? : )
================ Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:49 +void forEachFieldWithFilter(const RecordDecl &Record, const T &Fields, + bool &AnyMemberHasInitPerUnion, Func &&Fn) { + for (const FieldDecl *F : Fields) { ---------------- MTC wrote: > Can it be modified to the following form? Or further abstract `filter` into a > parameter to make this function more general. > > > ``` > template <typename T, typename Func> > void forEachFieldWithFilter(const RecordDecl &Record, const T &Fields, > bool &AnyMemberHasInitPerUnion, Func &&Fn) { > forEachField(Record, Fields, Fn); > if (Record.isUnion() && AnyMemberHasInitPerUnion) > break; > } > ``` > Can it be modified to the following form? Or further abstract `filter` into a > parameter to make this function more general. > > > ``` > template <typename T, typename Func> > void forEachFieldWithFilter(const RecordDecl &Record, const T &Fields, > bool &AnyMemberHasInitPerUnion, Func &&Fn) { > forEachField(Record, Fields, Fn); > if (Record.isUnion() && AnyMemberHasInitPerUnion) > break; > } > ``` This does not seem to work, because the "AnyMemberHasInitPerUnion" needs to be passed along the call stack. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108370/new/ https://reviews.llvm.org/D108370 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits