[flang-commits] [flang] 18278ff - [flang] Fix accessibility of USEd name in .mod file
Tim Keith via flang-commits
flang-commits at lists.llvm.org
Wed Jan 13 12:52:59 PST 2021
Author: Tim Keith
Date: 2021-01-13T12:52:44-08:00
New Revision: 18278ff1aac47d9bffa0231c74277ffc89def13e
URL: https://github.com/llvm/llvm-project/commit/18278ff1aac47d9bffa0231c74277ffc89def13e
DIFF: https://github.com/llvm/llvm-project/commit/18278ff1aac47d9bffa0231c74277ffc89def13e.diff
LOG: [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
Added:
Modified:
flang/lib/Semantics/mod-file.cpp
flang/test/Semantics/modfile03.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index f8e5889e4698..23733f944d8c 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 9bdb35695f03..a4b21c8287f5 100644
--- a/flang/test/Semantics/modfile03.f90
+++ b/flang/test/Semantics/modfile03.f90
@@ -158,3 +158,21 @@ subroutine s(x)
! 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
More information about the flang-commits
mailing list