Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __memory / allocator_destructor.h
blob623ad8ad800a18d541c262d72ed20130eb111f7f
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___MEMORY_ALLOCATOR_DESTRUCTOR_H
10 #define _LIBCPP___MEMORY_ALLOCATOR_DESTRUCTOR_H
12 #include <__config>
13 #include <__memory/allocator_traits.h>
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 # pragma GCC system_header
17 #endif
19 _LIBCPP_BEGIN_NAMESPACE_STD
21 template <class _Alloc>
22 class __allocator_destructor
24 typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits;
25 public:
26 typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer;
27 typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type;
28 private:
29 _Alloc& __alloc_;
30 size_type __s_;
31 public:
32 _LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s)
33 _NOEXCEPT
34 : __alloc_(__a), __s_(__s) {}
35 _LIBCPP_INLINE_VISIBILITY
36 void operator()(pointer __p) _NOEXCEPT
37 {__alloc_traits::deallocate(__alloc_, __p, __s_);}
40 _LIBCPP_END_NAMESPACE_STD
42 #endif // _LIBCPP___MEMORY_ALLOCATOR_DESTRUCTOR_H