[libcxx] r318144 - Rename identifiers named `__output`

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 03:14:25 PST 2017


Author: arichardson
Date: Tue Nov 14 03:14:25 2017
New Revision: 318144

URL: http://llvm.org/viewvc/llvm-project?rev=318144&view=rev
Log:
Rename identifiers named `__output`

Summary:
In the CHERI clang compiler __output and __input are keywords and therefore
we can't compile libc++ with our compiler.

Reviewers: mclow.lists, EricWF, theraven

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D39537

Modified:
    libcxx/trunk/include/algorithm
    libcxx/trunk/include/experimental/algorithm
    libcxx/trunk/include/experimental/iterator
    libcxx/trunk/include/regex
    libcxx/trunk/test/support/nasty_macros.hpp

Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=318144&r1=318143&r2=318144&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Tue Nov 14 03:14:25 2017
@@ -3210,28 +3210,28 @@ template <class _PopulationIterator, cla
           class _UniformRandomNumberGenerator>
 _LIBCPP_INLINE_VISIBILITY
 _SampleIterator __sample(_PopulationIterator __first,
-                         _PopulationIterator __last, _SampleIterator __output,
+                         _PopulationIterator __last, _SampleIterator __output_iter,
                          _Distance __n,
                          _UniformRandomNumberGenerator & __g,
                          input_iterator_tag) {
 
   _Distance __k = 0;
   for (; __first != __last && __k < __n; ++__first, (void)++__k)
-    __output[__k] = *__first;
+    __output_iter[__k] = *__first;
   _Distance __sz = __k;
   for (; __first != __last; ++__first, (void)++__k) {
     _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
     if (__r < __sz)
-      __output[__r] = *__first;
+      __output_iter[__r] = *__first;
   }
-  return __output + _VSTD::min(__n, __k);
+  return __output_iter + _VSTD::min(__n, __k);
 }
 
 template <class _PopulationIterator, class _SampleIterator, class _Distance,
           class _UniformRandomNumberGenerator>
 _LIBCPP_INLINE_VISIBILITY
 _SampleIterator __sample(_PopulationIterator __first,
-                         _PopulationIterator __last, _SampleIterator __output,
+                         _PopulationIterator __last, _SampleIterator __output_iter,
                          _Distance __n,
                          _UniformRandomNumberGenerator& __g,
                          forward_iterator_tag) {
@@ -3240,18 +3240,18 @@ _SampleIterator __sample(_PopulationIter
     _Distance __r =
         _VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
     if (__r < __n) {
-      *__output++ = *__first;
+      *__output_iter++ = *__first;
       --__n;
     }
   }
-  return __output;
+  return __output_iter;
 }
 
 template <class _PopulationIterator, class _SampleIterator, class _Distance,
           class _UniformRandomNumberGenerator>
 _LIBCPP_INLINE_VISIBILITY
 _SampleIterator __sample(_PopulationIterator __first,
-                         _PopulationIterator __last, _SampleIterator __output,
+                         _PopulationIterator __last, _SampleIterator __output_iter,
                          _Distance __n, _UniformRandomNumberGenerator& __g) {
   typedef typename iterator_traits<_PopulationIterator>::iterator_category
         _PopCategory;
@@ -3263,7 +3263,7 @@ _SampleIterator __sample(_PopulationIter
   typedef typename common_type<_Distance, _Difference>::type _CommonType;
   _LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
   return _VSTD::__sample(
-      __first, __last, __output, _CommonType(__n),
+      __first, __last, __output_iter, _CommonType(__n),
       __g, _PopCategory());
 }
 
@@ -3272,9 +3272,9 @@ template <class _PopulationIterator, cla
           class _UniformRandomNumberGenerator>
 inline _LIBCPP_INLINE_VISIBILITY
 _SampleIterator sample(_PopulationIterator __first,
-                       _PopulationIterator __last, _SampleIterator __output,
+                       _PopulationIterator __last, _SampleIterator __output_iter,
                        _Distance __n, _UniformRandomNumberGenerator&& __g) {
-    return _VSTD::__sample(__first, __last, __output, __n, __g);
+    return _VSTD::__sample(__first, __last, __output_iter, __n, __g);
 }
 #endif // _LIBCPP_STD_VER > 14
 

Modified: libcxx/trunk/include/experimental/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/algorithm?rev=318144&r1=318143&r2=318144&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/algorithm (original)
+++ libcxx/trunk/include/experimental/algorithm Tue Nov 14 03:14:25 2017
@@ -61,9 +61,9 @@ template <class _PopulationIterator, cla
           class _UniformRandomNumberGenerator>
 inline _LIBCPP_INLINE_VISIBILITY
 _SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last,
-                       _SampleIterator __output, _Distance __n,
+                       _SampleIterator __output_iter, _Distance __n,
                        _UniformRandomNumberGenerator &&__g) {
-  return _VSTD::__sample(__first, __last, __output, __n, __g);
+  return _VSTD::__sample(__first, __last, __output_iter, __n, __g);
 }
 
 _LIBCPP_END_NAMESPACE_LFTS

