Skip to content

Conversation

@TylerNowicki
Copy link
Collaborator

  • Replace usage of unique_ptr<>(new ...) -> make_unique<>();

* Replace usage of unique_ptr<>(new ...) -> make_unique<>();
@TylerNowicki TylerNowicki self-assigned this Oct 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2024

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-coroutines

Author: Tyler Nowicki (TylerNowicki)

Changes
  • Replace usage of unique_ptr<>(new ...) -> make_unique<>();

Full diff: https://github.com/llvm/llvm-project/pull/111870.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/Coroutines/CoroSplit.cpp (+4-8)
  • (modified) llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp (+1-1)
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 88ce331c8cfb64..0395ee62ae988b 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -2211,17 +2211,13 @@ CreateNewABI(Function &F, coro::Shape &S,
 
   switch (S.ABI) {
   case coro::ABI::Switch:
-    return std::unique_ptr<coro::BaseABI>(
-        new coro::SwitchABI(F, S, IsMatCallback));
+    return std::make_unique<coro::SwitchABI>(F, S, IsMatCallback);
   case coro::ABI::Async:
-    return std::unique_ptr<coro::BaseABI>(
-        new coro::AsyncABI(F, S, IsMatCallback));
+    return std::make_unique<coro::AsyncABI>(F, S, IsMatCallback);
   case coro::ABI::Retcon:
-    return std::unique_ptr<coro::BaseABI>(
-        new coro::AnyRetconABI(F, S, IsMatCallback));
+    return std::make_unique<coro::AnyRetconABI>(F, S, IsMatCallback);
   case coro::ABI::RetconOnce:
-    return std::unique_ptr<coro::BaseABI>(
-        new coro::AnyRetconABI(F, S, IsMatCallback));
+    return std::make_unique<coro::AnyRetconABI>(F, S, IsMatCallback);
   }
   llvm_unreachable("Unknown ABI");
 }
diff --git a/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp b/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
index c3394fdaa940ba..68bf640334b5f2 100644
--- a/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
+++ b/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
@@ -247,7 +247,7 @@ TEST_F(ExtraRematTest, TestCoroRematWithCustomABI) {
   ASSERT_TRUE(M);
 
   CoroSplitPass::BaseABITy GenCustomABI = [](Function &F, coro::Shape &S) {
-    return std::unique_ptr<coro::BaseABI>(new ExtraCustomABI(F, S));
+    return std::make_unique<ExtraCustomABI>(F, S);
   };
 
   CGSCCPassManager CGPM;

@TylerNowicki TylerNowicki merged commit 1252623 into llvm:main Oct 10, 2024
7 checks passed
@TylerNowicki TylerNowicki deleted the users/tylernowicki/coro-make-unique-ptr branch October 15, 2024 14:24
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
* Replace usage of unique_ptr<>(new ...) -> make_unique<>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants