Skip to content

Commit 8f011e2

Browse files
[Sema] Avoid repeated hash lookups (NFC) (#131263)
1 parent bbd1bb4 commit 8f011e2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6836,22 +6836,21 @@ SemaOpenMP::DeclGroupPtrTy SemaOpenMP::ActOnOpenMPDeclareSimdDirective(
68366836
->getCanonicalDecl() == CanonPVD) {
68376837
// OpenMP [2.15.3.7, linear Clause, Restrictions]
68386838
// A list-item cannot appear in more than one linear clause.
6839-
if (LinearArgs.count(CanonPVD) > 0) {
6839+
if (auto It = LinearArgs.find(CanonPVD); It != LinearArgs.end()) {
68406840
Diag(E->getExprLoc(), diag::err_omp_wrong_dsa)
68416841
<< getOpenMPClauseName(OMPC_linear)
68426842
<< getOpenMPClauseName(OMPC_linear) << E->getSourceRange();
6843-
Diag(LinearArgs[CanonPVD]->getExprLoc(),
6844-
diag::note_omp_explicit_dsa)
6843+
Diag(It->second->getExprLoc(), diag::note_omp_explicit_dsa)
68456844
<< getOpenMPClauseName(OMPC_linear);
68466845
continue;
68476846
}
68486847
// Each argument can appear in at most one uniform or linear clause.
6849-
if (UniformedArgs.count(CanonPVD) > 0) {
6848+
if (auto It = UniformedArgs.find(CanonPVD);
6849+
It != UniformedArgs.end()) {
68506850
Diag(E->getExprLoc(), diag::err_omp_wrong_dsa)
68516851
<< getOpenMPClauseName(OMPC_linear)
68526852
<< getOpenMPClauseName(OMPC_uniform) << E->getSourceRange();
6853-
Diag(UniformedArgs[CanonPVD]->getExprLoc(),
6854-
diag::note_omp_explicit_dsa)
6853+
Diag(It->second->getExprLoc(), diag::note_omp_explicit_dsa)
68556854
<< getOpenMPClauseName(OMPC_uniform);
68566855
continue;
68576856
}

0 commit comments

Comments
 (0)