================
@@ -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());
----------------
tblah wrote:

nit: should this come before the `!IsProcedure(*sym) && !IsFunction(*sym)` 
check? If it is implicitly declared I imagine it won't be a procedure or 
function type anyway - but if declarations are in the wrong order in a source 
file I think this message is clearer than the type error.

https://github.com/llvm/llvm-project/pull/160390
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to