This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Simplify static assert check
AcceptedPublic

Authored by steveire on Feb 7 2021, 11:05 AM.

Diff Detail

Event Timeline

steveire created this revision.Feb 7 2021, 11:05 AM
steveire requested review of this revision.Feb 7 2021, 11:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2021, 11:05 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
njames93 accepted this revision.Feb 12 2021, 8:34 AM

LG with a few nits.

clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp
49–52

Can this be cleaned up to use optionally matcher.

59–61

Can't you use the mapAnyOf matcher here?

This revision is now accepted and ready to land.Feb 12 2021, 8:34 AM
This revision was automatically updated to reflect the committed changes.
lebedev.ri reopened this revision.May 30 2021, 6:48 AM
lebedev.ri added a subscriber: lebedev.ri.

Reverted in be6b9e8ae71768d2e09ec14619ca4ecfdef553fa - https://godbolt.org/z/3zdqvbfxj
While there, please ensure that other such simplifications don't have similar lingering effects.

This revision is now accepted and ready to land.May 30 2021, 6:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2021, 6:48 AM
lebedev.ri requested changes to this revision.May 30 2021, 6:48 AM
This revision now requires changes to proceed.May 30 2021, 6:48 AM

Reverted in be6b9e8ae71768d2e09ec14619ca4ecfdef553fa - https://godbolt.org/z/3zdqvbfxj
While there, please ensure that other such simplifications don't have similar lingering effects.

Thanks for catching the issue!

FWIW, I think that reverting something several months after it lands is a bit disruptive and the test case causing the revert feels arbitrary without further context that should have been explicitly mentioned in the reverting commit message. The context is that this change broke a test that should have caught the failure: https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/clang-tidy/checkers/misc-static-assert.cpp#L86-L87 which led to this bug report: https://bugs.llvm.org/show_bug.cgi?id=50532. I'm still not convinced the correct action was to revert a change with no discussion that already was shipped in a release, however. Next time, I think it'd be a bit friendlier to mention the regression on the patch to see if the author can do a quick fix -- if no one noticed it for almost four months, it's hard to argue it's a critical issue that needs an immediate revert. (The reversion mildly worries me because this change already shipped as part of Clang 12 and larger reversions make for harder git blame logic to follow along with, both of which can lead to potential confusion for folks.)

xbolva00 added a subscriber: xbolva00.EditedMay 30 2021, 7:56 AM

Reverted in be6b9e8ae71768d2e09ec14619ca4ecfdef553fa - https://godbolt.org/z/3zdqvbfxj
While there, please ensure that other such simplifications don't have similar lingering effects.

Thanks for catching the issue!

FWIW, I think that reverting something several months after it lands is a bit disruptive and the test case causing the revert feels arbitrary without further context that should have been explicitly mentioned in the reverting commit message. The context is that this change broke a test that should have caught the failure: https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/clang-tidy/checkers/misc-static-assert.cpp#L86-L87 which led to this bug report: https://bugs.llvm.org/show_bug.cgi?id=50532. I'm still not convinced the correct action was to revert a change with no discussion that already was shipped in a release, however. Next time, I think it'd be a bit friendlier to mention the regression on the patch to see if the author can do a quick fix -- if no one noticed it for almost four months, it's hard to argue it's a critical issue that needs an immediate revert. (The reversion mildly worries me because this change already shipped as part of Clang 12 and larger reversions make for harder git blame logic to follow along with, both of which can lead to potential confusion for folks.)

And LLVM policy agrees with you.

Reverts should be reasonably timely. A change submitted two hours ago can be reverted without prior discussion. A change submitted two years ago should not be. Where exactly the transition point is is hard to say, but it’s probably in the handful of days in tree territory. If you are unsure, we encourage you to reply to the commit thread, give the author a bit to respond, and then proceed with the revert if the author doesn’t seem to be actively responding.

https://llvm.org/docs/DeveloperPolicy.html

lebedev.ri resigned from this revision.Jan 12 2023, 4:50 PM

This review seems to be stuck/dead, consider abandoning if no longer relevant.

This revision is now accepted and ready to land.Jan 12 2023, 4:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 4:50 PM