@@ -5078,7 +5078,8 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
5078
5078
// At most one if clause without a directive-name-modifier can appear on
5079
5079
// the directive.
5080
5080
OpenMPDirectiveKind CurNM = IC->getNameModifier();
5081
- if (FoundNameModifiers[CurNM]) {
5081
+ auto &FNM = FoundNameModifiers[CurNM];
5082
+ if (FNM) {
5082
5083
S.Diag(C->getBeginLoc(), diag::err_omp_more_one_clause)
5083
5084
<< getOpenMPDirectiveName(Kind) << getOpenMPClauseName(OMPC_if)
5084
5085
<< (CurNM != OMPD_unknown) << getOpenMPDirectiveName(CurNM);
@@ -5087,7 +5088,7 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
5087
5088
NameModifierLoc.push_back(IC->getNameModifierLoc());
5088
5089
++NamedModifiersNumber;
5089
5090
}
5090
- FoundNameModifiers[CurNM] = IC;
5091
+ FNM = IC;
5091
5092
if (CurNM == OMPD_unknown)
5092
5093
continue;
5093
5094
// Check if the specified name modifier is allowed for the current
@@ -6759,16 +6760,15 @@ SemaOpenMP::DeclGroupPtrTy SemaOpenMP::ActOnOpenMPDeclareSimdDirective(
6759
6760
->getCanonicalDecl() == CanonPVD) {
6760
6761
// OpenMP [2.8.1, simd construct, Restrictions]
6761
6762
// A list-item cannot appear in more than one aligned clause.
6762
- if (AlignedArgs.count(CanonPVD) > 0) {
6763
+ auto [It, Inserted] = AlignedArgs.try_emplace(CanonPVD, E);
6764
+ if (!Inserted) {
6763
6765
Diag(E->getExprLoc(), diag::err_omp_used_in_clause_twice)
6764
6766
<< 1 << getOpenMPClauseName(OMPC_aligned)
6765
6767
<< E->getSourceRange();
6766
- Diag(AlignedArgs[CanonPVD]->getExprLoc(),
6767
- diag::note_omp_explicit_dsa)
6768
+ Diag(It->second->getExprLoc(), diag::note_omp_explicit_dsa)
6768
6769
<< getOpenMPClauseName(OMPC_aligned);
6769
6770
continue;
6770
6771
}
6771
- AlignedArgs[CanonPVD] = E;
6772
6772
QualType QTy = PVD->getType()
6773
6773
.getNonReferenceType()
6774
6774
.getUnqualifiedType()
0 commit comments