[flang] [llvm] [Flang][OMP]Add support for DECLARE MAPPER parsing and semantics (PR #115160)
Kiran Chandramohan via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 06:42:05 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});
----------------
kiranchandramohan wrote:
In the `if` case, we can get the name from the parse-tree node and get the symbol. But we can wait for @TIFitis's lowering patch to see whether it can be used. Either way, adding the symbol seems to have caught the duplicate `default` mapper for the same type that @TIFitis raised in another comment.
https://github.com/llvm/llvm-project/pull/115160
More information about the llvm-commits
mailing list