Skip to content

Conversation

@eugeneepshteyn
Copy link
Contributor

This is not correct implementation, this PR is for easy reference not for review.

@eugeneepshteyn eugeneepshteyn changed the title [not for review] Vol actual checks OLD [not for review] Vol actual checks OLD (implements HasTriplet()) Jul 22, 2025
@github-actions
Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- flang/include/flang/Evaluate/tools.h flang/lib/Evaluate/tools.cpp flang/lib/Semantics/check-call.cpp flang/lib/Semantics/definable.cpp flang/lib/Semantics/definable.h
View the diff from clang-format here.
diff --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp
index 24aeabaa6..8657b4414 100644
--- a/flang/lib/Evaluate/tools.cpp
+++ b/flang/lib/Evaluate/tools.cpp
@@ -1204,9 +1204,8 @@ bool HasVectorSubscript(const Expr<SomeType> &expr) {
 }
 
 // HasTriplet()
-struct HasTripletHelper
-    : public AnyTraverse<HasTripletHelper, bool,
-          /*TraverseAssocEntityDetails=*/false> {
+struct HasTripletHelper : public AnyTraverse<HasTripletHelper, bool,
+                              /*TraverseAssocEntityDetails=*/false> {
   using Base = AnyTraverse<HasTripletHelper, bool, false>;
   HasTripletHelper() : Base{*this} {}
   using Base::operator();
@@ -1218,9 +1217,7 @@ struct HasTripletHelper
   }
 };
 
-bool HasTriplet(const Expr<SomeType> &expr) {
-  return HasTripletHelper{}(expr);
-}
+bool HasTriplet(const Expr<SomeType> &expr) { return HasTripletHelper{}(expr); }
 
 // HasConstant()
 struct HasConstantHelper : public AnyTraverse<HasConstantHelper, bool,
diff --git a/flang/lib/Semantics/definable.cpp b/flang/lib/Semantics/definable.cpp
index 77bb7ceae..d1fd8e005 100644
--- a/flang/lib/Semantics/definable.cpp
+++ b/flang/lib/Semantics/definable.cpp
@@ -373,8 +373,8 @@ std::optional<parser::Message> WhyNotDefinable(parser::CharBlock at,
       }
     } else if (flags.test(DefinabilityFlag::VolatileNotDefinable) &&
         evaluate::HasTriplet(expr)) {
-      return parser::Message{at,
-          "Variable '%s' has array section"_err_en_US, expr.AsFortran()};
+      return parser::Message{
+          at, "Variable '%s' has array section"_err_en_US, expr.AsFortran()};
     }
     if (FindPureProcedureContaining(scope) &&
         evaluate::ExtractCoarrayRef(expr)) {

@eugeneepshteyn eugeneepshteyn deleted the vol-actual-checks branch August 28, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant