diff --git a/flang/include/flang/Evaluate/tools.h b/flang/include/flang/Evaluate/tools.h index f9d74db1df03b..d8d0956369e40 100644 --- a/flang/include/flang/Evaluate/tools.h +++ b/flang/include/flang/Evaluate/tools.h @@ -1522,7 +1522,7 @@ bool IsVarSubexpressionOf( std::optional> GetConvertInput(const Expr &x); // How many ancestors does have a derived type have? -std::optional DerivedTypeDepth(const semantics::Scope &); +std::optional CountDerivedTypeAncestors(const semantics::Scope &); } // namespace Fortran::evaluate diff --git a/flang/lib/Evaluate/constant.cpp b/flang/lib/Evaluate/constant.cpp index f57dd825a7a7c..7fe000892ac1a 100644 --- a/flang/lib/Evaluate/constant.cpp +++ b/flang/lib/Evaluate/constant.cpp @@ -9,6 +9,7 @@ #include "flang/Evaluate/constant.h" #include "flang/Evaluate/expression.h" #include "flang/Evaluate/shape.h" +#include "flang/Evaluate/tools.h" #include "flang/Evaluate/type.h" #include @@ -392,8 +393,8 @@ std::size_t Constant::CopyFrom(const Constant &source, bool ComponentCompare::operator()(SymbolRef x, SymbolRef y) const { if (&x->owner() != &y->owner()) { // Not components of the same derived type; put ancestors' components first. - if (auto xDepth{DerivedTypeDepth(x->owner())}) { - if (auto yDepth{DerivedTypeDepth(y->owner())}) { + if (auto xDepth{CountDerivedTypeAncestors(x->owner())}) { + if (auto yDepth{CountDerivedTypeAncestors(y->owner())}) { if (*xDepth != *yDepth) { return *xDepth < *yDepth; } diff --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp index 6d0da63ead07a..3cfad03648aee 100644 --- a/flang/lib/Evaluate/tools.cpp +++ b/flang/lib/Evaluate/tools.cpp @@ -1950,7 +1950,7 @@ bool IsVarSubexpressionOf( return VariableFinder{sub}(super); } -std::optional DerivedTypeDepth(const semantics::Scope &scope) { +std::optional CountDerivedTypeAncestors(const semantics::Scope &scope) { if (scope.IsDerivedType()) { for (auto iter{scope.cbegin()}; iter != scope.cend(); ++iter) { const Symbol &symbol{*iter->second}; @@ -1962,7 +1962,7 @@ std::optional DerivedTypeDepth(const semantics::Scope &scope) { parent = derived->typeSymbol().scope(); } if (parent) { - if (auto parentDepth{DerivedTypeDepth(*parent)}) { + if (auto parentDepth{CountDerivedTypeAncestors(*parent)}) { return 1 + *parentDepth; } }