[flang-commits] [PATCH] D125119: [flang] Fix to UnwrapConvertedExpr()

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon May 9 16:39:26 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6f14dbedd942: [flang] Fix to UnwrapConvertedExpr() (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125119

Files:
  flang/include/flang/Evaluate/tools.h


Index: flang/include/flang/Evaluate/tools.h
===================================================================
--- flang/include/flang/Evaluate/tools.h
+++ flang/include/flang/Evaluate/tools.h
@@ -219,16 +219,22 @@
   } else if constexpr (std::is_same_v<Ty, Expr<SomeType>>) {
     return common::visit(
         [](auto &x) { return UnwrapConvertedExpr<A>(x); }, x.u);
-  } else if constexpr (!common::HasMember<A, TypelessExpression>) {
-    using Result = ResultType<A>;
-    if constexpr (std::is_same_v<Ty, Expr<Result>> ||
-        std::is_same_v<Ty, Expr<SomeKind<Result::category>>>) {
+  } else {
+    using DesiredResult = ResultType<A>;
+    if constexpr (std::is_same_v<Ty, Expr<DesiredResult>> ||
+        std::is_same_v<Ty, Expr<SomeKind<DesiredResult::category>>>) {
       return common::visit(
           [](auto &x) { return UnwrapConvertedExpr<A>(x); }, x.u);
-    } else if constexpr (std::is_same_v<Ty, Parentheses<Result>> ||
-        std::is_same_v<Ty, Convert<Result, Result::category>>) {
-      return common::visit(
-          [](auto &x) { return UnwrapConvertedExpr<A>(x); }, x.left().u);
+    } else {
+      using ThisResult = ResultType<B>;
+      if constexpr (std::is_same_v<Ty, Expr<ThisResult>>) {
+        return common::visit(
+            [](auto &x) { return UnwrapConvertedExpr<A>(x); }, x.u);
+      } else if constexpr (std::is_same_v<Ty, Parentheses<ThisResult>> ||
+          std::is_same_v<Ty, Convert<ThisResult, DesiredResult::category>>) {
+        return common::visit(
+            [](auto &x) { return UnwrapConvertedExpr<A>(x); }, x.left().u);
+      }
     }
   }
   return nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125119.428236.patch
Type: text/x-patch
Size: 1638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220509/ce8b7753/attachment.bin>


More information about the flang-commits mailing list