summaryrefslogtreecommitdiffstats
path: root/libcxx/include/memory
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-08-15 17:49:30 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-08-15 17:49:30 +0000
commitf11c00d782f1f4a60593d0b4c5a428c2e581c24b (patch)
treea14b96560fd85fb3e2e52302aee0ade4fbfed672 /libcxx/include/memory
parent070ac768ff4ddeb372ec5d91d570ddc545fceede (diff)
downloadbcm5719-llvm-f11c00d782f1f4a60593d0b4c5a428c2e581c24b.tar.gz
bcm5719-llvm-f11c00d782f1f4a60593d0b4c5a428c2e581c24b.zip
libcxx: Mark __temp_value::__temp_value as _LIBCPP_NO_CFI.
This constructor needs to cast a pointer to uninitialized memory to a pointer to object type in order to call allocator_traits::construct(). This cast is not allowed when CFI cast checks are enabled. I did this instead of marking __addr() as _LIBCPP_NO_CFI so that we don't lose CFI checks on get() or the dtor. Differential Revision: https://reviews.llvm.org/D50743 llvm-svn: 339797
Diffstat (limited to 'libcxx/include/memory')
-rw-r--r--libcxx/include/memory7
1 files changed, 5 insertions, 2 deletions
diff --git a/libcxx/include/memory b/libcxx/include/memory
index a4bf89b495a..4b7a26c5e76 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -5631,8 +5631,11 @@ struct __temp_value {
_Tp & get() { return *__addr(); }
template<class... _Args>
- __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc)
- { _Traits::construct(__a, __addr(), _VSTD::forward<_Args>(__args)...); }
+ _LIBCPP_NO_CFI
+ __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) {
+ _Traits::construct(__a, reinterpret_cast<_Tp*>(addressof(__v)),
+ _VSTD::forward<_Args>(__args)...);
+ }
~__temp_value() { _Traits::destroy(__a, __addr()); }
};
OpenPOWER on IntegriCloud