aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/program-tree.cpp
diff options
context:
space:
mode:
authorPeter Klausler <pklausler@nvidia.com>2022-09-21 12:15:09 -0700
committerPeter Klausler <pklausler@nvidia.com>2022-09-23 13:12:23 -0700
commitbfc39073692550132f49c22f848ad145f7350fbf (patch)
treeb59596cdd93c226a8b1bb37161083d5b25312956 /flang/lib/Semantics/program-tree.cpp
parenta3becb333d7faae695e18728e9b8fa3a3579a240 (diff)
downloadllvm-bfc39073692550132f49c22f848ad145f7350fbf.zip
llvm-bfc39073692550132f49c22f848ad145f7350fbf.tar.gz
llvm-bfc39073692550132f49c22f848ad145f7350fbf.tar.bz2
[flang] Fix spurious errors from MODULE subprograms
When an explicit MODULE procedure is defined in the same (sub)module as its interface, and the interface was defined in a generic interface of the same name, bogus errors about symbols already having been defined will ensue. Cleaning up this aspect of name resolution and symbol table management requires marking the place-holding SubprogramNameDetails symbols of explicit MODULE subprograms as such, ensuring that that attribute is not inherited if the SubprogramNameDetails symbol is recycled as a SubprogramDetails, and gathering some code that should have been common between BeginSubprogram() and BeginMpSubprogram() together in one new routine. Differential Revision: https://reviews.llvm.org/D134446
Diffstat (limited to 'flang/lib/Semantics/program-tree.cpp')
-rw-r--r--flang/lib/Semantics/program-tree.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/flang/lib/Semantics/program-tree.cpp b/flang/lib/Semantics/program-tree.cpp
index 79b4738..cd631da 100644
--- a/flang/lib/Semantics/program-tree.cpp
+++ b/flang/lib/Semantics/program-tree.cpp
@@ -217,6 +217,10 @@ Symbol::Flag ProgramTree::GetSubpFlag() const {
}
bool ProgramTree::HasModulePrefix() const {
+ if (std::holds_alternative<
+ const parser::Statement<parser::MpSubprogramStmt> *>(stmt_)) {
+ return true; // MODULE PROCEDURE foo
+ }
using ListType = std::list<parser::PrefixSpec>;
const auto *prefixes{common::visit(
common::visitors{