[mlir][bazel] Port https://github.com/llvm/llvm-project/commit/7498eaa9abf2e4ac0c10fa...
[llvm-project.git] / flang / runtime / non-tbp-dio.cpp
blob9419adb7631cc9549631db1010c0cea86adbf034
1 //===-- flang/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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "non-tbp-dio.h"
10 #include "type-info.h"
12 namespace Fortran::runtime::io {
14 const 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->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;
29 return nullptr;
32 } // namespace Fortran::runtime::io