[flang-commits] [flang] 872aa45 - [Semantics] Properly fix -Wcovered-switch-default after 6d1c183c6f8be717e466f6c55f74729d178c8ee2

Fangrui Song via flang-commits flang-commits at lists.llvm.org
Thu Sep 7 20:57:14 PDT 2023


Author: Fangrui Song
Date: 2023-09-07T20:57:09-07:00
New Revision: 872aa457ba90a90d2005293eebf1775b76a78b59

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

LOG: [Semantics] Properly fix -Wcovered-switch-default after 6d1c183c6f8be717e466f6c55f74729d178c8ee2

And revert commit 9168fcacd8b3e3e4f17b12d4ea37dd7038c53640
"[flang] Fix -Wcovered-switch-default in resolve-directives.cpp (NFC)"

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-directives.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 8c3cc844f322c6..f72334e1506da0 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -533,28 +533,25 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
     if (const auto &maptype{std::get<std::optional<parser::OmpMapType>>(x.t)}) {
       using Type = parser::OmpMapType::Type;
       const Type &type{std::get<Type>(maptype->t)};
-      switch ((uint32_t)type) { // Avoid -Wcovered-switch-default
-      case (uint32_t)Type::To:
+      switch (type) {
+      case Type::To:
         ompFlag = Symbol::Flag::OmpMapTo;
         break;
-      case (uint32_t)Type::From:
+      case Type::From:
         ompFlag = Symbol::Flag::OmpMapFrom;
         break;
-      case (uint32_t)Type::Tofrom:
+      case Type::Tofrom:
         ompFlag = Symbol::Flag::OmpMapToFrom;
         break;
-      case (uint32_t)Type::Alloc:
+      case Type::Alloc:
         ompFlag = Symbol::Flag::OmpMapAlloc;
         break;
-      case (uint32_t)Type::Release:
+      case Type::Release:
         ompFlag = Symbol::Flag::OmpMapRelease;
         break;
-      case (uint32_t)Type::Delete:
+      case Type::Delete:
         ompFlag = Symbol::Flag::OmpMapDelete;
         break;
-      default:
-        assert(false && "Unsupported map-type");
-        break;
       }
     }
     const auto &ompObjList{std::get<parser::OmpObjectList>(x.t)};


        


More information about the flang-commits mailing list