}
}
-const Symbol *FindUltimateComponent(const DerivedTypeSpec &derivedTypeSpec,
- std::function<bool(const Symbol &)> 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()}) {
}
}
-// 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.
//
//
// - 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