[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 11:22:08 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:
So, there is a check elsewhere that fires if you try to instantiate two symbols with the same name. I'm adding a test for it. It's not the pretties of error messages, but I think it'll be good enough?
https://github.com/llvm/llvm-project/pull/115160
More information about the flang-commits
mailing list