[flang-commits] [flang] [llvm] [flang][OpenMP] Check conflicts between predetermined/explicit DSA (PR #194961)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Thu Apr 30 10:47:02 PDT 2026
================
@@ -443,30 +442,89 @@ const parser::Name OmpStructureChecker::GetLoopIndex(
return std::get<Bounds>(x->GetLoopControl()->u).Name().thing;
}
-void OmpStructureChecker::SetLoopInfo(const parser::OpenMPLoopConstruct &x) {
- if (const auto *loop{x.GetNestedLoop()}) {
- if (loop->IsDoNormal()) {
- const parser::Name &itrVal{GetLoopIndex(loop)};
- SetLoopIv(itrVal.symbol);
+void OmpStructureChecker::CheckIterationVariables(
+ const parser::OpenMPLoopConstruct &x) {
+ unsigned version{context_.langOptions().OpenMPVersion};
+ auto doLoops{CollectAffectedDoLoops(x, version, &context_)};
+ if (!doLoops) {
+ return;
+ }
+ const parser::OmpDirectiveSpecification &spec{x.BeginDir()};
+ llvm::omp::Directive dirId{spec.DirId()};
+
+ // Collect symbols from DSA clauses on the construct. These symbols
+ // are the "host" versions of symbols inside the construct. The flags
+ // of interest are on the associated symbols.
+ std::map<const Symbol *, std::pair<parser::CharBlock, llvm::omp::Clause>> dsa;
+ for (auto &clause : spec.Clauses().v) {
+ llvm::omp::Clause clauseId{clause.Id()};
+ if (llvm::omp::isDataSharingAttributeClause(clauseId, version)) {
+ for (auto &object : parser::omp::GetOmpObjectList(clause)->v) {
+ if (auto *symbol{GetObjectSymbol(object)}) {
----------------
luporl wrote:
nit: I think it would be better to spell these 3 `auto`s.
https://github.com/llvm/llvm-project/pull/194961
More information about the flang-commits
mailing list