@@ -6549,18 +6549,14 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6549
6549
ClausesWithImplicit);
6550
6550
}
6551
6551
6552
- llvm::SmallVector<OpenMPDirectiveKind, 4> AllowedNameModifiers;
6553
6552
switch (Kind) {
6554
6553
case OMPD_parallel:
6555
6554
Res = ActOnOpenMPParallelDirective(ClausesWithImplicit, AStmt, StartLoc,
6556
6555
EndLoc);
6557
- AllowedNameModifiers.push_back(OMPD_parallel);
6558
6556
break;
6559
6557
case OMPD_simd:
6560
6558
Res = ActOnOpenMPSimdDirective(ClausesWithImplicit, AStmt, StartLoc, EndLoc,
6561
6559
VarsWithInheritedDSA);
6562
- if (getLangOpts().OpenMP >= 50)
6563
- AllowedNameModifiers.push_back(OMPD_simd);
6564
6560
break;
6565
6561
case OMPD_tile:
6566
6562
Res =
@@ -6577,8 +6573,6 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6577
6573
case OMPD_for_simd:
6578
6574
Res = ActOnOpenMPForSimdDirective(ClausesWithImplicit, AStmt, StartLoc,
6579
6575
EndLoc, VarsWithInheritedDSA);
6580
- if (getLangOpts().OpenMP >= 50)
6581
- AllowedNameModifiers.push_back(OMPD_simd);
6582
6576
break;
6583
6577
case OMPD_sections:
6584
6578
Res = ActOnOpenMPSectionsDirective(ClausesWithImplicit, AStmt, StartLoc,
@@ -6609,14 +6603,10 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6609
6603
case OMPD_parallel_for:
6610
6604
Res = ActOnOpenMPParallelForDirective(ClausesWithImplicit, AStmt, StartLoc,
6611
6605
EndLoc, VarsWithInheritedDSA);
6612
- AllowedNameModifiers.push_back(OMPD_parallel);
6613
6606
break;
6614
6607
case OMPD_parallel_for_simd:
6615
6608
Res = ActOnOpenMPParallelForSimdDirective(
6616
6609
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6617
- AllowedNameModifiers.push_back(OMPD_parallel);
6618
- if (getLangOpts().OpenMP >= 50)
6619
- AllowedNameModifiers.push_back(OMPD_simd);
6620
6610
break;
6621
6611
case OMPD_scope:
6622
6612
Res =
@@ -6625,22 +6615,18 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6625
6615
case OMPD_parallel_master:
6626
6616
Res = ActOnOpenMPParallelMasterDirective(ClausesWithImplicit, AStmt,
6627
6617
StartLoc, EndLoc);
6628
- AllowedNameModifiers.push_back(OMPD_parallel);
6629
6618
break;
6630
6619
case OMPD_parallel_masked:
6631
6620
Res = ActOnOpenMPParallelMaskedDirective(ClausesWithImplicit, AStmt,
6632
6621
StartLoc, EndLoc);
6633
- AllowedNameModifiers.push_back(OMPD_parallel);
6634
6622
break;
6635
6623
case OMPD_parallel_sections:
6636
6624
Res = ActOnOpenMPParallelSectionsDirective(ClausesWithImplicit, AStmt,
6637
6625
StartLoc, EndLoc);
6638
- AllowedNameModifiers.push_back(OMPD_parallel);
6639
6626
break;
6640
6627
case OMPD_task:
6641
6628
Res =
6642
6629
ActOnOpenMPTaskDirective(ClausesWithImplicit, AStmt, StartLoc, EndLoc);
6643
- AllowedNameModifiers.push_back(OMPD_task);
6644
6630
break;
6645
6631
case OMPD_taskyield:
6646
6632
assert(ClausesWithImplicit.empty() &&
@@ -6700,19 +6686,14 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6700
6686
case OMPD_target:
6701
6687
Res = ActOnOpenMPTargetDirective(ClausesWithImplicit, AStmt, StartLoc,
6702
6688
EndLoc);
6703
- AllowedNameModifiers.push_back(OMPD_target);
6704
6689
break;
6705
6690
case OMPD_target_parallel:
6706
6691
Res = ActOnOpenMPTargetParallelDirective(ClausesWithImplicit, AStmt,
6707
6692
StartLoc, EndLoc);
6708
- AllowedNameModifiers.push_back(OMPD_target);
6709
- AllowedNameModifiers.push_back(OMPD_parallel);
6710
6693
break;
6711
6694
case OMPD_target_parallel_for:
6712
6695
Res = ActOnOpenMPTargetParallelForDirective(
6713
6696
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6714
- AllowedNameModifiers.push_back(OMPD_target);
6715
- AllowedNameModifiers.push_back(OMPD_parallel);
6716
6697
break;
6717
6698
case OMPD_cancellation_point:
6718
6699
assert(ClausesWithImplicit.empty() &&
@@ -6726,90 +6707,58 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6726
6707
"No associated statement allowed for 'omp cancel' directive");
6727
6708
Res = ActOnOpenMPCancelDirective(ClausesWithImplicit, StartLoc, EndLoc,
6728
6709
CancelRegion);
6729
- AllowedNameModifiers.push_back(OMPD_cancel);
6730
6710
break;
6731
6711
case OMPD_target_data:
6732
6712
Res = ActOnOpenMPTargetDataDirective(ClausesWithImplicit, AStmt, StartLoc,
6733
6713
EndLoc);
6734
- AllowedNameModifiers.push_back(OMPD_target_data);
6735
6714
break;
6736
6715
case OMPD_target_enter_data:
6737
6716
Res = ActOnOpenMPTargetEnterDataDirective(ClausesWithImplicit, StartLoc,
6738
6717
EndLoc, AStmt);
6739
- AllowedNameModifiers.push_back(OMPD_target_enter_data);
6740
6718
break;
6741
6719
case OMPD_target_exit_data:
6742
6720
Res = ActOnOpenMPTargetExitDataDirective(ClausesWithImplicit, StartLoc,
6743
6721
EndLoc, AStmt);
6744
- AllowedNameModifiers.push_back(OMPD_target_exit_data);
6745
6722
break;
6746
6723
case OMPD_taskloop:
6747
6724
Res = ActOnOpenMPTaskLoopDirective(ClausesWithImplicit, AStmt, StartLoc,
6748
6725
EndLoc, VarsWithInheritedDSA);
6749
- AllowedNameModifiers.push_back(OMPD_taskloop);
6750
6726
break;
6751
6727
case OMPD_taskloop_simd:
6752
6728
Res = ActOnOpenMPTaskLoopSimdDirective(ClausesWithImplicit, AStmt, StartLoc,
6753
6729
EndLoc, VarsWithInheritedDSA);
6754
- AllowedNameModifiers.push_back(OMPD_taskloop);
6755
- if (getLangOpts().OpenMP >= 50)
6756
- AllowedNameModifiers.push_back(OMPD_simd);
6757
6730
break;
6758
6731
case OMPD_master_taskloop:
6759
6732
Res = ActOnOpenMPMasterTaskLoopDirective(
6760
6733
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6761
- AllowedNameModifiers.push_back(OMPD_taskloop);
6762
6734
break;
6763
6735
case OMPD_masked_taskloop:
6764
6736
Res = ActOnOpenMPMaskedTaskLoopDirective(
6765
6737
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6766
- AllowedNameModifiers.push_back(OMPD_taskloop);
6767
6738
break;
6768
6739
case OMPD_master_taskloop_simd:
6769
6740
Res = ActOnOpenMPMasterTaskLoopSimdDirective(
6770
6741
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6771
- AllowedNameModifiers.push_back(OMPD_taskloop);
6772
- if (getLangOpts().OpenMP >= 50)
6773
- AllowedNameModifiers.push_back(OMPD_simd);
6774
6742
break;
6775
6743
case OMPD_masked_taskloop_simd:
6776
6744
Res = ActOnOpenMPMaskedTaskLoopSimdDirective(
6777
6745
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6778
- if (getLangOpts().OpenMP >= 51) {
6779
- AllowedNameModifiers.push_back(OMPD_taskloop);
6780
- AllowedNameModifiers.push_back(OMPD_simd);
6781
- }
6782
6746
break;
6783
6747
case OMPD_parallel_master_taskloop:
6784
6748
Res = ActOnOpenMPParallelMasterTaskLoopDirective(
6785
6749
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6786
- AllowedNameModifiers.push_back(OMPD_taskloop);
6787
- AllowedNameModifiers.push_back(OMPD_parallel);
6788
6750
break;
6789
6751
case OMPD_parallel_masked_taskloop:
6790
6752
Res = ActOnOpenMPParallelMaskedTaskLoopDirective(
6791
6753
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6792
- if (getLangOpts().OpenMP >= 51) {
6793
- AllowedNameModifiers.push_back(OMPD_taskloop);
6794
- AllowedNameModifiers.push_back(OMPD_parallel);
6795
- }
6796
6754
break;
6797
6755
case OMPD_parallel_master_taskloop_simd:
6798
6756
Res = ActOnOpenMPParallelMasterTaskLoopSimdDirective(
6799
6757
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6800
- AllowedNameModifiers.push_back(OMPD_taskloop);
6801
- AllowedNameModifiers.push_back(OMPD_parallel);
6802
- if (getLangOpts().OpenMP >= 50)
6803
- AllowedNameModifiers.push_back(OMPD_simd);
6804
6758
break;
6805
6759
case OMPD_parallel_masked_taskloop_simd:
6806
6760
Res = ActOnOpenMPParallelMaskedTaskLoopSimdDirective(
6807
6761
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6808
- if (getLangOpts().OpenMP >= 51) {
6809
- AllowedNameModifiers.push_back(OMPD_taskloop);
6810
- AllowedNameModifiers.push_back(OMPD_parallel);
6811
- AllowedNameModifiers.push_back(OMPD_simd);
6812
- }
6813
6762
break;
6814
6763
case OMPD_distribute:
6815
6764
Res = ActOnOpenMPDistributeDirective(ClausesWithImplicit, AStmt, StartLoc,
@@ -6818,40 +6767,26 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6818
6767
case OMPD_target_update:
6819
6768
Res = ActOnOpenMPTargetUpdateDirective(ClausesWithImplicit, StartLoc,
6820
6769
EndLoc, AStmt);
6821
- AllowedNameModifiers.push_back(OMPD_target_update);
6822
6770
break;
6823
6771
case OMPD_distribute_parallel_for:
6824
6772
Res = ActOnOpenMPDistributeParallelForDirective(
6825
6773
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6826
- AllowedNameModifiers.push_back(OMPD_parallel);
6827
6774
break;
6828
6775
case OMPD_distribute_parallel_for_simd:
6829
6776
Res = ActOnOpenMPDistributeParallelForSimdDirective(
6830
6777
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6831
- AllowedNameModifiers.push_back(OMPD_parallel);
6832
- if (getLangOpts().OpenMP >= 50)
6833
- AllowedNameModifiers.push_back(OMPD_simd);
6834
6778
break;
6835
6779
case OMPD_distribute_simd:
6836
6780
Res = ActOnOpenMPDistributeSimdDirective(
6837
6781
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6838
- if (getLangOpts().OpenMP >= 50)
6839
- AllowedNameModifiers.push_back(OMPD_simd);
6840
6782
break;
6841
6783
case OMPD_target_parallel_for_simd:
6842
6784
Res = ActOnOpenMPTargetParallelForSimdDirective(
6843
6785
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6844
- AllowedNameModifiers.push_back(OMPD_target);
6845
- AllowedNameModifiers.push_back(OMPD_parallel);
6846
- if (getLangOpts().OpenMP >= 50)
6847
- AllowedNameModifiers.push_back(OMPD_simd);
6848
6786
break;
6849
6787
case OMPD_target_simd:
6850
6788
Res = ActOnOpenMPTargetSimdDirective(ClausesWithImplicit, AStmt, StartLoc,
6851
6789
EndLoc, VarsWithInheritedDSA);
6852
- AllowedNameModifiers.push_back(OMPD_target);
6853
- if (getLangOpts().OpenMP >= 50)
6854
- AllowedNameModifiers.push_back(OMPD_simd);
6855
6790
break;
6856
6791
case OMPD_teams_distribute:
6857
6792
Res = ActOnOpenMPTeamsDistributeDirective(
@@ -6860,51 +6795,34 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6860
6795
case OMPD_teams_distribute_simd:
6861
6796
Res = ActOnOpenMPTeamsDistributeSimdDirective(
6862
6797
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6863
- if (getLangOpts().OpenMP >= 50)
6864
- AllowedNameModifiers.push_back(OMPD_simd);
6865
6798
break;
6866
6799
case OMPD_teams_distribute_parallel_for_simd:
6867
6800
Res = ActOnOpenMPTeamsDistributeParallelForSimdDirective(
6868
6801
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6869
- AllowedNameModifiers.push_back(OMPD_parallel);
6870
- if (getLangOpts().OpenMP >= 50)
6871
- AllowedNameModifiers.push_back(OMPD_simd);
6872
6802
break;
6873
6803
case OMPD_teams_distribute_parallel_for:
6874
6804
Res = ActOnOpenMPTeamsDistributeParallelForDirective(
6875
6805
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6876
- AllowedNameModifiers.push_back(OMPD_parallel);
6877
6806
break;
6878
6807
case OMPD_target_teams:
6879
6808
Res = ActOnOpenMPTargetTeamsDirective(ClausesWithImplicit, AStmt, StartLoc,
6880
6809
EndLoc);
6881
- AllowedNameModifiers.push_back(OMPD_target);
6882
6810
break;
6883
6811
case OMPD_target_teams_distribute:
6884
6812
Res = ActOnOpenMPTargetTeamsDistributeDirective(
6885
6813
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6886
- AllowedNameModifiers.push_back(OMPD_target);
6887
6814
break;
6888
6815
case OMPD_target_teams_distribute_parallel_for:
6889
6816
Res = ActOnOpenMPTargetTeamsDistributeParallelForDirective(
6890
6817
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6891
- AllowedNameModifiers.push_back(OMPD_target);
6892
- AllowedNameModifiers.push_back(OMPD_parallel);
6893
6818
break;
6894
6819
case OMPD_target_teams_distribute_parallel_for_simd:
6895
6820
Res = ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(
6896
6821
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6897
- AllowedNameModifiers.push_back(OMPD_target);
6898
- AllowedNameModifiers.push_back(OMPD_parallel);
6899
- if (getLangOpts().OpenMP >= 50)
6900
- AllowedNameModifiers.push_back(OMPD_simd);
6901
6822
break;
6902
6823
case OMPD_target_teams_distribute_simd:
6903
6824
Res = ActOnOpenMPTargetTeamsDistributeSimdDirective(
6904
6825
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6905
- AllowedNameModifiers.push_back(OMPD_target);
6906
- if (getLangOpts().OpenMP >= 50)
6907
- AllowedNameModifiers.push_back(OMPD_simd);
6908
6826
break;
6909
6827
case OMPD_interop:
6910
6828
assert(AStmt == nullptr &&
@@ -6926,7 +6844,6 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
6926
6844
case OMPD_target_teams_loop:
6927
6845
Res = ActOnOpenMPTargetTeamsGenericLoopDirective(
6928
6846
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
6929
- AllowedNameModifiers.push_back(OMPD_target);
6930
6847
break;
6931
6848
case OMPD_parallel_loop:
6932
6849
Res = ActOnOpenMPParallelGenericLoopDirective(
@@ -7096,6 +7013,11 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
7096
7013
}
7097
7014
}
7098
7015
7016
+ llvm::SmallVector<OpenMPDirectiveKind, 4> AllowedNameModifiers;
7017
+ for (OpenMPDirectiveKind D : getLeafConstructsOrSelf(Kind)) {
7018
+ if (isAllowedClauseForDirective(D, OMPC_if, getLangOpts().OpenMP))
7019
+ AllowedNameModifiers.push_back(D);
7020
+ }
7099
7021
if (!AllowedNameModifiers.empty())
7100
7022
ErrorFound = checkIfClauses(SemaRef, Kind, Clauses, AllowedNameModifiers) ||
7101
7023
ErrorFound;
0 commit comments