Remove use of _[A-Z] identifiers and poison them to detect usage

llvm-svn: 228353
This commit is contained in:
Eric Fiselier 2015-02-05 23:01:40 +00:00
parent f038a52542
commit 6fe361c1ef
4 changed files with 54 additions and 21 deletions

View File

@ -783,10 +783,10 @@ __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
{ {
if (this->__state_ & base::__constructed) if (this->__state_ & base::__constructed)
reinterpret_cast<_Rp*>(_VSTD::addressof(this->__value_))->~_Rp(); reinterpret_cast<_Rp*>(_VSTD::addressof(this->__value_))->~_Rp();
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A; typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
typedef allocator_traits<_A> _ATraits; typedef allocator_traits<_Al> _ATraits;
typedef pointer_traits<typename _ATraits::pointer> _PTraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits;
_A __a(__alloc_); _Al __a(__alloc_);
this->~__assoc_state_alloc(); this->~__assoc_state_alloc();
__a.deallocate(_PTraits::pointer_to(*this), 1); __a.deallocate(_PTraits::pointer_to(*this), 1);
} }
@ -809,10 +809,10 @@ template <class _Rp, class _Alloc>
void void
__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
{ {
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A; typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
typedef allocator_traits<_A> _ATraits; typedef allocator_traits<_Al> _ATraits;
typedef pointer_traits<typename _ATraits::pointer> _PTraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits;
_A __a(__alloc_); _Al __a(__alloc_);
this->~__assoc_state_alloc(); this->~__assoc_state_alloc();
__a.deallocate(_PTraits::pointer_to(*this), 1); __a.deallocate(_PTraits::pointer_to(*this), 1);
} }
@ -835,10 +835,10 @@ template <class _Alloc>
void void
__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
{ {
typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _A; typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al;
typedef allocator_traits<_A> _ATraits; typedef allocator_traits<_Al> _ATraits;
typedef pointer_traits<typename _ATraits::pointer> _PTraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits;
_A __a(__alloc_); _Al __a(__alloc_);
this->~__assoc_sub_state_alloc(); this->~__assoc_sub_state_alloc();
__a.deallocate(_PTraits::pointer_to(*this), 1); __a.deallocate(_PTraits::pointer_to(*this), 1);
} }

View File

@ -2890,8 +2890,8 @@ operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
{ {
typedef typename unique_ptr<_T1, _D1>::pointer _P1; typedef typename unique_ptr<_T1, _D1>::pointer _P1;
typedef typename unique_ptr<_T2, _D2>::pointer _P2; typedef typename unique_ptr<_T2, _D2>::pointer _P2;
typedef typename common_type<_P1, _P2>::type _V; typedef typename common_type<_P1, _P2>::type _Vp;
return less<_V>()(__x.get(), __y.get()); return less<_Vp>()(__x.get(), __y.get());
} }
template <class _T1, class _D1, class _T2, class _D2> template <class _T1, class _D1, class _T2, class _D2>
@ -3677,11 +3677,11 @@ template <class _Tp, class _Dp, class _Alloc>
void void
__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
{ {
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _A; typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
typedef allocator_traits<_A> _ATraits; typedef allocator_traits<_Al> _ATraits;
typedef pointer_traits<typename _ATraits::pointer> _PTraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits;
_A __a(__data_.second()); _Al __a(__data_.second());
__data_.second().~_Alloc(); __data_.second().~_Alloc();
__a.deallocate(_PTraits::pointer_to(*this), 1); __a.deallocate(_PTraits::pointer_to(*this), 1);
} }
@ -3746,10 +3746,10 @@ template <class _Tp, class _Alloc>
void void
__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
{ {
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _A; typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _Al;
typedef allocator_traits<_A> _ATraits; typedef allocator_traits<_Al> _ATraits;
typedef pointer_traits<typename _ATraits::pointer> _PTraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits;
_A __a(__data_.first()); _Al __a(__data_.first());
__data_.first().~_Alloc(); __data_.first().~_Alloc();
__a.deallocate(_PTraits::pointer_to(*this), 1); __a.deallocate(_PTraits::pointer_to(*this), 1);
} }
@ -4745,8 +4745,8 @@ inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
{ {
typedef typename common_type<_Tp*, _Up*>::type _V; typedef typename common_type<_Tp*, _Up*>::type _Vp;
return less<_V>()(__x.get(), __y.get()); return less<_Vp>()(__x.get(), __y.get());
} }
template<class _Tp, class _Up> template<class _Tp, class _Up>

View File

@ -341,8 +341,9 @@ class Configuration(object):
self.cxx.flags += ['-target', self.config.target_triple] self.cxx.flags += ['-target', self.config.target_triple]
def configure_compile_flags_header_includes(self): def configure_compile_flags_header_includes(self):
self.cxx.compile_flags += [ support_path = os.path.join(self.libcxx_src_root, 'test/support')
'-I' + os.path.join(self.libcxx_src_root, 'test/support')] self.cxx.compile_flags += ['-I' + support_path]
self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')]
libcxx_headers = self.get_lit_conf( libcxx_headers = self.get_lit_conf(
'libcxx_headers', os.path.join(self.libcxx_src_root, 'include')) 'libcxx_headers', os.path.join(self.libcxx_src_root, 'include'))
if not os.path.isdir(libcxx_headers): if not os.path.isdir(libcxx_headers):

View File

@ -0,0 +1,32 @@
#ifndef SUPPORT_NASTY_MACROS_HPP
#define SUPPORT_NASTY_MACROS_HPP
#define NASTY_MACRO This should not be expanded!!!
#define _A NASTY_MACRO
#define _B NASTY_MACRO
#define _C NASTY_MACRO
#define _D NASTY_MACRO
#define _E NASTY_MACRO
#define _F NASTY_MACRO
#define _G NASTY_MACRO
#define _H NASTY_MACRO
#define _I NASTY_MACRO
#define _J NASTY_MACRO
#define _K NASTY_MACRO
#define _L NASTY_MACRO
#define _M NASTY_MACRO
#define _N NASTY_MACRO
#define _O NASTY_MACRO
#define _P NASTY_MACRO
#define _Q NASTY_MACRO
#define _R NASTY_MACRO
#define _S NASTY_MACRO
#define _T NASTY_MACRO
#define _U NASTY_MACRO
#define _V NASTY_MACRO
#define _W NASTY_MACRO
#define _X NASTY_MACRO
#define _Y NASTY_MACRO
#define _Z NASTY_MACRO
#endif // SUPPORT_NASTY_MACROS_HPP