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

Mats Petersson via flang-commits flang-commits at lists.llvm.org
Tue Nov 12 12:04:06 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});
----------------
Leporacanthicus wrote:

To be honest, not sure. I'm not sure how the OTHER symbol is retrieved either. 

@TIFitis Any thoughts?

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


More information about the flang-commits mailing list