r330042 - [OPENMP] Replace push_back by emplace_back, NFC.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 13 10:48:43 PDT 2018


Author: abataev
Date: Fri Apr 13 10:48:43 2018
New Revision: 330042

URL: http://llvm.org/viewvc/llvm-project?rev=330042&view=rev
Log:
[OPENMP] Replace push_back by emplace_back, NFC.

Modified:
    cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
    cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
    cfe/trunk/lib/Sema/SemaOpenMP.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=330042&r1=330041&r2=330042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Fri Apr 13 10:48:43 2018
@@ -1285,7 +1285,7 @@ void CGOpenMPRuntime::emitUserDefinedRed
         cast<VarDecl>(D->lookup(Priv).front()),
         /*IsCombiner=*/false);
   }
-  UDRMap.insert(std::make_pair(D, std::make_pair(Combiner, Initializer)));
+  UDRMap.try_emplace(D, Combiner, Initializer);
   if (CGF) {
     auto &Decls = FunctionUDRMap.FindAndConstruct(CGF->CurFn);
     Decls.second.push_back(D);
@@ -2817,7 +2817,7 @@ CGOpenMPRuntime::getOrCreateInternalVari
   llvm::raw_svector_ostream Out(Buffer);
   Out << Name;
   auto RuntimeName = Out.str();
-  auto &Elem = *InternalVars.insert(std::make_pair(RuntimeName, nullptr)).first;
+  auto &Elem = *InternalVars.try_emplace(RuntimeName, nullptr).first;
   if (Elem.second) {
     assert(Elem.second->getType()->getPointerElementType() == Ty &&
            "OMP internal variable has different type than requested");
@@ -4659,31 +4659,31 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFun
   auto I = Data.PrivateCopies.begin();
   for (auto *E : Data.PrivateVars) {
     auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
-    Privates.push_back(std::make_pair(
+    Privates.emplace_back(
         C.getDeclAlign(VD),
         PrivateHelpersTy(VD, cast<VarDecl>(cast<DeclRefExpr>(*I)->getDecl()),
-                         /*PrivateElemInit=*/nullptr)));
+                         /*PrivateElemInit=*/nullptr));
     ++I;
   }
   I = Data.FirstprivateCopies.begin();
   auto IElemInitRef = Data.FirstprivateInits.begin();
   for (auto *E : Data.FirstprivateVars) {
     auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
-    Privates.push_back(std::make_pair(
+    Privates.emplace_back(
         C.getDeclAlign(VD),
         PrivateHelpersTy(
             VD, cast<VarDecl>(cast<DeclRefExpr>(*I)->getDecl()),
-            cast<VarDecl>(cast<DeclRefExpr>(*IElemInitRef)->getDecl()))));
+            cast<VarDecl>(cast<DeclRefExpr>(*IElemInitRef)->getDecl())));
     ++I;
     ++IElemInitRef;
   }
   I = Data.LastprivateCopies.begin();
   for (auto *E : Data.LastprivateVars) {
     auto *VD = cast<VarDecl>(cast<DeclRefExpr>(E)->getDecl());
-    Privates.push_back(std::make_pair(
+    Privates.emplace_back(
         C.getDeclAlign(VD),
         PrivateHelpersTy(VD, cast<VarDecl>(cast<DeclRefExpr>(*I)->getDecl()),
-                         /*PrivateElemInit=*/nullptr)));
+                         /*PrivateElemInit=*/nullptr));
     ++I;
   }
   std::stable_sort(Privates.begin(), Privates.end(), stable_sort_comparator);
@@ -7240,7 +7240,7 @@ emitOffloadingArrays(CodeGenFunction &CG
 
       if (Info.requiresDevicePointerInfo())
         if (auto *DevVD = BasePointers[i].getDevicePtrDecl())
-          Info.CaptureDeviceAddrMap.insert(std::make_pair(DevVD, BPAddr));
+          Info.CaptureDeviceAddrMap.try_emplace(DevVD, BPAddr);
 
       llvm::Value *PVal = Pointers[i];
       llvm::Value *P = CGF.Builder.CreateConstInBoundsGEP2_32(

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=330042&r1=330041&r2=330042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Fri Apr 13 10:48:43 2018
@@ -2832,7 +2832,7 @@ void CodeGenFunction::EmitOMPTaskBasedDi
   // Build list of dependences.
   for (const auto *C : S.getClausesOfKind<OMPDependClause>())
     for (const Expr *IRef : C->varlists())
-      Data.Dependences.push_back(std::make_pair(C->getDependencyKind(), IRef));
+      Data.Dependences.emplace_back(C->getDependencyKind(), IRef);
   auto &&CodeGen = [&Data, &S, CS, &BodyGen, &LastprivateDstsOrigs,
                     CapturedRegion](CodeGenFunction &CGF,
                                     PrePostActionTy &Action) {
@@ -3068,7 +3068,7 @@ void CodeGenFunction::EmitOMPTargetTaskB
   // Build list of dependences.
   for (const auto *C : S.getClausesOfKind<OMPDependClause>())
     for (const Expr *IRef : C->varlists())
-      Data.Dependences.push_back(std::make_pair(C->getDependencyKind(), IRef));
+      Data.Dependences.emplace_back(C->getDependencyKind(), IRef);
   auto &&CodeGen = [&Data, &S, CS, &BodyGen, BPVD, PVD, SVD,
                     &InputInfo](CodeGenFunction &CGF, PrePostActionTy &Action) {
     // Set proper addresses for generated private copies.

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=330042&r1=330041&r2=330042&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Apr 13 10:48:43 2018
@@ -224,7 +224,7 @@ public:
   }
 
   void addCriticalWithHint(OMPCriticalDirective *D, llvm::APSInt Hint) {
-    Criticals[D->getDirectiveName().getAsString()] = std::make_pair(D, Hint);
+    Criticals.try_emplace(D->getDirectiveName().getAsString(), D, Hint);
   }
   const std::pair<OMPCriticalDirective *, llvm::APSInt>
   getCriticalWithHint(const DeclarationNameInfo &Name) const {
@@ -3405,7 +3405,7 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPDe
         if (FD->getNumParams() > PVD->getFunctionScopeIndex() &&
             FD->getParamDecl(PVD->getFunctionScopeIndex())
                     ->getCanonicalDecl() == PVD->getCanonicalDecl()) {
-          UniformedArgs.insert(std::make_pair(PVD->getCanonicalDecl(), E));
+          UniformedArgs.try_emplace(PVD->getCanonicalDecl(), E);
           continue;
         }
     if (isa<CXXThisExpr>(E)) {




More information about the cfe-commits mailing list