[flang-commits] [flang] [flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_SIMD (PR #160390)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Thu Sep 25 08:03:55 PDT 2025
================
@@ -1356,8 +1351,32 @@ void OmpStructureChecker::Leave(const parser::OpenMPThreadprivate &x) {
}
void OmpStructureChecker::Enter(const parser::OpenMPDeclareSimdConstruct &x) {
- const auto &dir{std::get<parser::Verbatim>(x.t)};
- PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_declare_simd);
+ const parser::OmpDirectiveName &dirName{x.v.DirName()};
+ PushContextAndClauseSets(dirName.source, dirName.v);
+
+ const parser::OmpArgumentList &args{x.v.Arguments()};
+ if (args.v.empty()) {
+ return;
+ } else if (args.v.size() > 1) {
+ context_.Say(args.source,
+ "DECLARE_SIMD directive should have at most one argument"_err_en_US);
+ return;
+ }
+
+ const parser::OmpArgument &arg{args.v.front()};
+ if (auto *sym{GetArgumentSymbol(arg)}) {
+ if (!IsProcedure(*sym) && !IsFunction(*sym)) {
+ context_.Say(arg.source,
+ "The name '%s' should refer to a procedure"_err_en_US, sym->name());
+ }
+ if (sym->test(Symbol::Flag::Implicit)) {
+ context_.Say(arg.source,
+ "The name '%s' has been implicitly declared"_err_en_US, sym->name());
----------------
kparzysz wrote:
Updated the message in the same way as in https://github.com/llvm/llvm-project/pull/160371.
https://github.com/llvm/llvm-project/pull/160390
More information about the flang-commits
mailing list