From da6445198a07fe820c2709ff46f1f32a4d0a89b4 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Thu, 8 Aug 2019 10:50:23 -0700 Subject: [PATCH] [flang] rebase Original-commit: flang-compiler/f18@a2086f040602473917846b027b923fcd141bd193 Reviewed-on: https://github.com/flang-compiler/f18/pull/638 Tree-same-pre-rewrite: false --- flang/lib/semantics/tools.cc | 21 --------------------- flang/lib/semantics/tools.h | 4 ++-- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/flang/lib/semantics/tools.cc b/flang/lib/semantics/tools.cc index 0fd7e8f..1b2de9a6 100644 --- a/flang/lib/semantics/tools.cc +++ b/flang/lib/semantics/tools.cc @@ -418,27 +418,6 @@ bool IsSaved(const Symbol &symbol) { } } -const Symbol *FindUltimateComponent(const DerivedTypeSpec &derivedTypeSpec, - std::function predicate) { - const auto *scope{derivedTypeSpec.typeSymbol().scope()}; - CHECK(scope); - for (const auto &pair : *scope) { - const Symbol &component{*pair.second}; - const DeclTypeSpec *type{component.GetType()}; - if (!type) { - continue; - } - const DerivedTypeSpec *derived{type->AsDerived()}; - bool isUltimate{IsAllocatableOrPointer(component) || !derived}; - if (const Symbol * - result{!isUltimate ? FindUltimateComponent(*derived, predicate) - : predicate(component) ? &component : nullptr}) { - return result; - } - } - return nullptr; -} - bool IsFinalizable(const Symbol &symbol) { if (const DeclTypeSpec * type{symbol.GetType()}) { if (const DerivedTypeSpec * derived{type->AsDerived()}) { diff --git a/flang/lib/semantics/tools.h b/flang/lib/semantics/tools.h index 19c838a..e0c7bf04 100644 --- a/flang/lib/semantics/tools.h +++ b/flang/lib/semantics/tools.h @@ -211,7 +211,7 @@ template std::optional GetIntValue(const T &x) { } } -// Derived type component iterator that provides a C++ LegacyForwadIterator +// Derived type component iterator that provides a C++ LegacyForwardIterator // iterator over the Ordered, Direct, Ultimate or Potential components of a // DerivedTypeSpec. These iterators can be used with STL algorithms // accepting LegacyForwadIterator. @@ -220,7 +220,7 @@ template std::optional GetIntValue(const T &x) { // // // - Ordered components are the components from the component order defined -// in 7.5.4.7, except that the parent components IS added between the parent +// in 7.5.4.7, except that the parent component IS added between the parent // component order and the components in order of declaration. // This "deviation" is important for structure-constructor analysis. // For this kind of iterator, the component tree is recursively visited in the -- 2.7.4