27 lines · cpp
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-exception6//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 14using namespace Fortran::runtime;15 16TEST_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 = fir::UndefOp::create(*firBuilder, loc, seqTy);21 mlir::Value to = fir::UndefOp::create(*firBuilder, loc, seqTy);22 mlir::Value errMsg = fir::UndefOp::create(*firBuilder, 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