[clang-tools-extra] [clang-tidy]Fix PreferMemberInitializer false positive for reassignment (PR #70316)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 26 05:51:17 PDT 2023


================
@@ -54,31 +56,43 @@ static bool shouldBeDefaultMemberInitializer(const Expr *Value) {
 }
 
 namespace {
+
 AST_MATCHER_P(FieldDecl, indexNotLessThan, unsigned, Index) {
   return Node.getFieldIndex() >= Index;
 }
+
+enum class AssignedLevel { None, Assigned, UnsafetyAssigned };
----------------
PiotrZSL wrote:

Maybe use some more clear names, I do not like "UnsafetyAssigned" here. Maybe something that would say whats wrong, like `enum class AssignmentLevel { None, Default, ToReference, UnsafeToChange};`

https://github.com/llvm/llvm-project/pull/70316


More information about the cfe-commits mailing list