[PATCH] D37808: [clang-tidy] Add new hicpp-multiway-paths-covered check for missing branches

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 12:25:24 PDT 2017


JonasToth added a comment.

F5426271: llvm_lib_target_x86_paths <https://reviews.llvm.org/F5426271>
Example output for `llvm/lib/Target/X86`
Running it over the whole `llvm/lib` codebase generates a lot of warnings. Please note, that it seems to be common to write code like this:

  int Val;
  switch(Val) {
    case 1: // something
    case 2: // something else
    case 16: // magic
  }
  llvm_unreachable("reason");

In some cases it has been taken care that no fallthrough happens, but it's not so simple to spot. Using `default: llvm_unreachable("reason");` would comply with the check.


https://reviews.llvm.org/D37808





More information about the cfe-commits mailing list