Modified: libcxx/trunk/include/experimental/iterator
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/iterator?rev=318144&r1=318143&r2=318144&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/iterator (original)
+++ libcxx/trunk/include/experimental/iterator Tue Nov 14 03:14:25 2017
@@ -75,19 +75,19 @@ public:
     typedef void                                 reference;
 
     ostream_joiner(ostream_type& __os, _Delim&& __d)
-        : __output(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
+        : __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
         
     ostream_joiner(ostream_type& __os, const _Delim& __d)
-        : __output(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
+        : __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
     
 
     template<typename _Tp>
     ostream_joiner& operator=(const _Tp& __v)
     {
         if (!__first)
-            *__output << __delim;
+            *__output_iter << __delim;
         __first = false;
-        *__output << __v;
+        *__output_iter << __v;
         return *this;
     }
 
@@ -96,7 +96,7 @@ public:
     ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
 
 private:
-    ostream_type*   __output;
+    ostream_type*   __output_iter;
     _Delim          __delim;
     bool            __first;
 };

Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=318144&r1=318143&r2=318144&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Tue Nov 14 03:14:25 2017
@@ -5277,15 +5277,15 @@ public:
     // format:
     template <class _OutputIter>
         _OutputIter
-        format(_OutputIter __output, const char_type* __fmt_first,
+        format(_OutputIter __output_iter, const char_type* __fmt_first,
                const char_type* __fmt_last,
                regex_constants::match_flag_type __flags = regex_constants::format_default) const;
     template <class _OutputIter, class _ST, class _SA>
         _LIBCPP_INLINE_VISIBILITY
         _OutputIter
-        format(_OutputIter __output, const basic_string<char_type, _ST, _SA>& __fmt,
+        format(_OutputIter __output_iter, const basic_string<char_type, _ST, _SA>& __fmt,
                regex_constants::match_flag_type __flags = regex_constants::format_default) const
-            {return format(__output, __fmt.data(), __fmt.data() + __fmt.size(), __flags);}
+            {return format(__output_iter, __fmt.data(), __fmt.data() + __fmt.size(), __flags);}
     template <class _ST, class _SA>
         _LIBCPP_INLINE_VISIBILITY
         basic_string<char_type, _ST, _SA>
@@ -5397,7 +5397,7 @@ match_results<_BidirectionalIterator, _A
 template <class _BidirectionalIterator, class _Allocator>
 template <class _OutputIter>
 _OutputIter
-match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output,
+match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_iter,
         const char_type* __fmt_first, const char_type* __fmt_last,
         regex_constants::match_flag_type __flags) const
 {
@@ -5406,27 +5406,27 @@ match_results<_BidirectionalIterator, _A
         for (; __fmt_first != __fmt_last; ++__fmt_first)
         {
             if (*__fmt_first == '&')
-                __output = _VSTD::copy(__matches_[0].first, __matches_[0].second,
-                                   __output);
+                __output_iter = _VSTD::copy(__matches_[0].first, __matches_[0].second,
+                                   __output_iter);
             else if (*__fmt_first == '\\' && __fmt_first + 1 != __fmt_last)
             {
                 ++__fmt_first;
                 if ('0' <= *__fmt_first && *__fmt_first <= '9')
                 {
                     size_t __i = *__fmt_first - '0';
-                    __output = _VSTD::copy((*this)[__i].first,
-                                        (*this)[__i].second, __output);
+                    __output_iter = _VSTD::copy((*this)[__i].first,
+                                        (*this)[__i].second, __output_iter);
                 }
                 else
                 {
-                    *__output = *__fmt_first;
-                    ++__output;
+                    *__output_iter = *__fmt_first;
+                    ++__output_iter;
                 }
             }
             else
             {
-                *__output = *__fmt_first;
-                ++__output;
+                *__output_iter = *__fmt_first;
+                ++__output_iter;
             }
         }
     }
@@ -5439,21 +5439,21 @@ match_results<_BidirectionalIterator, _A
                 switch (__fmt_first[1])
                 {
                 case '$':
-                    *__output = *++__fmt_first;
-                    ++__output;
+                    *__output_iter = *++__fmt_first;
+                    ++__output_iter;
                     break;
                 case '&':
                     ++__fmt_first;
-                    __output = _VSTD::copy(__matches_[0].first, __matches_[0].second,
-                                       __output);
+                    __output_iter = _VSTD::copy(__matches_[0].first, __matches_[0].second,
+                                       __output_iter);
                     break;
                 case '`':
                     ++__fmt_first;
-                    __output = _VSTD::copy(__prefix_.first, __prefix_.second, __output);
+                    __output_iter = _VSTD::copy(__prefix_.first, __prefix_.second, __output_iter);
                     break;
                 case '\'':
                     ++__fmt_first;
-                    __output = _VSTD::copy(__suffix_.first, __suffix_.second, __output);
+                    __output_iter = _VSTD::copy(__suffix_.first, __suffix_.second, __output_iter);
                     break;
                 default:
                     if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9')
@@ -5468,25 +5468,25 @@ match_results<_BidirectionalIterator, _A
                                 __throw_regex_error<regex_constants::error_escape>();
                             __idx = 10 * __idx + *__fmt_first - '0';
                         }
-                        __output = _VSTD::copy((*this)[__idx].first,
-                                            (*this)[__idx].second, __output);
+                        __output_iter = _VSTD::copy((*this)[__idx].first,
+                                            (*this)[__idx].second, __output_iter);
                     }
                     else
                     {
-                        *__output = *__fmt_first;
-                        ++__output;
+                        *__output_iter = *__fmt_first;
+                        ++__output_iter;
                     }
                     break;
                 }
             }
             else
             {
-                *__output = *__fmt_first;
-                ++__output;
+                *__output_iter = *__fmt_first;
+                ++__output_iter;
             }
         }
     }
