@@ -694,20 +694,22 @@ Symbol *AccAttributeVisitor::ResolveName(const parser::Name &name) {
694
694
bool AccAttributeVisitor::Pre (const parser::OpenACCRoutineConstruct &x) {
695
695
const auto &optName{std::get<std::optional<parser::Name>>(x.t )};
696
696
if (optName) {
697
- if (!ResolveName (*optName))
697
+ if (!ResolveName (*optName)) {
698
698
context_.Say ((*optName).source ,
699
699
" No function or subroutine declared for '%s'" _err_en_US,
700
700
(*optName).source );
701
+ }
701
702
}
702
703
return true ;
703
704
}
704
705
705
706
bool AccAttributeVisitor::Pre (const parser::AccBindClause &x) {
706
707
if (const auto *name{std::get_if<parser::Name>(&x.u )}) {
707
- if (!ResolveName (*name))
708
+ if (!ResolveName (*name)) {
708
709
context_.Say (name->source ,
709
710
" No function or subroutine declared for '%s'" _err_en_US,
710
711
name->source );
712
+ }
711
713
}
712
714
return true ;
713
715
}
@@ -750,13 +752,14 @@ void AccAttributeVisitor::AllowOnlyArrayAndSubArray(
750
752
std::visit (
751
753
common::visitors{
752
754
[&](const parser::Designator &designator) {
753
- if (!IsLastNameArray (designator))
755
+ if (!IsLastNameArray (designator)) {
754
756
context_.Say (designator.source ,
755
757
" Only array element or subarray are allowed in %s directive" _err_en_US,
756
758
parser::ToUpperCaseLetters (
757
759
llvm::acc::getOpenACCDirectiveName (
758
760
GetContext ().directive )
759
761
.str ()));
762
+ }
760
763
},
761
764
[&](const auto &name) {
762
765
context_.Say (name.source ,
@@ -777,14 +780,15 @@ void AccAttributeVisitor::DoNotAllowAssumedSizedArray(
777
780
common::visitors{
778
781
[&](const parser::Designator &designator) {
779
782
const auto &name{GetLastName (designator)};
780
- if (name.symbol && semantics::IsAssumedSizeArray (*name.symbol ))
783
+ if (name.symbol && semantics::IsAssumedSizeArray (*name.symbol )) {
781
784
context_.Say (designator.source ,
782
785
" Assumed-size dummy arrays may not appear on the %s "
783
786
" directive" _err_en_US,
784
787
parser::ToUpperCaseLetters (
785
788
llvm::acc::getOpenACCDirectiveName (
786
789
GetContext ().directive )
787
790
.str ()));
791
+ }
788
792
},
789
793
[&](const auto &name) {
790
794
@@ -861,13 +865,14 @@ void AccAttributeVisitor::EnsureAllocatableOrPointer(
861
865
common::visitors{
862
866
[&](const parser::Designator &designator) {
863
867
const auto &lastName{GetLastName (designator)};
864
- if (!IsAllocatableOrPointer (*lastName.symbol ))
868
+ if (!IsAllocatableOrPointer (*lastName.symbol )) {
865
869
context_.Say (designator.source ,
866
870
" Argument `%s` on the %s clause must be a variable or "
867
871
" array with the POINTER or ALLOCATABLE attribute" _err_en_US,
868
872
lastName.symbol ->name (),
869
873
parser::ToUpperCaseLetters (
870
874
llvm::acc::getOpenACCClauseName (clause).str ()));
875
+ }
871
876
},
872
877
[&](const auto &name) {
873
878
context_.Say (name.source ,
@@ -1349,8 +1354,9 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPDeclarativeAllocate &x) {
1349
1354
bool OmpAttributeVisitor::Pre (const parser::OpenMPExecutableAllocate &x) {
1350
1355
PushContext (x.source , llvm::omp::Directive::OMPD_allocate);
1351
1356
const auto &list{std::get<std::optional<parser::OmpObjectList>>(x.t )};
1352
- if (list)
1357
+ if (list) {
1353
1358
ResolveOmpObjectList (*list, Symbol::Flag::OmpExecutableAllocateDirective);
1359
+ }
1354
1360
return true ;
1355
1361
}
1356
1362
@@ -1376,8 +1382,9 @@ void OmpAttributeVisitor::Post(const parser::OmpDefaultClause &x) {
1376
1382
bool OmpAttributeVisitor::IsNestedInDirective (llvm::omp::Directive directive) {
1377
1383
if (dirContext_.size () >= 1 ) {
1378
1384
for (std::size_t i = dirContext_.size () - 1 ; i > 0 ; --i) {
1379
- if (dirContext_[i - 1 ].directive == directive)
1385
+ if (dirContext_[i - 1 ].directive == directive) {
1380
1386
return true ;
1387
+ }
1381
1388
}
1382
1389
}
1383
1390
return false ;
@@ -1389,17 +1396,19 @@ void OmpAttributeVisitor::Post(const parser::OpenMPExecutableAllocate &x) {
1389
1396
// parser::Unwrap instead of the following loop
1390
1397
const auto &clauseList{std::get<parser::OmpClauseList>(x.t )};
1391
1398
for (const auto &clause : clauseList.v ) {
1392
- if (std::get_if<parser::OmpClause::Allocator>(&clause.u ))
1399
+ if (std::get_if<parser::OmpClause::Allocator>(&clause.u )) {
1393
1400
hasAllocator = true ;
1401
+ }
1394
1402
}
1395
1403
1396
- if (IsNestedInDirective (llvm::omp::Directive::OMPD_target) && !hasAllocator)
1404
+ if (IsNestedInDirective (llvm::omp::Directive::OMPD_target) && !hasAllocator) {
1397
1405
// TODO: expand this check to exclude the case when a requires
1398
1406
// directive with the dynamic_allocators clause is present
1399
1407
// in the same compilation unit (OMP5.0 2.11.3).
1400
1408
context_.Say (x.source ,
1401
1409
" ALLOCATE directives that appear in a TARGET region "
1402
1410
" must specify an allocator clause" _err_en_US);
1411
+ }
1403
1412
PopContext ();
1404
1413
}
1405
1414
@@ -1675,16 +1684,18 @@ void ResolveOmpParts(
1675
1684
void OmpAttributeVisitor::CheckDataCopyingClause (
1676
1685
const parser::Name &name, const Symbol &symbol, Symbol::Flag ompFlag) {
1677
1686
const auto *checkSymbol{&symbol};
1678
- if (const auto *details{symbol.detailsIf <HostAssocDetails>()})
1687
+ if (const auto *details{symbol.detailsIf <HostAssocDetails>()}) {
1679
1688
checkSymbol = &details->symbol ();
1689
+ }
1680
1690
1681
1691
if (ompFlag == Symbol::Flag::OmpCopyIn) {
1682
1692
// List of items/objects that can appear in a 'copyin' clause must be
1683
1693
// 'threadprivate'
1684
- if (!checkSymbol->test (Symbol::Flag::OmpThreadprivate))
1694
+ if (!checkSymbol->test (Symbol::Flag::OmpThreadprivate)) {
1685
1695
context_.Say (name.source ,
1686
1696
" Non-THREADPRIVATE object '%s' in COPYIN clause" _err_en_US,
1687
1697
checkSymbol->name ());
1698
+ }
1688
1699
} else if (ompFlag == Symbol::Flag::OmpCopyPrivate &&
1689
1700
GetContext ().directive == llvm::omp::Directive::OMPD_single) {
1690
1701
// A list item that appears in a 'copyprivate' clause may not appear on a
@@ -1715,10 +1726,11 @@ void OmpAttributeVisitor::CheckPrivateDSAObject(
1715
1726
const parser::Name &name, const Symbol &symbol, Symbol::Flag ompFlag) {
1716
1727
const auto &ultimateSymbol{symbol.GetUltimate ()};
1717
1728
llvm::StringRef clauseName{" PRIVATE" };
1718
- if (ompFlag == Symbol::Flag::OmpFirstPrivate)
1729
+ if (ompFlag == Symbol::Flag::OmpFirstPrivate) {
1719
1730
clauseName = " FIRSTPRIVATE" ;
1720
- else if (ompFlag == Symbol::Flag::OmpLastPrivate)
1731
+ } else if (ompFlag == Symbol::Flag::OmpLastPrivate) {
1721
1732
clauseName = " LASTPRIVATE" ;
1733
+ }
1722
1734
1723
1735
if (ultimateSymbol.test (Symbol::Flag::InNamelist)) {
1724
1736
context_.Say (name.source ,
0 commit comments