1//===-- lib/Semantics/check-namelist.cpp ----------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "check-namelist.h"
10
11namespace Fortran::semantics {
12
13void NamelistChecker::Leave(const parser::NamelistStmt &nmlStmt) {
14 for (const auto &x : nmlStmt.v) {
15 if (const auto *nml{std::get<parser::Name>(x.t).symbol}) {
16 for (const auto &nmlObjName : std::get<std::list<parser::Name>>(x.t)) {
17 const auto *nmlObjSymbol{nmlObjName.symbol};
18 if (nmlObjSymbol) {
19 if (IsAssumedSizeArray(*nmlObjSymbol)) { // C8104
20 context_.Say(nmlObjName.source,
21 "A namelist group object '%s' must not be assumed-size"_err_en_US,
22 nmlObjSymbol->name());
23 }
24 if (nml->attrs().test(Attr::PUBLIC) &&
25 nmlObjSymbol->attrs().test(Attr::PRIVATE)) { // C8105
26 context_.Say(nmlObjName.source,
27 "A PRIVATE namelist group object '%s' must not be in a "
28 "PUBLIC namelist"_err_en_US,
29 nmlObjSymbol->name());
30 }
31 }
32 }
33 }
34 }
35}
36
37} // namespace Fortran::semantics
38

source code of flang/lib/Semantics/check-namelist.cpp