Summary:
We weren't handling the case of subroutines with alternate returns that
are contained in modules. I changed the code to add an `*` as the name
of the parameter when creating the `.mod` file.
Reviewers: tskeith, klausler, DavidTruby
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82096
if (n++ > 0) {
os << ',';
}
- os << dummy->name();
+ if (dummy) {
+ os << dummy->name();
+ } else {
+ os << "*";
+ }
}
os << ')';
PutAttrs(os, bindAttrs, details.bindName(), " "s, ""s);
const auto &details{symbol_.get<SubprogramDetails>()};
isInterface_ = details.isInterface();
for (const Symbol *dummyArg : details.dummyArgs()) {
- DoSymbol(DEREF(dummyArg));
+ if (dummyArg) {
+ DoSymbol(*dummyArg);
+ }
}
if (details.isFunction()) {
DoSymbol(details.result());
end
end
+! Module with a subroutine with alternate returns
+module m3
+contains
+ subroutine altReturn(arg1, arg2, *, *)
+ real :: arg1
+ real :: arg2
+ end subroutine
+end module m3
+
!Expect: m1.mod
!module m1
!type::t
!complex(4)::x
!end
!end
+
+!Expect: m3.mod
+!module m3
+!contains
+!subroutine altreturn(arg1,arg2,*,*)
+!real(4)::arg1
+!real(4)::arg2
+!end
+!end