[PATCH] D118782: clangd: Add a break for every case in the PopulateSwitch tweak

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 4 05:53:49 PST 2022


kadircet added a comment.

I agree with Sam on this one and remember having some (possibly offline) discussions around not having those breaks explicitly (we should've documented the reasoning, sorry).

As pointed out, I believe the main benefit is not spelling out each enum value (it's usually hard to figure out which ones are missing, requires constant switching between enum declaration and switch body, and then do some copy/paste or write them).
After those are spelled the developer needs to make a decision about how they'll be handled anyway and if some enum value requires special handling adding the extra break by hand is not too much of a burden, but deleting those when the intent is to have fall through, is extra burden and it might be unclear which ones are new labels.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118782



More information about the cfe-commits mailing list