From: Jonas Devlieghere Date: Fri, 16 Aug 2019 17:19:57 +0000 (+0000) Subject: [ADT] Remove llvm::make_unique utility. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc1406d2325692c337daba05629419be4b879259;p=llvm [ADT] Remove llvm::make_unique utility. All uses of llvm::make_unique should have been replaced with std::make_unique. This patch represents the last part of the migration and removes the utility from LLVM. Differential revision: https://reviews.llvm.org/D66259 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369130 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index 0e3911424a6..af037098226 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -1376,41 +1376,6 @@ void replace(Container &Cont, typename Container::iterator ContIt, // Extra additions to //===----------------------------------------------------------------------===// -// Implement make_unique according to N3656. - -/// Constructs a `new T()` with the given args and returns a -/// `unique_ptr` which owns the object. -/// -/// Example: -/// -/// auto p = make_unique(); -/// auto p = make_unique>(0, 1); -template -typename std::enable_if::value, std::unique_ptr>::type -make_unique(Args &&... args) { - return std::unique_ptr(new T(std::forward(args)...)); -} - -/// Constructs a `new T[n]` with the given args and returns a -/// `unique_ptr` which owns the object. -/// -/// \param n size of the new array. -/// -/// Example: -/// -/// auto p = make_unique(2); // value-initializes the array with 0's. -template -typename std::enable_if::value && std::extent::value == 0, - std::unique_ptr>::type -make_unique(size_t n) { - return std::unique_ptr(new typename std::remove_extent::type[n]()); -} - -/// This function isn't used and is only here to provide better compile errors. -template -typename std::enable_if::value != 0>::type -make_unique(Args &&...) = delete; - struct FreeDeleter { void operator()(void* v) { ::free(v); diff --git a/unittests/ADT/IteratorTest.cpp b/unittests/ADT/IteratorTest.cpp index 2f5abb64e7d..73fd15e90e9 100644 --- a/unittests/ADT/IteratorTest.cpp +++ b/unittests/ADT/IteratorTest.cpp @@ -209,7 +209,7 @@ TEST(FilterIteratorTest, FunctionPointer) { TEST(FilterIteratorTest, Composition) { auto IsOdd = [](int N) { return N % 2 == 1; }; - std::unique_ptr A[] = {make_unique(0), std::make_unique(1), + std::unique_ptr A[] = {std::make_unique(0), std::make_unique(1), std::make_unique(2), std::make_unique(3), std::make_unique(4), std::make_unique(5), std::make_unique(6)};