[flang] Move IsCoarray() to fix shared library build

The predicate IsCoarray() needs to be in libFortranEvaluate so that
IsSaved() can call it without breaking the shared library build.

Pushed without pre-commit review as I'm moving code around and
the fix to the shared build is confirmed.

GitOrigin-RevId: 42bfd059bf80c9b61b263747bfa31d97ac38b0c7
diff --git a/include/flang/Evaluate/tools.h b/include/flang/Evaluate/tools.h
index df56a3b..5fcc745 100644
--- a/include/flang/Evaluate/tools.h
+++ b/include/flang/Evaluate/tools.h
@@ -1051,6 +1051,7 @@
 bool IsProcedure(const Scope &);
 bool IsProcedurePointer(const Symbol &);
 bool IsAutomatic(const Symbol &);
+bool IsCoarray(const Symbol &);
 bool IsSaved(const Symbol &); // saved implicitly or explicitly
 bool IsDummy(const Symbol &);
 bool IsFunctionResult(const Symbol &);
diff --git a/include/flang/Semantics/tools.h b/include/flang/Semantics/tools.h
index 6ab3e5e..6047eea 100644
--- a/include/flang/Semantics/tools.h
+++ b/include/flang/Semantics/tools.h
@@ -164,7 +164,6 @@
 bool IsFinalizable(
     const DerivedTypeSpec &, std::set<const DerivedTypeSpec *> * = nullptr);
 bool HasImpureFinal(const DerivedTypeSpec &);
-bool IsCoarray(const Symbol &);
 bool IsInBlankCommon(const Symbol &);
 inline bool IsAssumedSizeArray(const Symbol &symbol) {
   const auto *details{symbol.detailsIf<ObjectEntityDetails>()};
diff --git a/lib/Evaluate/tools.cpp b/lib/Evaluate/tools.cpp
index 86600ca..bbfb46e 100644
--- a/lib/Evaluate/tools.cpp
+++ b/lib/Evaluate/tools.cpp
@@ -1193,6 +1193,10 @@
   return false;
 }
 
+bool IsCoarray(const Symbol &symbol) {
+  return GetAssociationRoot(symbol).Corank() > 0;
+}
+
 bool IsSaved(const Symbol &original) {
   const Symbol &symbol{GetAssociationRoot(original)};
   const Scope &scope{symbol.owner()};
diff --git a/lib/Semantics/tools.cpp b/lib/Semantics/tools.cpp
index f3df880..0be899c 100644
--- a/lib/Semantics/tools.cpp
+++ b/lib/Semantics/tools.cpp
@@ -676,8 +676,6 @@
   }
 }
 
-bool IsCoarray(const Symbol &symbol) { return symbol.Corank() > 0; }
-
 bool IsAssumedLengthCharacter(const Symbol &symbol) {
   if (const DeclTypeSpec * type{symbol.GetType()}) {
     return type->category() == DeclTypeSpec::Character &&