[flang-commits] [flang] [flang][semantic] parser node types and rewrite for assumed-shape-bounds-spec (PR #211690)
Caroline Newcombe via flang-commits
flang-commits at lists.llvm.org
Fri Jul 24 08:09:58 PDT 2026
================
@@ -272,6 +273,32 @@ static bool shouldRewriteShapeSpecListToExplicitBounds(
return foundArray;
}
+static bool shouldRewriteAssumedShapeSpecListToAssumedBounds(
+ SemanticsContext &context, const parser::ArraySpec &x) {
+ auto &assumedShapeSpecList{std::get<std::list<parser::AssumedShapeSpec>>(
+ const_cast<parser::ArraySpec &>(x).u)};
+
+ if (assumedShapeSpecList.size() != 1) {
+ return false;
+ }
+
+ auto &assumedShapeSpec{assumedShapeSpecList.front()};
+ const auto &lowerBoundOpt{assumedShapeSpec.v};
+
+ bool foundArray{false};
+
+ if (lowerBoundOpt) {
+ const auto &lowerBound{*lowerBoundOpt};
+ if (MaybeExpr analyzedExpr =
+ AnalyzeExpr(context, lowerBound.v.thing.thing.value());
----------------
cenewcombe wrote:
Use `parser::UnwrapRef` here instead of manual unwrapping. The explicit bounds rewrite uses the helper, and I think it should be used here as well.
https://github.com/llvm/llvm-project/pull/211690
More information about the flang-commits
mailing list