@@ -390,6 +390,16 @@ std::optional<bool> OmpStructureChecker::IsContiguous(
390390 object.u );
391391}
392392
393+ void OmpStructureChecker::CheckVariableListItem (
394+ const SymbolSourceMap &symbols) {
395+ for (auto &[symbol, source] : symbols) {
396+ if (!IsVariableListItem (*symbol)) {
397+ context_.SayWithDecl (
398+ *symbol, source, " '%s' must be a variable" _err_en_US, symbol->name ());
399+ }
400+ }
401+ }
402+
393403void OmpStructureChecker::CheckMultipleOccurrence (
394404 semantics::UnorderedSymbolSet &listVars,
395405 const std::list<parser::Name> &nameList, const parser::CharBlock &item,
@@ -4587,6 +4597,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Copyprivate &x) {
45874597 CheckAllowedClause (llvm::omp::Clause::OMPC_copyprivate);
45884598 SymbolSourceMap symbols;
45894599 GetSymbolsInObjectList (x.v , symbols);
4600+ CheckVariableListItem (symbols);
45904601 CheckIntentInPointer (symbols, llvm::omp::Clause::OMPC_copyprivate);
45914602 CheckCopyingPolymorphicAllocatable (
45924603 symbols, llvm::omp::Clause::OMPC_copyprivate);
@@ -4859,12 +4870,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::From &x) {
48594870 const auto &objList{std::get<parser::OmpObjectList>(x.v .t )};
48604871 SymbolSourceMap symbols;
48614872 GetSymbolsInObjectList (objList, symbols);
4862- for (const auto &[symbol, source] : symbols) {
4863- if (!IsVariableListItem (*symbol)) {
4864- context_.SayWithDecl (
4865- *symbol, source, " '%s' must be a variable" _err_en_US, symbol->name ());
4866- }
4867- }
4873+ CheckVariableListItem (symbols);
48684874
48694875 // Ref: [4.5:109:19]
48704876 // If a list item is an array section it must specify contiguous storage.
@@ -4904,12 +4910,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::To &x) {
49044910 const auto &objList{std::get<parser::OmpObjectList>(x.v .t )};
49054911 SymbolSourceMap symbols;
49064912 GetSymbolsInObjectList (objList, symbols);
4907- for (const auto &[symbol, source] : symbols) {
4908- if (!IsVariableListItem (*symbol)) {
4909- context_.SayWithDecl (
4910- *symbol, source, " '%s' must be a variable" _err_en_US, symbol->name ());
4911- }
4912- }
4913+ CheckVariableListItem (symbols);
49134914
49144915 // Ref: [4.5:109:19]
49154916 // If a list item is an array section it must specify contiguous storage.
0 commit comments