[flang-commits] [flang] [Flang][OpenMP] Initial defaultmap(none) implementation (PR #166715)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Fri Nov 7 04:02:30 PST 2025
================
@@ -3000,6 +3066,36 @@ void OmpAttributeVisitor::Post(const parser::Name &name) {
}
}
+ // TODO: handle case where default and defaultmap are present on the same
+ // construct and conflict, defaultmap should supersede default if they
+ // conflict.
+ if (!GetContext().defaultMap.empty()) {
+ // Checked before implicit data sharing attributes as this rule ignores
+ // them and expects explicit predetermined/specified attributes to be in
+ // place for the types specified.
+ if (Symbol * found{currScope().FindSymbol(name.source)}) {
+ // If the variable has declare target applied to it (enter or link) it
+ // is exempt from defaultmap(none) restrictions
+ if (!symbol->GetUltimate().test(Symbol::Flag::OmpDeclareTarget)) {
+ auto &dMap = GetContext().defaultMap;
+ for (auto defaults : dMap) {
+ if (defaults.second ==
+ parser::OmpDefaultmapClause::ImplicitBehavior::None) {
+ if (DefaultMapCategoryMatchesSymbol(defaults.first, *found)) {
+ if (!IsObjectWithDSA(*symbol)) {
+ context_.Say(name.source,
+ "The DEFAULTMAP(NONE) clause requires that '%s' must be "
+ "listed in a "
+ "data-sharing attribute, data-mapping attribute, or is_device_ptr clause"_err_en_US,
+ symbol->name());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
----------------
kparzysz wrote:
This whole thing above really belongs in check-omp-structure. Would it be hard to move it there?
https://github.com/llvm/llvm-project/pull/166715
More information about the flang-commits
mailing list