From: Christopher Dykes Date: Tue, 9 May 2017 01:16:18 +0000 (-0700) Subject: Codemod folly::make_unique to std::make_unique X-Git-Tag: v2017.05.15.00~22 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=f34acf2cbdfd496b88611f725852f774290ef234 Codemod folly::make_unique to std::make_unique Summary: There are still some upstream references to `folly::make_unique` that need to be removed before it can be full killed, but this gets it most of the way there. Reviewed By: yfeldblum Differential Revision: D5024310 fbshipit-source-id: 6cfe8ea93662be18bb55588c8200dec72946e205 --- diff --git a/folly/AtomicLinkedList.h b/folly/AtomicLinkedList.h index 3ee27bbb..4d1d8503 100644 --- a/folly/AtomicLinkedList.h +++ b/folly/AtomicLinkedList.h @@ -54,7 +54,7 @@ class AtomicLinkedList { * after the call. */ bool insertHead(T t) { - auto wrapper = folly::make_unique(std::move(t)); + auto wrapper = std::make_unique(std::move(t)); return list_.insertHead(wrapper.release()); } diff --git a/folly/Try-inl.h b/folly/Try-inl.h index 7411ec90..92f8f59a 100644 --- a/folly/Try-inl.h +++ b/folly/Try-inl.h @@ -41,7 +41,7 @@ Try::Try(typename std::enable_if::value, } else if (t.hasException()) { contains_ = Contains::EXCEPTION; new (&e_) std::unique_ptr( - folly::make_unique(t.exception())); + std::make_unique(t.exception())); } } @@ -71,7 +71,7 @@ Try::Try(const Try& t) { new (&value_)T(t.value_); } else if (contains_ == Contains::EXCEPTION) { new (&e_)std::unique_ptr(); - e_ = folly::make_unique(*(t.e_)); + e_ = std::make_unique(*(t.e_)); } } @@ -86,7 +86,7 @@ Try& Try::operator=(const Try& t) { new (&value_)T(t.value_); } else if (contains_ == Contains::EXCEPTION) { new (&e_)std::unique_ptr(); - e_ = folly::make_unique(*(t.e_)); + e_ = std::make_unique(*(t.e_)); } return *this; } diff --git a/folly/Try.h b/folly/Try.h index 230c658c..86a5dee0 100644 --- a/folly/Try.h +++ b/folly/Try.h @@ -93,8 +93,8 @@ class Try { * @param e The exception_wrapper */ explicit Try(exception_wrapper e) - : contains_(Contains::EXCEPTION), - e_(folly::make_unique(std::move(e))) {} + : contains_(Contains::EXCEPTION), + e_(std::make_unique(std::move(e))) {} /* * DEPRECATED @@ -108,9 +108,9 @@ class Try { try { std::rethrow_exception(ep); } catch (const std::exception& e) { - e_ = folly::make_unique(std::current_exception(), e); + e_ = std::make_unique(std::current_exception(), e); } catch (...) { - e_ = folly::make_unique(std::current_exception()); + e_ = std::make_unique(std::current_exception()); } } @@ -266,8 +266,8 @@ class Try { * @param e The exception_wrapper */ explicit Try(exception_wrapper e) - : hasValue_(false), - e_(folly::make_unique(std::move(e))) {} + : hasValue_(false), + e_(std::make_unique(std::move(e))) {} /* * DEPRECATED @@ -280,9 +280,9 @@ class Try { try { std::rethrow_exception(ep); } catch (const std::exception& e) { - e_ = folly::make_unique(std::current_exception(), e); + e_ = std::make_unique(std::current_exception(), e); } catch (...) { - e_ = folly::make_unique(std::current_exception()); + e_ = std::make_unique(std::current_exception()); } } @@ -290,7 +290,7 @@ class Try { Try& operator=(const Try& t) { hasValue_ = t.hasValue_; if (t.e_) { - e_ = folly::make_unique(*t.e_); + e_ = std::make_unique(*t.e_); } return *this; } diff --git a/folly/experimental/TestUtil.cpp b/folly/experimental/TestUtil.cpp index afbf25a7..91410a55 100644 --- a/folly/experimental/TestUtil.cpp +++ b/folly/experimental/TestUtil.cpp @@ -102,7 +102,7 @@ TemporaryDirectory::TemporaryDirectory( fs::path dir, Scope scope) : scope_(scope), - path_(folly::make_unique( + path_(std::make_unique( generateUniquePath(std::move(dir), namePrefix))) { fs::create_directory(path()); } diff --git a/folly/experimental/test/FutureDAGTest.cpp b/folly/experimental/test/FutureDAGTest.cpp index 1e4cf888..98329c90 100644 --- a/folly/experimental/test/FutureDAGTest.cpp +++ b/folly/experimental/test/FutureDAGTest.cpp @@ -23,7 +23,7 @@ struct FutureDAGTest : public testing::Test { typedef FutureDAG::Handle Handle; Handle add() { - auto node = folly::make_unique(this); + auto node = std::make_unique(this); auto handle = node->handle; nodes.emplace(handle, std::move(node)); return handle; diff --git a/folly/experimental/test/ReadMostlySharedPtrBenchmark.cpp b/folly/experimental/test/ReadMostlySharedPtrBenchmark.cpp index 70604a33..b1139f24 100644 --- a/folly/experimental/test/ReadMostlySharedPtrBenchmark.cpp +++ b/folly/experimental/test/ReadMostlySharedPtrBenchmark.cpp @@ -29,7 +29,7 @@ template class MainPtr, template class WeakPtr, size_t threadCount> void benchmark(size_t n) { - MainPtr mainPtr(folly::make_unique(42)); + MainPtr mainPtr(std::make_unique(42)); std::vector ts; diff --git a/folly/experimental/test/ReadMostlySharedPtrTest.cpp b/folly/experimental/test/ReadMostlySharedPtrTest.cpp index 8b3140e9..ba85eb0b 100644 --- a/folly/experimental/test/ReadMostlySharedPtrTest.cpp +++ b/folly/experimental/test/ReadMostlySharedPtrTest.cpp @@ -84,12 +84,12 @@ TEST_F(ReadMostlySharedPtrTest, BasicStores) { // Store 1. std::atomic cnt1{0}; - ptr.reset(folly::make_unique(1, cnt1)); + ptr.reset(std::make_unique(1, cnt1)); EXPECT_EQ(1, cnt1.load()); // Store 2, check that 1 is destroyed. std::atomic cnt2{0}; - ptr.reset(folly::make_unique(2, cnt2)); + ptr.reset(std::make_unique(2, cnt2)); EXPECT_EQ(1, cnt2.load()); EXPECT_EQ(0, cnt1.load()); @@ -109,13 +109,13 @@ TEST_F(ReadMostlySharedPtrTest, BasicLoads) { EXPECT_EQ(ptr.get(), nullptr); std::atomic cnt1{0}; - ptr.reset(folly::make_unique(1, cnt1)); + ptr.reset(std::make_unique(1, cnt1)); EXPECT_EQ(1, cnt1.load()); x = ptr; EXPECT_EQ(1, x->value); - ptr.reset(folly::make_unique(2, cnt2)); + ptr.reset(std::make_unique(2, cnt2)); EXPECT_EQ(1, cnt2.load()); EXPECT_EQ(1, cnt1.load()); @@ -174,18 +174,18 @@ TEST_F(ReadMostlySharedPtrTest, LoadsFromThreads) { loads[0].requestAndWait(); - ptr.reset(folly::make_unique(1, cnt)); + ptr.reset(std::make_unique(1, cnt)); loads[1].requestAndWait(); - ptr.reset(folly::make_unique(2, cnt)); + ptr.reset(std::make_unique(2, cnt)); loads[2].requestAndWait(); loads[3].requestAndWait(); - ptr.reset(folly::make_unique(3, cnt)); - ptr.reset(folly::make_unique(4, cnt)); + ptr.reset(std::make_unique(3, cnt)); + ptr.reset(std::make_unique(4, cnt)); loads[4].requestAndWait(); - ptr.reset(folly::make_unique(5, cnt)); + ptr.reset(std::make_unique(5, cnt)); loads[5].requestAndWait(); loads[6].requestAndWait(); @@ -201,8 +201,7 @@ TEST_F(ReadMostlySharedPtrTest, LoadsFromThreads) { TEST_F(ReadMostlySharedPtrTest, Ctor) { std::atomic cnt1{0}; { - ReadMostlyMainPtr ptr( - folly::make_unique(1, cnt1)); + ReadMostlyMainPtr ptr(std::make_unique(1, cnt1)); EXPECT_EQ(1, ptr.getShared()->value); } @@ -217,7 +216,7 @@ TEST_F(ReadMostlySharedPtrTest, ClearingCache) { ReadMostlyMainPtr ptr; // Store 1. - ptr.reset(folly::make_unique(1, cnt1)); + ptr.reset(std::make_unique(1, cnt1)); Coordinator c; @@ -232,7 +231,7 @@ TEST_F(ReadMostlySharedPtrTest, ClearingCache) { EXPECT_EQ(1, cnt1.load()); // Store 2 and check that 1 is destroyed. - ptr.reset(folly::make_unique(2, cnt2)); + ptr.reset(std::make_unique(2, cnt2)); EXPECT_EQ(0, cnt1.load()); // Unblock thread. diff --git a/folly/experimental/test/TestUtilTest.cpp b/folly/experimental/test/TestUtilTest.cpp index cbae5815..32196ecc 100644 --- a/folly/experimental/test/TestUtilTest.cpp +++ b/folly/experimental/test/TestUtilTest.cpp @@ -118,7 +118,7 @@ TEST(TemporaryDirectory, SafelyMove) { expectTempdirExists(d); expectTempdirExists(d2); - dir = folly::make_unique(std::move(d)); + dir = std::make_unique(std::move(d)); dir2 = std::move(d2); } diff --git a/folly/fibers/FiberManager.cpp b/folly/fibers/FiberManager.cpp index 8a04bde1..054ed171 100644 --- a/folly/fibers/FiberManager.cpp +++ b/folly/fibers/FiberManager.cpp @@ -335,7 +335,7 @@ class ScopedAlternateSignalStack { return; } - stack_ = folly::make_unique(); + stack_ = std::make_unique(); setAlternateStack(stack_->data(), stack_->size()); } diff --git a/folly/fibers/FiberManagerInternal-inl.h b/folly/fibers/FiberManagerInternal-inl.h index df354aaa..862e6a30 100644 --- a/folly/fibers/FiberManagerInternal-inl.h +++ b/folly/fibers/FiberManagerInternal-inl.h @@ -313,10 +313,10 @@ void FiberManager::addTaskRemote(F&& func) { auto currentFm = getFiberManagerUnsafe(); if (currentFm && currentFm->currentFiber_ && currentFm->localType_ == localType_) { - return folly::make_unique( + return std::make_unique( std::forward(func), currentFm->currentFiber_->localData_); } - return folly::make_unique(std::forward(func)); + return std::make_unique(std::forward(func)); }(); auto insertHead = [&]() { return remoteTaskQueue_.insertHead(task.release()); diff --git a/folly/fibers/FiberManagerInternal.h b/folly/fibers/FiberManagerInternal.h index 18ec7628..7428d01d 100644 --- a/folly/fibers/FiberManagerInternal.h +++ b/folly/fibers/FiberManagerInternal.h @@ -337,7 +337,7 @@ class FiberManager : public ::folly::Executor { template RemoteTask(F&& f, const Fiber::LocalData& localData_) : func(std::forward(f)), - localData(folly::make_unique(localData_)), + localData(std::make_unique(localData_)), rcontext(RequestContext::saveContext()) {} folly::Function func; std::unique_ptr localData; diff --git a/folly/fibers/GuardPageAllocator.cpp b/folly/fibers/GuardPageAllocator.cpp index fe521a47..23194998 100644 --- a/folly/fibers/GuardPageAllocator.cpp +++ b/folly/fibers/GuardPageAllocator.cpp @@ -245,7 +245,7 @@ class CacheManager { std::lock_guard lg(lock_); if (inUse_ < kMaxInUse) { ++inUse_; - return folly::make_unique(stackSize); + return std::make_unique(stackSize); } return nullptr; @@ -277,7 +277,7 @@ class CacheManager { class StackCacheEntry { public: explicit StackCacheEntry(size_t stackSize) - : stackCache_(folly::make_unique(stackSize)) {} + : stackCache_(std::make_unique(stackSize)) {} StackCache& cache() const noexcept { return *stackCache_; diff --git a/folly/fibers/TimeoutController.cpp b/folly/fibers/TimeoutController.cpp index ce68e9e1..f1bf711b 100644 --- a/folly/fibers/TimeoutController.cpp +++ b/folly/fibers/TimeoutController.cpp @@ -33,7 +33,7 @@ intptr_t TimeoutController::registerTimeout( } timeoutHandleBuckets_.emplace_back( - duration, folly::make_unique()); + duration, std::make_unique()); return *timeoutHandleBuckets_.back().second; }(); diff --git a/folly/fibers/test/FibersBenchmark.cpp b/folly/fibers/test/FibersBenchmark.cpp index 93905851..40d6cb33 100644 --- a/folly/fibers/test/FibersBenchmark.cpp +++ b/folly/fibers/test/FibersBenchmark.cpp @@ -31,7 +31,7 @@ static size_t sNumAwaits; void runBenchmark(size_t numAwaits, size_t toSend) { sNumAwaits = numAwaits; - FiberManager fiberManager(folly::make_unique()); + FiberManager fiberManager(std::make_unique()); auto& loopController = dynamic_cast(fiberManager.loopController()); @@ -87,7 +87,7 @@ BENCHMARK(FiberManagerAllocateDeallocatePattern, iters) { FiberManager::Options opts; opts.maxFibersPoolSize = 0; - FiberManager fiberManager(folly::make_unique(), opts); + FiberManager fiberManager(std::make_unique(), opts); for (size_t iter = 0; iter < iters; ++iter) { DCHECK_EQ(0, fiberManager.fibersPoolSize()); @@ -110,7 +110,7 @@ BENCHMARK(FiberManagerAllocateLargeChunk, iters) { FiberManager::Options opts; opts.maxFibersPoolSize = 0; - FiberManager fiberManager(folly::make_unique(), opts); + FiberManager fiberManager(std::make_unique(), opts); for (size_t iter = 0; iter < iters; ++iter) { DCHECK_EQ(0, fiberManager.fibersPoolSize()); diff --git a/folly/fibers/test/FibersTest.cpp b/folly/fibers/test/FibersTest.cpp index b3d32303..c193c7f5 100644 --- a/folly/fibers/test/FibersTest.cpp +++ b/folly/fibers/test/FibersTest.cpp @@ -44,7 +44,7 @@ TEST(FiberManager, batonTimedWaitTimeout) { bool taskAdded = false; size_t iterations = 0; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -85,7 +85,7 @@ TEST(FiberManager, batonTimedWaitPost) { size_t iterations = 0; Baton* baton_ptr; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -120,7 +120,7 @@ TEST(FiberManager, batonTimedWaitTimeoutEvb) { folly::EventBase evb; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); dynamic_cast(manager.loopController()) .attachEventBase(evb); @@ -159,7 +159,7 @@ TEST(FiberManager, batonTimedWaitPostEvb) { folly::EventBase evb; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); dynamic_cast(manager.loopController()) .attachEventBase(evb); @@ -192,7 +192,7 @@ TEST(FiberManager, batonTimedWaitPostEvb) { } TEST(FiberManager, batonTryWait) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); // Check if try_wait and post work as expected Baton b; @@ -225,7 +225,7 @@ TEST(FiberManager, batonTryWait) { } TEST(FiberManager, genericBatonFiberWait) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); GenericBaton b; bool fiberRunning = false; @@ -254,7 +254,7 @@ TEST(FiberManager, genericBatonFiberWait) { } TEST(FiberManager, genericBatonThreadWait) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); GenericBaton b; std::atomic threadWaiting(false); @@ -284,7 +284,7 @@ TEST(FiberManager, addTasksNoncopyable) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -297,7 +297,7 @@ TEST(FiberManager, addTasksNoncopyable) { await([&pendingFibers](Promise promise) { pendingFibers.push_back(std::move(promise)); }); - return folly::make_unique(i * 2 + 1); + return std::make_unique(i * 2 + 1); }); } @@ -353,7 +353,7 @@ TEST(FiberManager, addTasksThrow) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -405,7 +405,7 @@ TEST(FiberManager, addTasksVoid) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -447,7 +447,7 @@ TEST(FiberManager, addTasksVoidThrow) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -497,7 +497,7 @@ TEST(FiberManager, addTasksReserve) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -587,7 +587,7 @@ TEST(FiberManager, forEach) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -630,7 +630,7 @@ TEST(FiberManager, collectN) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -670,7 +670,7 @@ TEST(FiberManager, collectNThrow) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -709,7 +709,7 @@ TEST(FiberManager, collectNVoid) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -745,7 +745,7 @@ TEST(FiberManager, collectNVoidThrow) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -784,7 +784,7 @@ TEST(FiberManager, collectAll) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -823,7 +823,7 @@ TEST(FiberManager, collectAllVoid) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -858,7 +858,7 @@ TEST(FiberManager, collectAny) { std::vector> pendingFibers; bool taskAdded = false; - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -918,7 +918,7 @@ void expectMainContext(bool& ran, int* mainLocation, int* fiberLocation) { } TEST(FiberManager, runInMainContext) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -954,7 +954,7 @@ TEST(FiberManager, runInMainContext) { } TEST(FiberManager, addTaskFinally) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -981,7 +981,7 @@ TEST(FiberManager, fibersPoolWithinLimit) { FiberManager::Options opts; opts.maxFibersPoolSize = 5; - FiberManager manager(folly::make_unique(), opts); + FiberManager manager(std::make_unique(), opts); auto& loopController = dynamic_cast(manager.loopController()); @@ -1010,7 +1010,7 @@ TEST(FiberManager, fibersPoolOverLimit) { FiberManager::Options opts; opts.maxFibersPoolSize = 5; - FiberManager manager(folly::make_unique(), opts); + FiberManager manager(std::make_unique(), opts); auto& loopController = dynamic_cast(manager.loopController()); @@ -1032,7 +1032,7 @@ TEST(FiberManager, fibersPoolOverLimit) { } TEST(FiberManager, remoteFiberBasic) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -1070,7 +1070,7 @@ TEST(FiberManager, remoteFiberBasic) { } TEST(FiberManager, addTaskRemoteBasic) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); int result[2]; result[0] = result[1] = 0; @@ -1111,7 +1111,7 @@ TEST(FiberManager, addTaskRemoteBasic) { TEST(FiberManager, remoteHasTasks) { size_t counter = 0; - FiberManager fm(folly::make_unique()); + FiberManager fm(std::make_unique()); std::thread remote([&]() { fm.addTaskRemote([&]() { ++counter; }); }); remote.join(); @@ -1127,7 +1127,7 @@ TEST(FiberManager, remoteHasTasks) { TEST(FiberManager, remoteHasReadyTasks) { int result = 0; folly::Optional> savedPromise; - FiberManager fm(folly::make_unique()); + FiberManager fm(std::make_unique()); std::thread remote([&]() { fm.addTaskRemote([&]() { result = await( @@ -1154,8 +1154,7 @@ TEST(FiberManager, remoteHasReadyTasks) { template void testFiberLocal() { - FiberManager fm( - LocalType(), folly::make_unique()); + FiberManager fm(LocalType(), std::make_unique()); fm.addTask([]() { EXPECT_EQ(42, local().value); @@ -1230,7 +1229,7 @@ TEST(FiberManager, fiberLocalDestructor) { }; FiberManager fm( - LocalType(), folly::make_unique()); + LocalType(), std::make_unique()); fm.addTask([]() { local().data = 41; }); @@ -1239,7 +1238,7 @@ TEST(FiberManager, fiberLocalDestructor) { } TEST(FiberManager, yieldTest) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); auto& loopController = dynamic_cast(manager.loopController()); @@ -1260,7 +1259,7 @@ TEST(FiberManager, yieldTest) { } TEST(FiberManager, RequestContext) { - FiberManager fm(folly::make_unique()); + FiberManager fm(std::make_unique()); bool checkRun1 = false; bool checkRun2 = false; @@ -1358,7 +1357,7 @@ TEST(FiberManager, resizePeriodically) { opts.fibersPoolResizePeriodMs = 300; opts.maxFibersPoolSize = 5; - FiberManager manager(folly::make_unique(), opts); + FiberManager manager(std::make_unique(), opts); folly::EventBase evb; dynamic_cast(manager.loopController()) @@ -1416,7 +1415,7 @@ TEST(FiberManager, resizePeriodically) { } TEST(FiberManager, batonWaitTimeoutHandler) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); folly::EventBase evb; dynamic_cast(manager.loopController()) @@ -1448,7 +1447,7 @@ TEST(FiberManager, batonWaitTimeoutHandler) { } TEST(FiberManager, batonWaitTimeoutMany) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); folly::EventBase evb; dynamic_cast(manager.loopController()) @@ -1478,7 +1477,7 @@ TEST(FiberManager, batonWaitTimeoutMany) { } TEST(FiberManager, remoteFutureTest) { - FiberManager fiberManager(folly::make_unique()); + FiberManager fiberManager(std::make_unique()); auto& loopController = dynamic_cast(fiberManager.loopController()); @@ -1496,7 +1495,7 @@ TEST(FiberManager, remoteFutureTest) { // Test that a void function produes a Future. TEST(FiberManager, remoteFutureVoidUnitTest) { - FiberManager fiberManager(folly::make_unique()); + FiberManager fiberManager(std::make_unique()); auto& loopController = dynamic_cast(fiberManager.loopController()); @@ -1556,7 +1555,7 @@ TEST(FiberManager, semaphore) { auto task = [&sem, kTasks, kIterations, kNumTokens]( int& counter, folly::fibers::Baton& baton) { - FiberManager manager(folly::make_unique()); + FiberManager manager(std::make_unique()); folly::EventBase evb; dynamic_cast(manager.loopController()) .attachEventBase(evb); @@ -2048,7 +2047,7 @@ TEST(FiberManager, VirtualEventBase) { folly::ScopedEventBaseThread thread; auto evb1 = - folly::make_unique(*thread.getEventBase()); + std::make_unique(*thread.getEventBase()); auto& evb2 = thread.getEventBase()->getVirtualEventBase(); getFiberManager(*evb1).addTaskRemote([&] { @@ -2145,7 +2144,7 @@ TEST(FiberManager, recordStack) { folly::fibers::FiberManager::Options opts; opts.recordStackEvery = 1; - FiberManager fm(folly::make_unique(), opts); + FiberManager fm(std::make_unique(), opts); auto& loopController = dynamic_cast(fm.loopController()); diff --git a/folly/fibers/test/FibersTestApp.cpp b/folly/fibers/test/FibersTestApp.cpp index f448eeee..1c4ca551 100644 --- a/folly/fibers/test/FibersTestApp.cpp +++ b/folly/fibers/test/FibersTestApp.cpp @@ -26,7 +26,7 @@ using namespace folly::fibers; struct Application { public: Application() - : fiberManager(folly::make_unique()), + : fiberManager(std::make_unique()), toSend(20), maxOutstanding(5) {} diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index b353ff81..0e6c7e31 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -1190,7 +1190,7 @@ Future whileDo(P&& predicate, F&& thunk) { template Future times(const int n, F&& thunk) { return folly::whileDo( - [ n, count = folly::make_unique>(0) ]() mutable { + [ n, count = std::make_unique>(0) ]() mutable { return count->fetch_add(1) < n; }, std::forward(thunk)); diff --git a/folly/futures/detail/Core.h b/folly/futures/detail/Core.h index 790a45cd..3124cda3 100644 --- a/folly/futures/detail/Core.h +++ b/folly/futures/detail/Core.h @@ -240,7 +240,7 @@ class Core final { interruptLock_.lock(); } if (!interrupt_ && !hasResult()) { - interrupt_ = folly::make_unique(std::move(e)); + interrupt_ = std::make_unique(std::move(e)); if (interruptHandler_) { interruptHandler_(*interrupt_); } diff --git a/folly/futures/test/FilterTest.cpp b/folly/futures/test/FilterTest.cpp index 66c3d3fa..b4139d42 100644 --- a/folly/futures/test/FilterTest.cpp +++ b/folly/futures/test/FilterTest.cpp @@ -29,8 +29,9 @@ TEST(Filter, alwaysFalse) { } TEST(Filter, moveOnlyValue) { - EXPECT_EQ(42, - *makeFuture(folly::make_unique(42)) - .filter([](std::unique_ptr const&) { return true; }) - .get()); + EXPECT_EQ( + 42, + *makeFuture(std::make_unique(42)) + .filter([](std::unique_ptr const&) { return true; }) + .get()); } diff --git a/folly/futures/test/FutureTest.cpp b/folly/futures/test/FutureTest.cpp index bad230bc..144a9249 100644 --- a/folly/futures/test/FutureTest.cpp +++ b/folly/futures/test/FutureTest.cpp @@ -722,8 +722,8 @@ TEST(Future, detachRace) { // slow test so I won't do that but if it ever fails, take it seriously, and // run the test binary with "--gtest_repeat=10000 --gtest_filter=*detachRace" // (Don't forget to enable ASAN) - auto p = folly::make_unique>(); - auto f = folly::make_unique>(p->getFuture()); + auto p = std::make_unique>(); + auto f = std::make_unique>(p->getFuture()); folly::Baton<> baton; std::thread t1([&]{ baton.post(); @@ -818,7 +818,7 @@ TEST(Future, RequestContext) { { folly::RequestContextScopeGuard rctx; RequestContext::get()->setContextData( - "key", folly::make_unique(true)); + "key", std::make_unique(true)); auto checker = [](int lineno) { return [lineno](Try&& /* t */) { auto d = static_cast( diff --git a/folly/futures/test/NonCopyableLambdaTest.cpp b/folly/futures/test/NonCopyableLambdaTest.cpp index f9e6f4be..3e36c2ce 100644 --- a/folly/futures/test/NonCopyableLambdaTest.cpp +++ b/folly/futures/test/NonCopyableLambdaTest.cpp @@ -38,7 +38,7 @@ TEST(NonCopyableLambda, basic) { TEST(NonCopyableLambda, unique_ptr) { Promise promise; - auto int_ptr = folly::make_unique(1); + auto int_ptr = std::make_unique(1); EXPECT_EQ(*int_ptr, 1); diff --git a/folly/futures/test/PromiseTest.cpp b/folly/futures/test/PromiseTest.cpp index ff9cef9c..3673dc1d 100644 --- a/folly/futures/test/PromiseTest.cpp +++ b/folly/futures/test/PromiseTest.cpp @@ -134,7 +134,7 @@ TEST(Promise, isFulfilledWithFuture) { } TEST(Promise, brokenOnDelete) { - auto p = folly::make_unique>(); + auto p = std::make_unique>(); auto f = p->getFuture(); EXPECT_FALSE(f.isReady()); @@ -149,10 +149,10 @@ TEST(Promise, brokenOnDelete) { } TEST(Promise, brokenPromiseHasTypeInfo) { - auto pInt = folly::make_unique>(); + auto pInt = std::make_unique>(); auto fInt = pInt->getFuture(); - auto pFloat = folly::make_unique>(); + auto pFloat = std::make_unique>(); auto fFloat = pFloat->getFuture(); pInt.reset(); diff --git a/folly/futures/test/ViaTest.cpp b/folly/futures/test/ViaTest.cpp index 2bdabfc0..f843a029 100644 --- a/folly/futures/test/ViaTest.cpp +++ b/folly/futures/test/ViaTest.cpp @@ -335,9 +335,8 @@ class ThreadExecutor : public Executor { TEST(Via, viaThenGetWasRacy) { ThreadExecutor x; - std::unique_ptr val = folly::via(&x) - .then([] { return folly::make_unique(42); }) - .get(); + std::unique_ptr val = + folly::via(&x).then([] { return std::make_unique(42); }).get(); ASSERT_TRUE(!!val); EXPECT_EQ(42, *val); } @@ -603,7 +602,7 @@ TEST(ViaFunc, isSticky) { TEST(ViaFunc, moveOnly) { ManualExecutor x; - auto intp = folly::make_unique(42); + auto intp = std::make_unique(42); EXPECT_EQ(42, via(&x, [intp = std::move(intp)] { return *intp; }).getVia(&x)); } diff --git a/folly/gen/test/BaseTest.cpp b/folly/gen/test/BaseTest.cpp index c61b1209..999d74b9 100644 --- a/folly/gen/test/BaseTest.cpp +++ b/folly/gen/test/BaseTest.cpp @@ -1274,14 +1274,14 @@ TEST(Gen, Unwrap) { EXPECT_EQ(4, o | unwrap); EXPECT_THROW(e | unwrap, OptionalEmptyException); - auto oup = folly::make_optional(folly::make_unique(5)); + auto oup = folly::make_optional(std::make_unique(5)); // optional has a value, and that value is non-null EXPECT_TRUE(bool(oup | unwrap)); EXPECT_EQ(5, *(oup | unwrap)); EXPECT_TRUE(oup.hasValue()); // still has a pointer (null or not) EXPECT_TRUE(bool(oup.value())); // that value isn't null - auto moved1 = std::move(oup) | unwrapOr(folly::make_unique(6)); + auto moved1 = std::move(oup) | unwrapOr(std::make_unique(6)); // oup still has a value, but now it's now nullptr since the pointer was moved // into moved1 EXPECT_TRUE(oup.hasValue()); @@ -1289,12 +1289,12 @@ TEST(Gen, Unwrap) { EXPECT_TRUE(bool(moved1)); EXPECT_EQ(5, *moved1); - auto moved2 = std::move(oup) | unwrapOr(folly::make_unique(7)); + auto moved2 = std::move(oup) | unwrapOr(std::make_unique(7)); // oup's still-valid nullptr value wins here, the pointer to 7 doesn't apply EXPECT_FALSE(moved2); oup.clear(); - auto moved3 = std::move(oup) | unwrapOr(folly::make_unique(8)); + auto moved3 = std::move(oup) | unwrapOr(std::make_unique(8)); // oup is empty now, so the unwrapOr comes into play. EXPECT_TRUE(bool(moved3)); EXPECT_EQ(8, *moved3); @@ -1332,7 +1332,7 @@ TEST(Gen, Unwrap) { { auto opt = folly::make_optional(std::make_shared(8)); - auto fallback = unwrapOr(folly::make_unique(9)); + auto fallback = unwrapOr(std::make_unique(9)); // fallback must be std::move'd to be used EXPECT_EQ(8, *(opt | std::move(fallback))); EXPECT_TRUE(bool(opt.value())); // shared_ptr copied out, not moved diff --git a/folly/io/async/AsyncSSLSocket.cpp b/folly/io/async/AsyncSSLSocket.cpp index c7c1c357..3791db7d 100644 --- a/folly/io/async/AsyncSSLSocket.cpp +++ b/folly/io/async/AsyncSSLSocket.cpp @@ -1338,7 +1338,7 @@ AsyncSSLSocket::performRead(void** buf, size_t* buflen, size_t* offset) { << "): client intitiated SSL renegotiation not permitted"; return ReadResult( READ_ERROR, - folly::make_unique(SSLError::CLIENT_RENEGOTIATION)); + std::make_unique(SSLError::CLIENT_RENEGOTIATION)); } if (bytes <= 0) { int error = SSL_get_error(ssl_, bytes); @@ -1358,7 +1358,7 @@ AsyncSSLSocket::performRead(void** buf, size_t* buflen, size_t* offset) { << "): unsupported SSL renegotiation during read"; return ReadResult( READ_ERROR, - folly::make_unique(SSLError::INVALID_RENEGOTIATION)); + std::make_unique(SSLError::INVALID_RENEGOTIATION)); } else { if (zero_return(error, bytes)) { return ReadResult(bytes); @@ -1375,7 +1375,7 @@ AsyncSSLSocket::performRead(void** buf, size_t* buflen, size_t* offset) { << "reason: " << ERR_reason_error_string(errError); return ReadResult( READ_ERROR, - folly::make_unique(error, errError, bytes, errno)); + std::make_unique(error, errError, bytes, errno)); } } else { appBytesReceived_ += bytes; @@ -1418,7 +1418,7 @@ AsyncSocket::WriteResult AsyncSSLSocket::interpretSSLError(int rc, int error) { << "unsupported SSL renegotiation during write"; return WriteResult( WRITE_ERROR, - folly::make_unique(SSLError::INVALID_RENEGOTIATION)); + std::make_unique(SSLError::INVALID_RENEGOTIATION)); } else { if (zero_return(error, rc)) { return WriteResult(0); @@ -1431,7 +1431,7 @@ AsyncSocket::WriteResult AsyncSSLSocket::interpretSSLError(int rc, int error) { << ", reason: " << ERR_reason_error_string(errError); return WriteResult( WRITE_ERROR, - folly::make_unique(error, errError, rc, errno)); + std::make_unique(error, errError, rc, errno)); } } @@ -1452,7 +1452,7 @@ AsyncSocket::WriteResult AsyncSSLSocket::performWrite( << "TODO: AsyncSSLSocket currently does not support calling " << "write() before the handshake has fully completed"; return WriteResult( - WRITE_ERROR, folly::make_unique(SSLError::EARLY_WRITE)); + WRITE_ERROR, std::make_unique(SSLError::EARLY_WRITE)); } // Declare a buffer used to hold small write requests. It could point to a diff --git a/folly/io/async/AsyncSocket.cpp b/folly/io/async/AsyncSocket.cpp index 17040bf9..dc550a31 100644 --- a/folly/io/async/AsyncSocket.cpp +++ b/folly/io/async/AsyncSocket.cpp @@ -2011,7 +2011,7 @@ AsyncSocket::sendSocketMessage(int fd, struct msghdr* msg, int msg_flags) { registerForConnectEvents(); } catch (const AsyncSocketException& ex) { return WriteResult( - WRITE_ERROR, folly::make_unique(ex)); + WRITE_ERROR, std::make_unique(ex)); } // Let's fake it that no bytes were written and return an errno. errno = EAGAIN; @@ -2034,7 +2034,7 @@ AsyncSocket::sendSocketMessage(int fd, struct msghdr* msg, int msg_flags) { totalWritten = -1; } catch (const AsyncSocketException& ex) { return WriteResult( - WRITE_ERROR, folly::make_unique(ex)); + WRITE_ERROR, std::make_unique(ex)); } } else if (errno == EAGAIN) { // Normally sendmsg would indicate that the write would block. @@ -2043,7 +2043,7 @@ AsyncSocket::sendSocketMessage(int fd, struct msghdr* msg, int msg_flags) { // instead, and is an error condition indicating no fds available. return WriteResult( WRITE_ERROR, - folly::make_unique( + std::make_unique( AsyncSocketException::UNKNOWN, "No more free local ports")); } } else { diff --git a/folly/io/async/EventBase.cpp b/folly/io/async/EventBase.cpp index d0d58def..a485d332 100644 --- a/folly/io/async/EventBase.cpp +++ b/folly/io/async/EventBase.cpp @@ -740,7 +740,7 @@ const char* EventBase::getLibeventMethod() { return event_get_method(); } VirtualEventBase& EventBase::getVirtualEventBase() { folly::call_once(virtualEventBaseInitFlag_, [&] { - virtualEventBase_ = folly::make_unique(*this); + virtualEventBase_ = std::make_unique(*this); }); return *virtualEventBase_; diff --git a/folly/io/async/HHWheelTimer.cpp b/folly/io/async/HHWheelTimer.cpp index c464c3fb..0fa49cbd 100644 --- a/folly/io/async/HHWheelTimer.cpp +++ b/folly/io/async/HHWheelTimer.cpp @@ -251,7 +251,7 @@ size_t HHWheelTimer::cancelAll() { if (count_ != 0) { const uint64_t numElements = WHEEL_BUCKETS * WHEEL_SIZE; auto maxBuckets = std::min(numElements, count_); - auto buckets = folly::make_unique(maxBuckets); + auto buckets = std::make_unique(maxBuckets); size_t countBuckets = 0; for (auto& tick : buckets_) { for (auto& bucket : tick) { diff --git a/folly/io/async/TimeoutManager.cpp b/folly/io/async/TimeoutManager.cpp index 363db6a2..e1c1dfac 100644 --- a/folly/io/async/TimeoutManager.cpp +++ b/folly/io/async/TimeoutManager.cpp @@ -72,7 +72,7 @@ struct TimeoutManager::CobTimeouts { }; TimeoutManager::TimeoutManager() - : cobTimeouts_(folly::make_unique()) {} + : cobTimeouts_(std::make_unique()) {} void TimeoutManager::runAfterDelay( Func cob, @@ -92,8 +92,8 @@ bool TimeoutManager::tryRunAfterDelay( return false; } - auto timeout = folly::make_unique( - this, std::move(cob), internal); + auto timeout = + std::make_unique(this, std::move(cob), internal); if (!timeout->scheduleTimeout(milliseconds)) { return false; } diff --git a/folly/io/async/test/AsyncSSLSocketTest.cpp b/folly/io/async/test/AsyncSSLSocketTest.cpp index bc42103d..3874f578 100644 --- a/folly/io/async/test/AsyncSSLSocketTest.cpp +++ b/folly/io/async/test/AsyncSSLSocketTest.cpp @@ -181,7 +181,7 @@ TEST(AsyncSSLSocketTest, ReadAfterClose) { ReadEOFCallback readCallback(&writeCallback); HandshakeCallback handshakeCallback(&readCallback); SSLServerAcceptCallback acceptCallback(&handshakeCallback); - auto server = folly::make_unique(&acceptCallback); + auto server = std::make_unique(&acceptCallback); // Set up SSL context. auto sslContext = std::make_shared(); @@ -402,8 +402,8 @@ class NextProtocolTest : public testing::TestWithParam { new AsyncSSLSocket(clientCtx, &eventBase, fds[0], false)); AsyncSSLSocket::UniquePtr serverSock( new AsyncSSLSocket(serverCtx, &eventBase, fds[1], true)); - client = folly::make_unique(std::move(clientSock)); - server = folly::make_unique(std::move(serverSock)); + client = std::make_unique(std::move(clientSock)); + server = std::make_unique(std::move(serverSock)); eventBase.loop(); } diff --git a/folly/io/async/test/AsyncSocketTest2.cpp b/folly/io/async/test/AsyncSocketTest2.cpp index e90bca5c..fb68b2a6 100644 --- a/folly/io/async/test/AsyncSocketTest2.cpp +++ b/folly/io/async/test/AsyncSocketTest2.cpp @@ -2806,7 +2806,7 @@ class MockEvbChangeCallback : public AsyncSocket::EvbChangeCallback { }; TEST(AsyncSocketTest, EvbCallbacks) { - auto cb = folly::make_unique(); + auto cb = std::make_unique(); EventBase evb; std::shared_ptr socket = AsyncSocket::newSocket(&evb); diff --git a/folly/io/async/test/AsyncUDPSocketTest.cpp b/folly/io/async/test/AsyncUDPSocketTest.cpp index 73b68c84..ee420257 100644 --- a/folly/io/async/test/AsyncUDPSocketTest.cpp +++ b/folly/io/async/test/AsyncUDPSocketTest.cpp @@ -85,9 +85,7 @@ class UDPServer { void start() { CHECK(evb_->isInEventBaseThread()); - socket_ = folly::make_unique( - evb_, - 1500); + socket_ = std::make_unique(evb_, 1500); try { socket_->bind(addr_); @@ -159,7 +157,7 @@ class UDPClient CHECK(evb_->isInEventBaseThread()); server_ = server; - socket_ = folly::make_unique(evb_); + socket_ = std::make_unique(evb_); try { socket_->bind(folly::SocketAddress("127.0.0.1", 0)); diff --git a/folly/io/async/test/EventBaseTest.cpp b/folly/io/async/test/EventBaseTest.cpp index ae455c7e..ce1c6c77 100644 --- a/folly/io/async/test/EventBaseTest.cpp +++ b/folly/io/async/test/EventBaseTest.cpp @@ -1789,7 +1789,7 @@ TEST(EventBaseTest, LoopKeepAliveInLoop) { } TEST(EventBaseTest, LoopKeepAliveWithLoopForever) { - std::unique_ptr evb = folly::make_unique(); + std::unique_ptr evb = std::make_unique(); bool done = false; @@ -1817,7 +1817,7 @@ TEST(EventBaseTest, LoopKeepAliveWithLoopForever) { } TEST(EventBaseTest, LoopKeepAliveShutdown) { - auto evb = folly::make_unique(); + auto evb = std::make_unique(); bool done = false; @@ -1840,7 +1840,7 @@ TEST(EventBaseTest, LoopKeepAliveShutdown) { } TEST(EventBaseTest, LoopKeepAliveAtomic) { - auto evb = folly::make_unique(); + auto evb = std::make_unique(); static constexpr size_t kNumThreads = 100; static constexpr size_t kNumTasks = 100; @@ -1850,7 +1850,7 @@ TEST(EventBaseTest, LoopKeepAliveAtomic) { size_t done{0}; for (size_t i = 0; i < kNumThreads; ++i) { - batons.emplace_back(folly::make_unique>()); + batons.emplace_back(std::make_unique>()); } for (size_t i = 0; i < kNumThreads; ++i) { diff --git a/folly/io/async/test/RequestContextTest.cpp b/folly/io/async/test/RequestContextTest.cpp index ac24c5b5..4b73d2c2 100644 --- a/folly/io/async/test/RequestContextTest.cpp +++ b/folly/io/async/test/RequestContextTest.cpp @@ -56,8 +56,7 @@ TEST(RequestContext, SimpleTest) { EXPECT_EQ(nullptr, RequestContext::get()->getContextData("test")); - RequestContext::get()->setContextData( - "test", folly::make_unique(10)); + RequestContext::get()->setContextData("test", std::make_unique(10)); base.runInEventBaseThread([&](){ EXPECT_TRUE(RequestContext::get() != nullptr); auto data = dynamic_cast( @@ -83,16 +82,15 @@ TEST(RequestContext, SimpleTest) { TEST(RequestContext, setIfAbsentTest) { EXPECT_TRUE(RequestContext::get() != nullptr); - RequestContext::get()->setContextData( - "test", folly::make_unique(10)); + RequestContext::get()->setContextData("test", std::make_unique(10)); EXPECT_FALSE(RequestContext::get()->setContextDataIfAbsent( - "test", folly::make_unique(20))); + "test", std::make_unique(20))); EXPECT_EQ(10, dynamic_cast( RequestContext::get()->getContextData("test"))->data_); EXPECT_TRUE(RequestContext::get()->setContextDataIfAbsent( - "test2", folly::make_unique(20))); + "test2", std::make_unique(20))); EXPECT_EQ(20, dynamic_cast( RequestContext::get()->getContextData("test2"))->data_); @@ -104,13 +102,13 @@ TEST(RequestContext, setIfAbsentTest) { TEST(RequestContext, testSetUnset) { RequestContext::create(); auto ctx1 = RequestContext::saveContext(); - ctx1->setContextData("test", folly::make_unique(10)); + ctx1->setContextData("test", std::make_unique(10)); auto testData1 = dynamic_cast(ctx1->getContextData("test")); // Override RequestContext RequestContext::create(); auto ctx2 = RequestContext::saveContext(); - ctx2->setContextData("test", folly::make_unique(20)); + ctx2->setContextData("test", std::make_unique(20)); auto testData2 = dynamic_cast(ctx2->getContextData("test")); // Check ctx1->onUnset was called @@ -137,7 +135,7 @@ TEST(RequestContext, deadlockTest) { virtual ~DeadlockTestData() { RequestContext::get()->setContextData( - val_, folly::make_unique(1)); + val_, std::make_unique(1)); } void onSet() override {} @@ -148,6 +146,6 @@ TEST(RequestContext, deadlockTest) { }; RequestContext::get()->setContextData( - "test", folly::make_unique("test2")); + "test", std::make_unique("test2")); RequestContext::get()->clearContextData("test"); } diff --git a/folly/io/async/test/SSLSessionTest.cpp b/folly/io/async/test/SSLSessionTest.cpp index 77ab567f..a85f7937 100644 --- a/folly/io/async/test/SSLSessionTest.cpp +++ b/folly/io/async/test/SSLSessionTest.cpp @@ -138,7 +138,7 @@ TEST_F(SSLSessionTest, SerializeDeserializeTest) { ASSERT_TRUE(client.handshakeSuccess_); std::unique_ptr sess = - folly::make_unique(clientPtr->getSSLSession()); + std::make_unique(clientPtr->getSSLSession()); sessiondata = sess->serialize(); ASSERT_TRUE(!sessiondata.empty()); } @@ -150,7 +150,7 @@ TEST_F(SSLSessionTest, SerializeDeserializeTest) { new AsyncSSLSocket(clientCtx, &eventBase, fds[0], serverName)); auto clientPtr = clientSock.get(); std::unique_ptr sess = - folly::make_unique(sessiondata); + std::make_unique(sessiondata); ASSERT_NE(sess.get(), nullptr); clientSock->setSSLSession(sess->getRawSSLSessionDangerous(), true); AsyncSSLSocket::UniquePtr serverSock( @@ -181,7 +181,7 @@ TEST_F(SSLSessionTest, GetSessionID) { ASSERT_TRUE(client.handshakeSuccess_); std::unique_ptr sess = - folly::make_unique(clientPtr->getSSLSession()); + std::make_unique(clientPtr->getSSLSession()); ASSERT_NE(sess, nullptr); auto sessID = sess->getSessionID(); ASSERT_GE(sessID.length(), 0); diff --git a/folly/io/async/test/ScopedBoundPort.cpp b/folly/io/async/test/ScopedBoundPort.cpp index 9db7e54e..e7aefb48 100644 --- a/folly/io/async/test/ScopedBoundPort.cpp +++ b/folly/io/async/test/ScopedBoundPort.cpp @@ -23,7 +23,7 @@ namespace folly { ScopedBoundPort::ScopedBoundPort(IPAddress host) { - ebth_ = folly::make_unique(); + ebth_ = std::make_unique(); ebth_->getEventBase()->runInEventBaseThreadAndWait([&] { sock_ = AsyncServerSocket::newSocket(ebth_->getEventBase()); sock_->bind(SocketAddress(host, 0)); diff --git a/folly/ssl/SSLSession.h b/folly/ssl/SSLSession.h index 8e7a7d35..c08b8fb9 100644 --- a/folly/ssl/SSLSession.h +++ b/folly/ssl/SSLSession.h @@ -27,13 +27,12 @@ class SSLSession { public: // Holds and takes ownership of an SSL_SESSION object by incrementing refcount explicit SSLSession(SSL_SESSION* session, bool takeOwnership = true) - : impl_(folly::make_unique( - session, - takeOwnership)) {} + : impl_( + std::make_unique(session, takeOwnership)) {} // Deserialize from a string explicit SSLSession(const std::string& serializedSession) - : impl_(folly::make_unique(serializedSession)) {} + : impl_(std::make_unique(serializedSession)) {} // Serialize to a string that is suitable to store in a persistent cache std::string serialize() const { diff --git a/folly/test/AHMIntStressTest.cpp b/folly/test/AHMIntStressTest.cpp index 6290eab7..f580a67f 100644 --- a/folly/test/AHMIntStressTest.cpp +++ b/folly/test/AHMIntStressTest.cpp @@ -33,7 +33,7 @@ struct MyObject { typedef folly::AtomicHashMap> MyMap; typedef std::lock_guard Guard; -std::unique_ptr newMap() { return folly::make_unique(100); } +std::unique_ptr newMap() { return std::make_unique(100); } struct MyObjectDirectory { MyObjectDirectory() diff --git a/folly/test/FunctionTest.cpp b/folly/test/FunctionTest.cpp index 546fb6f4..042b3668 100644 --- a/folly/test/FunctionTest.cpp +++ b/folly/test/FunctionTest.cpp @@ -313,7 +313,7 @@ TEST(Function, Bind) { // NonCopyableLambda TEST(Function, NonCopyableLambda) { - auto unique_ptr_int = folly::make_unique(900); + auto unique_ptr_int = std::make_unique(900); EXPECT_EQ(900, *unique_ptr_int); struct { diff --git a/folly/test/MPMCQueueTest.cpp b/folly/test/MPMCQueueTest.cpp index 9269b890..f556ebbf 100644 --- a/folly/test/MPMCQueueTest.cpp +++ b/folly/test/MPMCQueueTest.cpp @@ -149,7 +149,7 @@ TEST(MPMCQueue, lots_of_element_types) { runElementTypeTest(std::make_pair(10, string("def"))); runElementTypeTest(vector{{"abc"}}); runElementTypeTest(std::make_shared('a')); - runElementTypeTest(folly::make_unique('a')); + runElementTypeTest(std::make_unique('a')); runElementTypeTest(boost::intrusive_ptr(new RefCounted)); EXPECT_EQ(RefCounted::active_instances, 0); } @@ -160,7 +160,7 @@ TEST(MPMCQueue, lots_of_element_types_dynamic) { runElementTypeTest(std::make_pair(10, string("def"))); runElementTypeTest(vector{{"abc"}}); runElementTypeTest(std::make_shared('a')); - runElementTypeTest(folly::make_unique('a')); + runElementTypeTest(std::make_unique('a')); runElementTypeTest(boost::intrusive_ptr(new RefCounted)); EXPECT_EQ(RefCounted::active_instances, 0); } diff --git a/folly/test/ThreadLocalTest.cpp b/folly/test/ThreadLocalTest.cpp index c33549d0..392a52fc 100644 --- a/folly/test/ThreadLocalTest.cpp +++ b/folly/test/ThreadLocalTest.cpp @@ -103,7 +103,7 @@ TEST(ThreadLocalPtr, DefaultDeleterOwnershipTransfer) { Widget::totalVal_ = 0; { ThreadLocalPtr w; - auto source = folly::make_unique(); + auto source = std::make_unique(); std::thread([&w, &source]() { w.reset(std::move(source)); w.get()->val_ += 10; diff --git a/folly/test/TryTest.cpp b/folly/test/TryTest.cpp index 932b7e96..c986f40d 100644 --- a/folly/test/TryTest.cpp +++ b/folly/test/TryTest.cpp @@ -55,7 +55,7 @@ TEST(Try, moveOnly) { TEST(Try, makeTryWith) { auto func = []() { - return folly::make_unique(1); + return std::make_unique(1); }; auto result = makeTryWith(func);