[flang] [llvm] [Flang][OpenMP][Sema] Adding parsing and semantic support for scan directive. (PR #102792)
Kiran Chandramohan via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 27 15:44:01 PDT 2024
================
@@ -2357,6 +2441,52 @@ bool OmpStructureChecker::CheckReductionOperators(
return ok;
}
+
+void OmpStructureChecker::AddModifierToMap(
+ const parser::OmpObjectList &x, const ReductionModifier &modifier) {
+ for (const auto &ompObject : x.v) {
+ if (const auto *name{parser::Unwrap<parser::Name>(ompObject)}) {
+ if (const auto *symbol{name->symbol}) {
+ GetContext().reductionMod[symbol->name().ToString()] = modifier;
+ }
+ }
+ }
+}
+
+void OmpStructureChecker::CheckAndAddSymbolsToUsedInScanList(
+ const parser::OmpObjectList &x) {
+ for (const auto &ompObj : x.v) {
+ auto checkScanSymbolInReduction = [&](const parser::Name *name) {
+ if (name->symbol) {
+ if (CurrentDirectiveIsNested()) {
+ std::string nameStr = name->symbol->name().ToString();
+ if (GetContextParent().reductionMod.find(nameStr) ==
+ GetContextParent().reductionMod.end()) {
+
+ context_.Say(name->source,
+ "List item %s must appear in 'reduction' clause "
+ "with the 'inscan' modifier of the parent "
+ "directive"_err_en_US,
----------------
kiranchandramohan wrote:
```suggestion
"List item %s must appear in a REDUCTION clause "
"with the INSCAN modifier of the parent "
"directive"_err_en_US,
```
https://github.com/llvm/llvm-project/pull/102792
More information about the llvm-commits
mailing list