[flang-commits] [flang] [flang] Add missing #include for MSVC (PR #161437)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Tue Sep 30 14:03:16 PDT 2025
https://github.com/klausler updated https://github.com/llvm/llvm-project/pull/161437
>From 90acacf4da6658f71bb4d6d0cb9bab2f1b4bb0ab Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Tue, 30 Sep 2025 13:31:21 -0700
Subject: [PATCH] [flang] Add missing #include for MSVC
I moved a function to Evaluate/tools.cpp in an attempt to dodge
some MSVC compiler issue but didn't add an include directive for
Evaluate/tools.h to Evaluate/constant.cpp.
---
flang/include/flang/Evaluate/tools.h | 2 +-
flang/lib/Evaluate/constant.cpp | 5 +++--
flang/lib/Evaluate/tools.cpp | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/flang/include/flang/Evaluate/tools.h b/flang/include/flang/Evaluate/tools.h
index f9d74db1df03b..93b419609b296 100644
--- a/flang/include/flang/Evaluate/tools.h
+++ b/flang/include/flang/Evaluate/tools.h
@@ -1522,7 +1522,7 @@ bool IsVarSubexpressionOf(
std::optional<Expr<SomeType>> GetConvertInput(const Expr<SomeType> &x);
// How many ancestors does have a derived type have?
-std::optional<int> DerivedTypeDepth(const semantics::Scope &);
+std::optional<int> GetDerivedTypeDepth(const semantics::Scope &);
} // namespace Fortran::evaluate
diff --git a/flang/lib/Evaluate/constant.cpp b/flang/lib/Evaluate/constant.cpp
index f57dd825a7a7c..6cbd9826cc0c7 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 <string>
@@ -392,8 +393,8 @@ std::size_t Constant<SomeDerived>::CopyFrom(const Constant<SomeDerived> &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{GetDerivedTypeDepth(x->owner())}) {
+ if (auto yDepth{GetDerivedTypeDepth(y->owner())}) {
if (*xDepth != *yDepth) {
return *xDepth < *yDepth;
}
diff --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp
index 6d0da63ead07a..d1c997abd5c35 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<int> DerivedTypeDepth(const semantics::Scope &scope) {
+std::optional<int> GetDerivedTypeDepth(const semantics::Scope &scope) {
if (scope.IsDerivedType()) {
for (auto iter{scope.cbegin()}; iter != scope.cend(); ++iter) {
const Symbol &symbol{*iter->second};
More information about the flang-commits
mailing list