llvm-project/flang/test/Lower/user-defined-operators.f90
Valentin Clement 99d239341c
[flang][NFC] Add lowering tests
Add couple of tests for the lowering.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D121991

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2022-03-18 14:48:56 +01:00

23 lines
594 B
Fortran

! Test use defined operators/assignment
! RUN: bbc -emit-fir %s -o - | FileCheck %s
! Test user defined assignment
! CHECK-LABEL: func @_QPuser_assignment(
! CHECK-SAME: %[[arg0:.*]]: !fir.ref<!fir.type<{{.*}}>>{{.*}}, %[[arg1:.*]]: !fir.ref<i32>{{.*}}) {
subroutine user_assignment(a, i)
type t
real :: x
integer :: i
end type
interface assignment(=)
subroutine my_assign(b, j)
import :: t
type(t), INTENT(OUT) :: b
integer, INTENT(IN) :: j
end subroutine
end interface
type(t) :: a
! CHECK: fir.call @_QPmy_assign(%[[arg0]], %[[arg1]])
a = i
end subroutine