brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · eb3136f Raw
274 lines · plain
1! RUN: %python %S/test_modfile.py %s %flang_fc12! Check modfile generation with use-association.3 4module m15  integer :: x16  integer, private :: x27end8!Expect: m1.mod9!module m110!integer(4)::x111!integer(4),private::x212!end13 14module m215  use m116  integer :: y117end18!Expect: m2.mod19!module m220!use m1,only:x121!integer(4)::y122!end23 24module m325  use m2, z1 => x126end27!Expect: m3.mod28!module m329!use m2,only:y130!use m2,only:z1=>x131!end32 33module m434  use m135  use m236end37!Expect: m4.mod38!module m439!use m1,only:x140!use m2,only:y141!end42 43module m5a44  integer, parameter :: k1 = 445  integer :: l1 = 246  type t147    real :: a48  end type49contains50  pure integer function f1(i)51    value :: i52    f1 = i53  end54end55!Expect: m5a.mod56!module m5a57! integer(4),parameter::k1=4_458! integer(4)::l159! type::t160!  real(4)::a61! end type62!contains63! pure function f1(i)64!  integer(4),value::i65!  integer(4)::f166! end67!end68 69module m5b70  use m5a, only: k2 => k1, l2 => l1, f2 => f171  interface72    subroutine s(x, y)73      import f2, l274      character(l2, k2) :: x75      character(f2(l2)) :: y76    end subroutine77  end interface78end79!Expect: m5b.mod80!module m5b81! use m5a,only:k2=>k182! use m5a,only:l2=>l183! use m5a,only:f2=>f184! interface85!  subroutine s(x,y)86!   import::f287!   import::l288!   character(l2,4)::x89!   character(f2(l2),1)::y90!  end91! end interface92!end93 94module m6a95  type t196  end type97end98!Expect: m6a.mod99!module m6a100! type::t1101! end type102!end103 104module m6b105  use m6a, only: t2 => t1106contains107  subroutine s(x)108    type(t2) :: x109  end110end111!Expect: m6b.mod112!module m6b113! use m6a,only:t2=>t1114!contains115! subroutine s(x)116!  type(t2)::x117! end118!end119 120module m6c121  use m6a, only: t2 => t1122  type, extends(t2) :: t123  end type124end125!Expect: m6c.mod126!module m6c127! use m6a,only:t2=>t1128! type,extends(t2)::t129! end type130!end131 132module m6d133  use m6a, only: t2 => t1134  type(t2), parameter :: p = t2()135end136!Expect: m6d.mod137!module m6d138! use m6a,only:t2=>t1139! type(t2),parameter::p=t2()140!end141 142module m6e143  use m6a, only: t2 => t1144  interface145    subroutine s(x)146      import t2147      type(t2) :: x148    end subroutine149  end interface150end151!Expect: m6e.mod152!module m6e153! use m6a,only:t2=>t1154! interface155!  subroutine s(x)156!   import::t2157!   type(t2)::x158!  end159! end interface160!end161 162module m7a163  real :: x164end165!Expect: m7a.mod166!module m7a167! real(4)::x168!end169 170module m7b171  use m7a172  private173end174!Expect: m7b.mod175!module m7b176! use m7a,only:x177! private::x178!end179 180module m8a181  private foo182  type t183   contains184    procedure, nopass :: foo185  end type186 contains187  pure integer function foo(n)188    integer, intent(in) :: n189    foo = n190  end191end192!Expect: m8a.mod193!module m8a194!type::t195!contains196!procedure,nopass::foo197!end type198!private::foo199!contains200!pure function foo(n)201!integer(4),intent(in)::n202!integer(4)::foo203!end204!end205 206module m8b207  use m8a208 contains209  subroutine foo(x,a)210    type(t), intent(in) :: x211    real a(x%foo(10))212  end213end214!Expect: m8b.mod215!module m8b216!use m8a,only:m8a$foo=>foo217!use m8a,only:t218!private::m8a$foo219!contains220!subroutine foo(x,a)221!type(t),intent(in)::x222!real(4)::a(1_8:int(m8a$foo(10_4),kind=8))223!end224!end225 226module m9a227  private228  public t229  type t230    integer n231   contains232    procedure f233  end type234 contains235  pure integer function f(x, k)236    class(t), intent(in) :: x237    integer, intent(in) :: k238    f = x%n + k239  end240end241!Expect: m9a.mod242!module m9a243!type::t244!integer(4)::n245!contains246!procedure::f247!end type248!private::f249!contains250!pure function f(x,k)251!class(t),intent(in)::x252!integer(4),intent(in)::k253!integer(4)::f254!end255!end256 257module m9b258  use m9a259 contains260  subroutine s(x, y)261    class(t), intent(in) :: x262    real y(x%f(x%n))263  end264end265!Expect: m9b.mod266!module m9b267!use m9a,only:t268!contains269!subroutine s(x,y)270!class(t),intent(in)::x271!real(4)::y(1_8:int(x%f(x%n),kind=8))272!end273!end274