brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · d516526 Raw
33 lines · cpp
1//===-- lib/runtime/non-tbp-dio.cpp -----------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "flang-rt/runtime/non-tbp-dio.h"10#include "flang-rt/runtime/type-info.h"11 12namespace Fortran::runtime::io {13 14const NonTbpDefinedIo *NonTbpDefinedIoTable::Find(15    const typeInfo::DerivedType &type, common::DefinedIo definedIo) const {16  std::size_t j{items};17  for (const auto *p{item}; j-- > 0; ++p) {18    if (&p->derivedType == &type && p->definedIo == definedIo) {19      return p;20    } else if (p->flags & IsDtvArgPolymorphic) {21      for (const typeInfo::DerivedType *t{type.GetParentType()}; t;22           t = t->GetParentType()) {23        if (&p->derivedType == t && p->definedIo == definedIo) {24          return p;25        }26      }27    }28  }29  return nullptr;30}31 32} // namespace Fortran::runtime::io33