Skip to content

Commit

Permalink
[llvm-cov] Properly fix -Wcovered-switch-default in CoverageMapping.cpp
Browse files Browse the repository at this point in the history
And revert commit 1f3fa96.
  • Loading branch information
MaskRay committed Sep 24, 2023
1 parent 6876514 commit dd8902a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,33 +964,31 @@ static std::string getCoverageMapErrString(coveragemap_error Err,
std::string Msg;
raw_string_ostream OS(Msg);

switch ((uint32_t)Err) {
case (uint32_t)coveragemap_error::success:
switch (Err) {
case coveragemap_error::success:
OS << "success";
break;
case (uint32_t)coveragemap_error::eof:
case coveragemap_error::eof:
OS << "end of File";
break;
case (uint32_t)coveragemap_error::no_data_found:
case coveragemap_error::no_data_found:
OS << "no coverage data found";
break;
case (uint32_t)coveragemap_error::unsupported_version:
case coveragemap_error::unsupported_version:
OS << "unsupported coverage format version";
break;
case (uint32_t)coveragemap_error::truncated:
case coveragemap_error::truncated:
OS << "truncated coverage data";
break;
case (uint32_t)coveragemap_error::malformed:
case coveragemap_error::malformed:
OS << "malformed coverage data";
break;
case (uint32_t)coveragemap_error::decompression_failed:
case coveragemap_error::decompression_failed:
OS << "failed to decompress coverage data (zlib)";
break;
case (uint32_t)coveragemap_error::invalid_or_missing_arch_specifier:
case coveragemap_error::invalid_or_missing_arch_specifier:
OS << "`-arch` specifier is invalid or missing for universal binary";
break;
default:
llvm_unreachable("invalid coverage mapping error.");
}

// If optional error message is not empty, append it to the message.
Expand Down

0 comments on commit dd8902a

Please sign in to comment.