[flang-commits] [flang] [flang] Add parser support for explicit-shape-bounds-spec (PR #188447)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Wed Apr 15 15:55:05 PDT 2026
================
@@ -237,7 +238,67 @@ ArraySpec ArraySpecAnalyzer::Analyze(const parser::ComponentArraySpec &x) {
CHECK(!arraySpec_.empty());
return arraySpec_;
}
+
+static bool shouldRewriteShapeSpecListToExplicitBounds(
+ SemanticsContext &context, const parser::ArraySpec &x) {
+ auto &explicitShapeSpecList{std::get<std::list<parser::ExplicitShapeSpec>>(
+ const_cast<parser::ArraySpec &>(x).u)};
+
+ if (explicitShapeSpecList.size() != 1) {
+ return false;
+ }
+
+ auto &explicitShapeSpec{explicitShapeSpecList.front()};
+ const auto &upperBound{std::get<1>(explicitShapeSpec.t)};
+ const auto &lowerBoundOpt{std::get<0>(explicitShapeSpec.t)};
+
+ bool foundArray{false};
+
+ if (MaybeExpr analyzedExpr =
+ AnalyzeExpr(context, upperBound.v.thing.thing.value());
----------------
eugeneepshteyn wrote:
We try to avoid unwrapping complex structures like this: `upperBound.v.thing.thing.value()`.
Please look into `Unwrap<parser::Expr>` or similar.
https://github.com/llvm/llvm-project/pull/188447
More information about the flang-commits
mailing list