brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 75c6034 Raw
30 lines · cpp
1//===- DerivedTest.cpp -- Derived type 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/Derived.h"10#include "RuntimeCallTestBase.h"11#include "gtest/gtest.h"12 13TEST_F(RuntimeCallTest, genDerivedTypeInitialize) {14  auto loc = firBuilder->getUnknownLoc();15  mlir::Type seqTy =16      fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);17  mlir::Value box = fir::UndefOp::create(*firBuilder, loc, seqTy);18  fir::runtime::genDerivedTypeInitialize(*firBuilder, loc, box);19  checkCallOpFromResultBox(box, "_FortranAInitialize", 1);20}21 22TEST_F(RuntimeCallTest, genDerivedTypeDestroy) {23  auto loc = firBuilder->getUnknownLoc();24  mlir::Type seqTy =25      fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);26  mlir::Value box = fir::UndefOp::create(*firBuilder, loc, seqTy);27  fir::runtime::genDerivedTypeDestroy(*firBuilder, loc, box);28  checkCallOpFromResultBox(box, "_FortranADestroy", 1, /*addLocArg=*/false);29}30