[Mlir-commits] [mlir] 67453c8 - Use std::make_unique instead of `new` to reinitalize a unique_ptr (NFC)

Mehdi Amini llvmlistbot at llvm.org
Sun Nov 14 14:35:45 PST 2021


Author: Mehdi Amini
Date: 2021-11-14T22:28:54Z
New Revision: 67453c894134f3035fcaeac8b04a86a821abddc5

URL: https://github.com/llvm/llvm-project/commit/67453c894134f3035fcaeac8b04a86a821abddc5
DIFF: https://github.com/llvm/llvm-project/commit/67453c894134f3035fcaeac8b04a86a821abddc5.diff

LOG: Use std::make_unique instead of `new` to reinitalize a unique_ptr (NFC)

Fix a clang-tidy warning.

Added: 
    

Modified: 
    mlir/lib/Pass/Pass.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 9d0a0c18d56f4..f8551fcb44fa8 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -226,7 +226,7 @@ OpPassManager::OpPassManager(StringRef name, Nesting nesting)
 OpPassManager::OpPassManager(OpPassManager &&rhs) : impl(std::move(rhs.impl)) {}
 OpPassManager::OpPassManager(const OpPassManager &rhs) { *this = rhs; }
 OpPassManager &OpPassManager::operator=(const OpPassManager &rhs) {
-  impl.reset(new OpPassManagerImpl(rhs.impl->name, rhs.impl->nesting));
+  impl = std::make_unique<OpPassManagerImpl>(rhs.impl->name, rhs.impl->nesting);
   impl->initializationGeneration = rhs.impl->initializationGeneration;
   for (auto &pass : rhs.impl->passes) {
     auto newPass = pass->clone();


        


More information about the Mlir-commits mailing list