[flang-commits] [flang] fac00d1 - [flang] Fix ENUMERATOR declarations in nested scopes
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Sun Jan 29 15:55:36 PST 2023
Author: Peter Klausler
Date: 2023-01-29T15:55:26-08:00
New Revision: fac00d1b5d3923129afc3443bfb8fa40c9dbc2c8
URL: https://github.com/llvm/llvm-project/commit/fac00d1b5d3923129afc3443bfb8fa40c9dbc2c8
DIFF: https://github.com/llvm/llvm-project/commit/fac00d1b5d3923129afc3443bfb8fa40c9dbc2c8.diff
LOG: [flang] Fix ENUMERATOR declarations in nested scopes
ENUMERATOR declarations are checking for conflicts between new
enumerator names and names in both the local scope and scopes
that contain it. ENUMERATOR declarations belong to the local
scope and so only a conflict with a name therein is an error.
(In short, use FindInScope rather than FindSymbol.)
Differential Revision: https://reviews.llvm.org/D142773
Added:
Modified:
flang/lib/Semantics/resolve-names.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index dfefd9e7e3a0..594a718c7bf6 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -4256,7 +4256,7 @@ bool DeclarationVisitor::Pre(const parser::NamedConstant &x) {
bool DeclarationVisitor::Pre(const parser::Enumerator &enumerator) {
const parser::Name &name{std::get<parser::NamedConstant>(enumerator.t).v};
- Symbol *symbol{FindSymbol(name)};
+ Symbol *symbol{FindInScope(name)};
if (symbol && !symbol->has<UnknownDetails>()) {
// Contrary to named constants appearing in a PARAMETER statement,
// enumerator names should not have their type, dimension or any other
More information about the flang-commits
mailing list