llvm-capstone/flang/test/Examples/print-fns-definitions.f90
Slava Zakharin 1c5d121440 [flang] Handle Flang examples consistently with LLVM.
Without this change the problem is that flangOmpReport and
flangPrintFunctionNames libraries are not built under 'all',
but they are imported targets via LLVMExports.cmake so that
any out-of-tree build that configures upon LLVM+Flang package
will get this CMake error:
```
  The imported target "flangPrintFunctionNames" references the file

     ".../lib/flangPrintFunctionNames.so"

  but this file does not exist.
```

flang-aarch64-out-of-tree buildbot (https://lab.llvm.org/buildbot/#/builders/175)
does not catch this issue, because it does not enable Flang on the first stage.

This change gets rid of FLANG_BUILD_EXAMPLES in favor of LLVM_BUILD_EXAMPLES
and uses available LLVM CMake macros to add example executables/libraries.

Differential Revision: https://reviews.llvm.org/D145992
2023-03-14 13:08:43 -07:00

35 lines
989 B
Fortran

! Check the Flang Print Function Names example plugin prints and counts function/subroutine definitions
! This includes internal and external Function/Subroutines, but not Statement Functions
! This requires that the examples are built (LLVM_BUILD_EXAMPLES=ON) to access flangPrintFunctionNames.so
! REQUIRES: plugins, examples, shell
! RUN: %flang_fc1 -load %llvmshlibdir/flangPrintFunctionNames%pluginext -plugin print-fns %s 2>&1 | FileCheck %s
! CHECK: Function: external_func1
! CHECK-NEXT: Function: external_func2
! CHECK-NEXT: Subroutine: external_subr
! CHECK-NEXT: Function: internal_func
! CHECK-NEXT: Subroutine: internal_subr
! CHECK-EMPTY:
! CHECK-NEXT: ==== Functions: 3 ====
! CHECK-NEXT: ==== Subroutines: 2 ====
function external_func1()
end function
function external_func2()
end function
subroutine external_subr
end subroutine
program main
contains
function internal_func()
end function
subroutine internal_subr
end subroutine
end program main