[PATCH] D40737: [clang-tidy] Resubmit hicpp-multiway-paths-covered without breaking test
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 21 07:28:46 PDT 2018
JonasToth added inline comments.
================
Comment at: clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp:119
+ if (!SwitchHasDefault && SwitchCaseCount == 0) {
+ diag(Switch->getLocStart(), "degenerated switch without labels");
+ return;
----------------
aaron.ballman wrote:
> I think a better way to phrase this one is: "switch statement without labels has no effect" and perhaps have a fix-it to replace the entire switch construct with its predicate?
The fixit would only aim for the sideeffects the predicate has, right? I would consider such a switch as a bug or are there reasonable things to accomplish? Given its most likely unintended code i dont think a fixit is good.
Fixing the code removes the warning and might introduce a bug.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D40737
More information about the cfe-commits
mailing list