[libcxx-commits] [PATCH] D75243: [libc++] Build the dylib with C++17 to allow aligned new/delete
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 24 15:07:02 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ac403bd145d: [libc++] Build the dylib with C++17 to allow aligned new/delete (authored by ldionne).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75243/new/
https://reviews.llvm.org/D75243
Files:
libcxx/CMakeLists.txt
libcxx/src/barrier.cpp
Index: libcxx/src/barrier.cpp
===================================================================
--- libcxx/src/barrier.cpp
+++ libcxx/src/barrier.cpp
@@ -26,21 +26,15 @@
} __tickets[64];
};
- ptrdiff_t& __expected;
- unique_ptr<char[]> __state_allocation;
- __state_t* __state;
+ ptrdiff_t& __expected;
+ unique_ptr<__state_t[]> __state;
_LIBCPP_HIDDEN
__barrier_algorithm_base(ptrdiff_t& __expected)
: __expected(__expected)
{
size_t const __count = (__expected + 1) >> 1;
- size_t const __size = sizeof(__state_t) * __count;
- size_t __allocation_size = __size + alignof(__state_t);
- __state_allocation = unique_ptr<char[]>(new char[__allocation_size]);
- void* __allocation = __state_allocation.get();
- void* const __state_ = align(alignof(__state_t), __size, __allocation, __allocation_size);
- __state = new (__state_) __barrier_algorithm_base::__state_t[__count];
+ __state = unique_ptr<__state_t[]>(new __state_t[__count]);
}
_LIBCPP_HIDDEN
bool __arrive(__barrier_phase_t __old_phase)
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -519,10 +519,10 @@
# Required flags ==============================================================
function(cxx_add_basic_build_flags target)
- # Require C++14 for all targets. C++14 is needed to ensure constant
- # initialization for certain globals (ex global memory resources).
+ # Require C++17 for all targets. C++17 is needed to use aligned allocation
+ # in the dylib.
set_target_properties(${target} PROPERTIES
- CXX_STANDARD 14
+ CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75243.252438.patch
Type: text/x-patch
Size: 1837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200324/603f72da/attachment.bin>
More information about the libcxx-commits
mailing list