[llvm] r369130 - [ADT] Remove llvm::make_unique utility.

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 10:19:57 PDT 2019


Author: jdevlieghere
Date: Fri Aug 16 10:19:57 2019
New Revision: 369130

URL: http://llvm.org/viewvc/llvm-project?rev=369130&view=rev
Log:
[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

Modified:
    llvm/trunk/include/llvm/ADT/STLExtras.h
    llvm/trunk/unittests/ADT/IteratorTest.cpp

Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=369130&r1=369129&r2=369130&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Fri Aug 16 10:19:57 2019
@@ -1376,41 +1376,6 @@ void replace(Container &Cont, typename C
 //     Extra additions to <memory>
 //===----------------------------------------------------------------------===//
 
-// Implement make_unique according to N3656.
-
-/// Constructs a `new T()` with the given args and returns a
-///        `unique_ptr<T>` which owns the object.
-///
-/// Example:
-///
-///     auto p = make_unique<int>();
-///     auto p = make_unique<std::tuple<int, int>>(0, 1);
-template <class T, class... Args>
-typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
-make_unique(Args &&... args) {
-  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-/// Constructs a `new T[n]` with the given args and returns a
-///        `unique_ptr<T[]>` which owns the object.
-///
-/// \param n size of the new array.
-///
-/// Example:
-///
-///     auto p = make_unique<int[]>(2); // value-initializes the array with 0's.
-template <class T>
-typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0,
-                        std::unique_ptr<T>>::type
-make_unique(size_t n) {
-  return std::unique_ptr<T>(new typename std::remove_extent<T>::type[n]());
-}
-
-/// This function isn't used and is only here to provide better compile errors.
-template <class T, class... Args>
-typename std::enable_if<std::extent<T>::value != 0>::type
-make_unique(Args &&...) = delete;
-
 struct FreeDeleter {
   void operator()(void* v) {
     ::free(v);

Modified: llvm/trunk/unittests/ADT/IteratorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/IteratorTest.cpp?rev=369130&r1=369129&r2=369130&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/IteratorTest.cpp (original)
+++ llvm/trunk/unittests/ADT/IteratorTest.cpp Fri Aug 16 10:19:57 2019
@@ -209,7 +209,7 @@ TEST(FilterIteratorTest, FunctionPointer
 
 TEST(FilterIteratorTest, Composition) {
   auto IsOdd = [](int N) { return N % 2 == 1; };
-  std::unique_ptr<int> A[] = {make_unique<int>(0), std::make_unique<int>(1),
+  std::unique_ptr<int> A[] = {std::make_unique<int>(0), std::make_unique<int>(1),
                               std::make_unique<int>(2), std::make_unique<int>(3),
                               std::make_unique<int>(4), std::make_unique<int>(5),
                               std::make_unique<int>(6)};




More information about the llvm-commits mailing list