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

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 07:40:32 PST 2021


tskeith created this revision.
tskeith added reviewers: klausler, PeteSteinfeld.
tskeith added a project: Flang.
Herald added a subscriber: jdoerfert.
tskeith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94602

Files:
  flang/lib/Semantics/mod-file.cpp
  flang/test/Semantics/modfile03.f90


Index: flang/test/Semantics/modfile03.f90
===================================================================
--- flang/test/Semantics/modfile03.f90
+++ flang/test/Semantics/modfile03.f90
@@ -158,3 +158,21 @@
 !  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
Index: flang/lib/Semantics/mod-file.cpp
===================================================================
--- flang/lib/Semantics/mod-file.cpp
+++ flang/lib/Semantics/mod-file.cpp
@@ -427,6 +427,7 @@
     PutGenericName(uses_ << "=>", use);
   }
   uses_ << '\n';
+  PutUseExtraAttr(Attr::PRIVATE, symbol, use);
   PutUseExtraAttr(Attr::VOLATILE, symbol, use);
   PutUseExtraAttr(Attr::ASYNCHRONOUS, symbol, use);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94602.316393.patch
Type: text/x-patch
Size: 852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210113/d1b12740/attachment.bin>


More information about the llvm-commits mailing list