diff options
author | Tim Keith <tkeith@nvidia.com> | 2021-01-13 12:52:40 -0800 |
---|---|---|
committer | Tim Keith <tkeith@nvidia.com> | 2021-01-13 12:52:44 -0800 |
commit | 18278ff1aac47d9bffa0231c74277ffc89def13e (patch) | |
tree | df873ee923371921b12eea7e777c2d8883d8bf01 /flang | |
parent | 01c3135850d15c8dce9374eec26dc2d555a87b7f (diff) | |
download | llvm-18278ff1aac47d9bffa0231c74277ffc89def13e.zip llvm-18278ff1aac47d9bffa0231c74277ffc89def13e.tar.gz llvm-18278ff1aac47d9bffa0231c74277ffc89def13e.tar.bz2 |
[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
Diffstat (limited to 'flang')
-rw-r--r-- | flang/lib/Semantics/mod-file.cpp | 1 | ||||
-rw-r--r-- | flang/test/Semantics/modfile03.f90 | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp index f8e5889..23733f9 100644 --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -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); } diff --git a/flang/test/Semantics/modfile03.f90 b/flang/test/Semantics/modfile03.f90 index 9bdb356..a4b21c8 100644 --- a/flang/test/Semantics/modfile03.f90 +++ b/flang/test/Semantics/modfile03.f90 @@ -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 |