This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fix invalid fix-it for cppcoreguidelines-prefer-member-initializer
ClosedPublic

Authored by njames93 on Feb 3 2022, 11:04 AM.

Diff Detail

Event Timeline

njames93 created this revision.Feb 3 2022, 11:04 AM
njames93 requested review of this revision.Feb 3 2022, 11:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2022, 11:04 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
simon.giesecke added inline comments.
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp
537

Can this be renamed to something describing the test case? E.g. AlreadyHasInitializer (and the case above might be renamed to AlreadyHasDefaultInitializer to differentiate the two cases)

JonasToth added inline comments.
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp
550

could you please add a test-case for initializer lists, like std::vector? Or is this not supported?

njames93 updated this revision to Diff 405919.Feb 4 2022, 4:09 AM

Rename test case

njames93 marked 2 inline comments as done.Feb 4 2022, 4:09 AM
njames93 added inline comments.
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp
550

That's not what this fix is about.

clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp
252

I'm not a fan of using bit-wise operators on booleans, but I see that
the code for this check was already doing that.
(See https://github.com/llvm/llvm-project/issues/40307)

293–308

I'm not a fan of double negatives either :)

This revision is now accepted and ready to land.Feb 4 2022, 10:13 AM
njames93 updated this revision to Diff 410187.Feb 20 2022, 2:50 PM
njames93 marked 2 inline comments as done.

Remove double negative

Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 11:14 AM