@@ -1405,10 +1405,9 @@ const Expr *DSAStackTy::addUniqueAligned(const ValueDecl *D,
14051405 assert(!isStackEmpty() && "Data sharing attributes stack is empty");
14061406 D = getCanonicalDecl(D);
14071407 SharingMapTy &StackElem = getTopOfStack();
1408- auto It = StackElem.AlignedMap.find(D );
1409- if (It == StackElem.AlignedMap.end() ) {
1408+ auto [It, Inserted] = StackElem.AlignedMap.try_emplace(D, NewDE );
1409+ if (Inserted ) {
14101410 assert(NewDE && "Unexpected nullptr expr to be added into aligned map");
1411- StackElem.AlignedMap[D] = NewDE;
14121411 return nullptr;
14131412 }
14141413 assert(It->second && "Unexpected nullptr expr in the aligned map");
@@ -1420,10 +1419,9 @@ const Expr *DSAStackTy::addUniqueNontemporal(const ValueDecl *D,
14201419 assert(!isStackEmpty() && "Data sharing attributes stack is empty");
14211420 D = getCanonicalDecl(D);
14221421 SharingMapTy &StackElem = getTopOfStack();
1423- auto It = StackElem.NontemporalMap.find(D );
1424- if (It == StackElem.NontemporalMap.end() ) {
1422+ auto [It, Inserted] = StackElem.NontemporalMap.try_emplace(D, NewDE );
1423+ if (Inserted ) {
14251424 assert(NewDE && "Unexpected nullptr expr to be added into aligned map");
1426- StackElem.NontemporalMap[D] = NewDE;
14271425 return nullptr;
14281426 }
14291427 assert(It->second && "Unexpected nullptr expr in the aligned map");
@@ -21650,9 +21648,7 @@ SemaOpenMP::ActOnOpenMPDeclareReductionDirectiveStart(
2165021648 while (Filter.hasNext()) {
2165121649 auto *PrevDecl = cast<OMPDeclareReductionDecl>(Filter.next());
2165221650 if (InCompoundScope) {
21653- auto I = UsedAsPrevious.find(PrevDecl);
21654- if (I == UsedAsPrevious.end())
21655- UsedAsPrevious[PrevDecl] = false;
21651+ UsedAsPrevious.try_emplace(PrevDecl, false);
2165621652 if (OMPDeclareReductionDecl *D = PrevDecl->getPrevDeclInScope())
2165721653 UsedAsPrevious[D] = true;
2165821654 }
@@ -21906,9 +21902,7 @@ SemaOpenMP::DeclGroupPtrTy SemaOpenMP::ActOnOpenMPDeclareMapperDirective(
2190621902 while (Filter.hasNext()) {
2190721903 auto *PrevDecl = cast<OMPDeclareMapperDecl>(Filter.next());
2190821904 if (InCompoundScope) {
21909- auto I = UsedAsPrevious.find(PrevDecl);
21910- if (I == UsedAsPrevious.end())
21911- UsedAsPrevious[PrevDecl] = false;
21905+ UsedAsPrevious.try_emplace(PrevDecl, false);
2191221906 if (OMPDeclareMapperDecl *D = PrevDecl->getPrevDeclInScope())
2191321907 UsedAsPrevious[D] = true;
2191421908 }
0 commit comments