Page MenuHomePhabricator

Catch trivially true statements of the form a != 1 || a != 3. Statements like these are likely errors. They are particularly easy to miss when handling enums: enum State { RUNNING, STOPPED, STARTING, ENDING } ... if (state != RUNNING || state !=...
AbandonedPublic

Authored by watsond on Feb 10 2017, 4:51 PM.

Details

Reviewers
etienneb
alexfh
Summary

...ENDING)
...

[clang-tidy] Catch trivially true statements like a != 1 || a != 3

Event Timeline

watsond created this revision.Feb 10 2017, 4:51 PM
watsond updated this revision to Diff 88072.Feb 10 2017, 4:52 PM

Updating D29857: Catch trivially true statements of the form a != 1 || a != 3. Statements like

these are likely errors. They are particularly easy to miss when handling enums:

enum State {
RUNNING,
STOPPED,
STARTING,
ENDING
}

...
if (state != RUNNING || state !=...

watsond abandoned this revision.Feb 10 2017, 4:53 PM

Apologies all. I messed up the formatting. Resubmitting in a second.

etienneb edited edge metadata.Feb 13 2017, 8:27 AM

which one is the final version?

https://reviews.llvm.org/D25946

Please close one of them.