summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2018-03-22 04:42:56 +0000
committerEric Fiselier <eric@efcs.ca>2018-03-22 04:42:56 +0000
commitf2918d1c24c9e69f1c63a4ca864bbd68ef5a51cc (patch)
treea3e112d71ad60d20340cfbf634b0da3a882d6ff7 /libcxx/src
parentfc179c6dd59b0da8068ecb800095e79d2ec41bc6 (diff)
downloadbcm5719-llvm-f2918d1c24c9e69f1c63a4ca864bbd68ef5a51cc.tar.gz
bcm5719-llvm-f2918d1c24c9e69f1c63a4ca864bbd68ef5a51cc.zip
Fix PR22634 - std::allocator doesn't respect over-aligned types.
This patch fixes std::allocator, and more specifically, all users of __libcpp_allocate and __libcpp_deallocate, to support over-aligned types. __libcpp_allocate/deallocate now take an alignment parameter, and when the specified alignment is greater than that supported by malloc/new, the aligned version of operator new is called (assuming it's available). When aligned new isn't available, the old behavior has been kept, and the alignment parameter is ignored. This patch depends on recent changes to __builtin_operator_new/delete which allow them to be used to call any regular new/delete operator. By using __builtin_operator_new/delete when possible, the new/delete erasure optimization is maintained. llvm-svn: 328180
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/experimental/memory_resource.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libcxx/src/experimental/memory_resource.cpp b/libcxx/src/experimental/memory_resource.cpp
index c4dc1ca894a..a6eca3743ea 100644
--- a/libcxx/src/experimental/memory_resource.cpp
+++ b/libcxx/src/experimental/memory_resource.cpp
@@ -31,10 +31,10 @@ public:
protected:
virtual void* do_allocate(size_t __size, size_t __align)
- { return __allocate(__size); }
+ { return _VSTD::__libcpp_allocate(__size, __align); /* FIXME */}
- virtual void do_deallocate(void * __p, size_t, size_t)
- { _VSTD::__libcpp_deallocate(__p); }
+ virtual void do_deallocate(void * __p, size_t, size_t __align)
+ { _VSTD::__libcpp_deallocate(__p, __align); /* FIXME */ }
virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT
{ return &__other == this; }
OpenPOWER on IntegriCloud