[PATCH] D147929: [clang-tidy] Fix handling of UseAssignment option in cppcoreguidelines-prefer-member-initializer

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 04:48:02 PDT 2023


carlosgalvezp added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp:134
+          Options.get("UseAssignment",
+                      OptionsView("modernize-use-default-member-init",
+                                  Context->getOptions().CheckOptions, Context)
----------------
This is very strange, feels like it's done to ensure the checks are in sync but IMO it creates more harm than good and makes the check harder to maintain. The checks are independent anyway (not aliases), so I believe it makes sense to keep being independent also in the options.

There are similar checks (e.g. magic numbers) where the user needs to either only enable one of the checks, or enter the same configuration settings twice.

I would vote for just treating this like an independent argument like all other checks, to avoid bugs like these.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147929/new/

https://reviews.llvm.org/D147929



More information about the cfe-commits mailing list