[flang] rebase
authorpeter klausler <pklausler@nvidia.com>
Thu, 8 Aug 2019 17:50:23 +0000 (10:50 -0700)
committerpeter klausler <pklausler@nvidia.com>
Fri, 9 Aug 2019 16:41:51 +0000 (09:41 -0700)
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
flang/lib/semantics/tools.h

index 0fd7e8f..1b2de9a 100644 (file)
@@ -418,27 +418,6 @@ bool IsSaved(const Symbol &symbol) {
   }
 }
 
-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()}) {
index 19c838a..e0c7bf0 100644 (file)
@@ -211,7 +211,7 @@ template<typename T> std::optional<std::int64_t> 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<typename T> std::optional<std::int64_t> 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