[flang-commits] [flang] [flang] Fix broken shared library build (PR #112444)
via flang-commits
flang-commits at lists.llvm.org
Tue Oct 15 15:10:47 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Peter Klausler (klausler)
<details>
<summary>Changes</summary>
I just introduced a dependency from the Evaluate library to the Semantics library, which is circular in a shared library build. Rearrange the code a little to ensure that the dependence is only on a header.
---
Full diff: https://github.com/llvm/llvm-project/pull/112444.diff
2 Files Affected:
- (modified) flang/include/flang/Semantics/type.h (+12-1)
- (modified) flang/lib/Semantics/type.cpp (-6)
``````````diff
diff --git a/flang/include/flang/Semantics/type.h b/flang/include/flang/Semantics/type.h
index 1292c381b65f72..35221915020595 100644
--- a/flang/include/flang/Semantics/type.h
+++ b/flang/include/flang/Semantics/type.h
@@ -29,6 +29,13 @@ namespace Fortran::parser {
struct Keyword;
}
+namespace Fortran::evaluate { // avoid including all of Evaluate/tools.h
+template <typename T>
+std::optional<bool> AreEquivalentInInterface(const Expr<T> &, const Expr<T> &);
+extern template std::optional<bool> AreEquivalentInInterface<SomeInteger>(
+ const Expr<SomeInteger> &, const Expr<SomeInteger> &);
+} // namespace Fortran::evaluate
+
namespace Fortran::semantics {
class Scope;
@@ -110,7 +117,11 @@ class ParamValue {
return category_ == that.category_ && expr_ == that.expr_;
}
bool operator!=(const ParamValue &that) const { return !(*this == that); }
- bool IsEquivalentInInterface(const ParamValue &) const;
+ bool IsEquivalentInInterface(const ParamValue &that) const {
+ return (category_ == that.category_ &&
+ expr_.has_value() == that.expr_.has_value() &&
+ (!expr_ || evaluate::AreEquivalentInInterface(*expr_, *that.expr_)));
+ }
std::string AsFortran() const;
private:
diff --git a/flang/lib/Semantics/type.cpp b/flang/lib/Semantics/type.cpp
index 7f5f4e98a7d6c1..e867d7ad6e2536 100644
--- a/flang/lib/Semantics/type.cpp
+++ b/flang/lib/Semantics/type.cpp
@@ -758,12 +758,6 @@ void ParamValue::SetExplicit(SomeIntExpr &&x) {
expr_ = std::move(x);
}
-bool ParamValue::IsEquivalentInInterface(const ParamValue &that) const {
- return (category_ == that.category_ &&
- expr_.has_value() == that.expr_.has_value() &&
- (!expr_ || evaluate::AreEquivalentInInterface(*expr_, *that.expr_)));
-}
-
std::string ParamValue::AsFortran() const {
switch (category_) {
SWITCH_COVERS_ALL_CASES
``````````
</details>
https://github.com/llvm/llvm-project/pull/112444
More information about the flang-commits
mailing list