-    return __output;
+    return __output_iter;
 }
 
 template <class _BidirectionalIterator, class _Allocator>
@@ -6494,7 +6494,7 @@ typedef regex_token_iterator<wstring::co
 template <class _OutputIterator, class _BidirectionalIterator,
           class _Traits, class _CharT>
 _OutputIterator
-regex_replace(_OutputIterator __output,
+regex_replace(_OutputIterator __output_iter,
               _BidirectionalIterator __first, _BidirectionalIterator __last,
               const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
               regex_constants::match_flag_type __flags = regex_constants::match_default)
@@ -6505,7 +6505,7 @@ regex_replace(_OutputIterator __output,
     if (__i == __eof)
     {
         if (!(__flags & regex_constants::format_no_copy))
-            __output = _VSTD::copy(__first, __last, __output);
+            __output_iter = _VSTD::copy(__first, __last, __output_iter);
     }
     else
     {
@@ -6513,29 +6513,29 @@ regex_replace(_OutputIterator __output,
         for (size_t __len = char_traits<_CharT>::length(__fmt); __i != __eof; ++__i)
         {
             if (!(__flags & regex_constants::format_no_copy))
-                __output = _VSTD::copy(__i->prefix().first, __i->prefix().second, __output);
-            __output = __i->format(__output, __fmt, __fmt + __len, __flags);
+                __output_iter = _VSTD::copy(__i->prefix().first, __i->prefix().second, __output_iter);
+            __output_iter = __i->format(__output_iter, __fmt, __fmt + __len, __flags);
             __lm = __i->suffix();
             if (__flags & regex_constants::format_first_only)
                 break;
         }
         if (!(__flags & regex_constants::format_no_copy))
-            __output = _VSTD::copy(__lm.first, __lm.second, __output);
+            __output_iter = _VSTD::copy(__lm.first, __lm.second, __output_iter);
     }
-    return __output;
+    return __output_iter;
 }
 
 template <class _OutputIterator, class _BidirectionalIterator,
           class _Traits, class _CharT, class _ST, class _SA>
 inline _LIBCPP_INLINE_VISIBILITY
 _OutputIterator
-regex_replace(_OutputIterator __output,
+regex_replace(_OutputIterator __output_iter,
               _BidirectionalIterator __first, _BidirectionalIterator __last,
               const basic_regex<_CharT, _Traits>& __e,
               const basic_string<_CharT, _ST, _SA>& __fmt,
               regex_constants::match_flag_type __flags = regex_constants::match_default)
 {
-    return _VSTD::regex_replace(__output, __first, __last, __e, __fmt.c_str(), __flags);
+    return _VSTD::regex_replace(__output_iter, __first, __last, __e, __fmt.c_str(), __flags);
 }
 
 template <class _Traits, class _CharT, class _ST, class _SA, class _FST,

Modified: libcxx/trunk/test/support/nasty_macros.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/nasty_macros.hpp?rev=318144&r1=318143&r2=318144&view=diff
==============================================================================
--- libcxx/trunk/test/support/nasty_macros.hpp (original)
+++ libcxx/trunk/test/support/nasty_macros.hpp Tue Nov 14 03:14:25 2017
@@ -52,4 +52,7 @@
 #define __out NASTY_MACRO
 #endif
 
+#define __output NASTY_MACRO
+#define __input NASTY_MACRO
+
 #endif // SUPPORT_NASTY_MACROS_HPP




More information about the cfe-commits mailing list