| 1 | //===- AllocatableTest.cpp -- allocatable runtime builder unit tests ------===// |
| 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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "flang/Optimizer/Builder/Runtime/Allocatable.h" |
| 10 | #include "RuntimeCallTestBase.h" |
| 11 | #include "gtest/gtest.h" |
| 12 | #include "flang/Runtime/descriptor-consts.h" |
| 13 | |
| 14 | using namespace Fortran::runtime; |
| 15 | |
| 16 | TEST_F(RuntimeCallTest, genMoveAlloc) { |
| 17 | mlir::Location loc = firBuilder->getUnknownLoc(); |
| 18 | mlir::Type seqTy = |
| 19 | fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty); |
| 20 | mlir::Value from = firBuilder->create<fir::UndefOp>(loc, seqTy); |
| 21 | mlir::Value to = firBuilder->create<fir::UndefOp>(loc, seqTy); |
| 22 | mlir::Value errMsg = firBuilder->create<fir::UndefOp>(loc, seqTy); |
| 23 | mlir::Value hasStat = firBuilder->createBool(loc, false); |
| 24 | fir::runtime::genMoveAlloc(*firBuilder, loc, to, from, hasStat, errMsg); |
| 25 | checkCallOpFromResultBox(to, "_FortranAMoveAlloc" , 5); |
| 26 | } |
| 27 | |