================
@@ -1680,40 +1710,92 @@ void OmpStructureChecker::Leave(const 
parser::OpenMPRequiresConstruct &) {
   dirContext_.pop_back();
 }
 
-void OmpStructureChecker::Enter(const parser::OpenMPDeclarativeAllocate &x) {
-  isPredefinedAllocator = true;
-  const auto &dir{std::get<parser::Verbatim>(x.t)};
-  const auto &objectList{std::get<parser::OmpObjectList>(x.t)};
-  PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_allocate);
-  SymbolSourceMap currSymbols;
-  GetSymbolsInObjectList(objectList, currSymbols);
-  for (auto &[symbol, source] : currSymbols) {
-    if (IsPointer(*symbol)) {
+void OmpStructureChecker::CheckAllocateDirective(parser::CharBlock source,
+    const parser::OmpObjectList &objects,
+    const parser::OmpClauseList &clauses) {
+  const Scope &thisScope{context_.FindScope(source)};
+  SymbolSourceMap symbols;
+  GetSymbolsInObjectList(objects, symbols);
+
+  auto hasPredefinedAllocator{[&](const parser::OmpClause *c) {
+    if (!c) {
+      return std::make_optional(false);
+    }
+    auto *allocator{std::get_if<parser::OmpClause::Allocator>(&c->u)};
----------------
kparzysz wrote:

Got rid of the optional.  Now the code is checking whether the value could 
possibly be a predefined allocator.  If not, we emit an error, not a warning.  
We won't emit anything if it's an expression that could potentially be a 
predefined allocator.

https://github.com/llvm/llvm-project/pull/164420
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to