[flang-commits] [flang] [llvm] [Flang][OMP]Add support for DECLARE MAPPER parsing and semantics (PR #115160)

Akash Banerjee via flang-commits flang-commits at lists.llvm.org
Wed Nov 13 04:00:33 PST 2024


================
@@ -1605,6 +1609,35 @@ void OmpVisitor::Post(const parser::OpenMPBlockConstruct &x) {
   }
 }
 
+// This "manually" walks the tree of the cosntruct, because the order
+// elements are resolved by the normal visitor will try to resolve
+// the map clauses attached to the directive without having resolved
+// the type, so the type is figured out using the implicit rules.
+bool OmpVisitor::Pre(const parser::OpenMPDeclareMapperConstruct &x) {
+  AddOmpSourceRange(x.source);
+  BeginDeclTypeSpec();
+  const auto &spec{std::get<parser::OmpDeclareMapperSpecifier>(x.t)};
+  Symbol *mapperSym{nullptr};
+  if (const auto &mapperName{std::get<std::optional<parser::Name>>(spec.t)}) {
+    mapperSym =
+        &MakeSymbol(*mapperName, MiscDetails{MiscDetails::Kind::ConstructName});
+    mapperName->symbol = mapperSym;
+  } else {
+    mapperSym = &MakeSymbol(
+        "default", Attrs{}, MiscDetails{MiscDetails::Kind::ConstructName});
----------------
TIFitis wrote:

Intuitively I think it would be possible to do so.

I am working on further patches for this to have full lowering support, we can make/add changes to the parsing if needed as part of those patches I guess.

https://github.com/llvm/llvm-project/pull/115160


More information about the flang-commits mailing list