@@ -390,6 +390,16 @@ std::optional<bool> OmpStructureChecker::IsContiguous(
390
390
object.u );
391
391
}
392
392
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
+
393
403
void OmpStructureChecker::CheckMultipleOccurrence (
394
404
semantics::UnorderedSymbolSet &listVars,
395
405
const std::list<parser::Name> &nameList, const parser::CharBlock &item,
@@ -4587,6 +4597,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Copyprivate &x) {
4587
4597
CheckAllowedClause (llvm::omp::Clause::OMPC_copyprivate);
4588
4598
SymbolSourceMap symbols;
4589
4599
GetSymbolsInObjectList (x.v , symbols);
4600
+ CheckVariableListItem (symbols);
4590
4601
CheckIntentInPointer (symbols, llvm::omp::Clause::OMPC_copyprivate);
4591
4602
CheckCopyingPolymorphicAllocatable (
4592
4603
symbols, llvm::omp::Clause::OMPC_copyprivate);
@@ -4859,12 +4870,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::From &x) {
4859
4870
const auto &objList{std::get<parser::OmpObjectList>(x.v .t )};
4860
4871
SymbolSourceMap symbols;
4861
4872
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);
4868
4874
4869
4875
// Ref: [4.5:109:19]
4870
4876
// 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) {
4904
4910
const auto &objList{std::get<parser::OmpObjectList>(x.v .t )};
4905
4911
SymbolSourceMap symbols;
4906
4912
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);
4913
4914
4914
4915
// Ref: [4.5:109:19]
4915
4916
// If a list item is an array section it must specify contiguous storage.
0 commit comments