Valentin Clement (バレンタイン クレメン) 951f40ac38
[flang][NFC] Update flang/unittests to the new create APIs (#152056)
While I was updating the creation of CUF operation in #152050, I noticed
some other places in flang that were not updated. This patch updates the
FIR operation creations in `flang/unittests`
2025-08-04 16:49:43 -07:00

27 lines
1.1 KiB
C++

//===- AllocatableTest.cpp -- allocatable runtime builder unit tests ------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "flang/Optimizer/Builder/Runtime/Allocatable.h"
#include "RuntimeCallTestBase.h"
#include "gtest/gtest.h"
#include "flang/Runtime/descriptor-consts.h"
using namespace Fortran::runtime;
TEST_F(RuntimeCallTest, genMoveAlloc) {
mlir::Location loc = firBuilder->getUnknownLoc();
mlir::Type seqTy =
fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
mlir::Value from = fir::UndefOp::create(*firBuilder, loc, seqTy);
mlir::Value to = fir::UndefOp::create(*firBuilder, loc, seqTy);
mlir::Value errMsg = fir::UndefOp::create(*firBuilder, loc, seqTy);
mlir::Value hasStat = firBuilder->createBool(loc, false);
fir::runtime::genMoveAlloc(*firBuilder, loc, to, from, hasStat, errMsg);
checkCallOpFromResultBox(to, "_FortranAMoveAlloc", 5);
}