[clang-tools-extra] [clang-tidy]Fix PreferMemberInitializer false positive for reassignment (PR #70316)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 27 07:14:21 PDT 2023
================
@@ -156,6 +153,49 @@ void PreferMemberInitializerCheck::check(
const CXXRecordDecl *Class = Ctor->getParent();
bool FirstToCtorInits = true;
+ std::map<const FieldDecl *, AssignedLevel> AssignedFields{};
+
+ // Checks if Field is initialised using a field that will be initialised after
+ // it.
+ // TODO: Probably should guard against function calls that could have side
+ // effects or if they do reference another field that's initialized before
+ // this field, but is modified before the assignment.
+ auto UpdateAssignmentLevel = [Ctor, &AssignedFields](const FieldDecl *Field,
----------------
PiotrZSL wrote:
Move this lambda to separate method, this method is already big.
https://github.com/llvm/llvm-project/pull/70316
More information about the cfe-commits
mailing list