[llvm] dd8902a - [llvm-cov] Properly fix -Wcovered-switch-default in CoverageMapping.cpp

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 24 12:06:19 PDT 2023


Author: Fangrui Song
Date: 2023-09-24T12:06:15-07:00
New Revision: dd8902ab3bb1aa47b8ef18a9ee47880a16cccb60

URL: https://github.com/llvm/llvm-project/commit/dd8902ab3bb1aa47b8ef18a9ee47880a16cccb60
DIFF: https://github.com/llvm/llvm-project/commit/dd8902ab3bb1aa47b8ef18a9ee47880a16cccb60.diff

LOG: [llvm-cov] Properly fix -Wcovered-switch-default in CoverageMapping.cpp

And revert commit 1f3fa96e516fda26244afb8877e6cee619c21205.

Added: 
    

Modified: 
    llvm/lib/ProfileData/Coverage/CoverageMapping.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index f8466bc8f7eb891..4a3244d12087524 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -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.


        


More information about the llvm-commits mailing list