[flang] Fix accessibility of USEd name in .mod file

If a module specifies default private accessibility, names that have
been use-associated are private by default. This was not reflected in
.mod files.

Differential Revision: https://reviews.llvm.org/D94602
This commit is contained in:
Tim Keith 2021-01-13 12:52:40 -08:00
parent 01c3135850
commit 18278ff1aa
2 changed files with 19 additions and 0 deletions

View file

@ -427,6 +427,7 @@ void ModFileWriter::PutUse(const Symbol &symbol) {
PutGenericName(uses_ << "=>", use);
}
uses_ << '\n';
PutUseExtraAttr(Attr::PRIVATE, symbol, use);
PutUseExtraAttr(Attr::VOLATILE, symbol, use);
PutUseExtraAttr(Attr::ASYNCHRONOUS, symbol, use);
}

View file

@ -158,3 +158,21 @@ end
! end
! end interface
!end
module m7a
real :: x
end
!Expect: m7a.mod
!module m7a
! real(4)::x
!end
module m7b
use m7a
private
end
!Expect: m7b.mod
!module m7b
! use m7a,only:x
! private::x
!end