Author: marshall
Date: Wed Jul 27 23:52:02 2016
New Revision: 276955

URL: http://llvm.org/viewvc/llvm-project?rev=276955&view=rev
Log:
Add a bunch of noexcepts to char_traits and string_view.

Modified:
    libcxx/trunk/include/__string
    libcxx/trunk/include/string_view

Modified: libcxx/trunk/include/__string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__string?rev=276955&r1=276954&r2=276955&view=diff
==============================================================================
--- libcxx/trunk/include/__string (original)
+++ libcxx/trunk/include/__string Wed Jul 27 23:52:02 2016
@@ -207,19 +207,19 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
     static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) 
_NOEXCEPT
         {return (unsigned char)__c1 < (unsigned char)__c2;}
 
-    static inline int compare(const char_type* __s1, const char_type* __s2, 
size_t __n)
+    static inline int compare(const char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
         {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);}
-    static inline size_t length(const char_type* __s) {return strlen(__s);}
-    static inline const char_type* find(const char_type* __s, size_t __n, 
const char_type& __a)
+    static inline size_t length(const char_type* __s)  _NOEXCEPT {return 
strlen(__s);}
+    static inline const char_type* find(const char_type* __s, size_t __n, 
const char_type& __a) _NOEXCEPT
         {return __n == 0 ? NULL : (const char_type*) memchr(__s, 
to_int_type(__a), __n);}
-    static inline char_type* move(char_type* __s1, const char_type* __s2, 
size_t __n)
+    static inline char_type* move(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
         {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
-    static inline char_type* copy(char_type* __s1, const char_type* __s2, 
size_t __n)
+    static inline char_type* copy(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
         {
             _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy 
overlapped range");
             return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
         }
-    static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
+    static inline char_type* assign(char_type* __s, size_t __n, char_type __a) 
_NOEXCEPT
         {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), 
__n);}
 
     static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
@@ -252,20 +252,20 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
     static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) 
_NOEXCEPT
         {return __c1 < __c2;}
 
-    static inline int compare(const char_type* __s1, const char_type* __s2, 
size_t __n)
+    static inline int compare(const char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
         {return __n == 0 ? 0 : wmemcmp(__s1, __s2, __n);}
-    static inline size_t length(const char_type* __s)
+    static inline size_t length(const char_type* __s) _NOEXCEPT
         {return wcslen(__s);}
-    static inline const char_type* find(const char_type* __s, size_t __n, 
const char_type& __a)
+    static inline const char_type* find(const char_type* __s, size_t __n, 
const char_type& __a) _NOEXCEPT
         {return __n == 0 ? NULL : (const char_type*)wmemchr(__s, __a, __n);}
-    static inline char_type* move(char_type* __s1, const char_type* __s2, 
size_t __n)
+    static inline char_type* move(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
         {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);}
-    static inline char_type* copy(char_type* __s1, const char_type* __s2, 
size_t __n)
+    static inline char_type* copy(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
         {
             _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy 
overlapped range");
             return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n);
         }
-    static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
+    static inline char_type* assign(char_type* __s, size_t __n, char_type __a) 
_NOEXCEPT
         {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);}
 
     static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
@@ -299,17 +299,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
         {return __c1 < __c2;}
 
     _LIBCPP_INLINE_VISIBILITY
-    static int              compare(const char_type* __s1, const char_type* 
__s2, size_t __n);
+    static int              compare(const char_type* __s1, const char_type* 
__s2, size_t __n) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static size_t           length(const char_type* __s);
+    static size_t           length(const char_type* __s) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static const char_type* find(const char_type* __s, size_t __n, const 
char_type& __a);
+    static const char_type* find(const char_type* __s, size_t __n, const 
char_type& __a) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static char_type*       move(char_type* __s1, const char_type* __s2, 
size_t __n);
+    static char_type*       move(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static char_type*       copy(char_type* __s1, const char_type* __s2, 
size_t __n);
+    static char_type*       copy(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static char_type*       assign(char_type* __s, size_t __n, char_type __a);
+    static char_type*       assign(char_type* __s, size_t __n, char_type __a) 
_NOEXCEPT;
 
     static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
         {return eq_int_type(__c, eof()) ? ~eof() : __c;}
@@ -325,7 +325,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
 
 inline
 int
-char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, 
size_t __n)
+char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
 {
     for (; __n; --__n, ++__s1, ++__s2)
     {
@@ -339,7 +339,7 @@ char_traits<char16_t>::compare(const cha
 
 inline
 size_t
-char_traits<char16_t>::length(const char_type* __s)
+char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT
 {
     size_t __len = 0;
     for (; !eq(*__s, char_type(0)); ++__s)
@@ -349,7 +349,7 @@ char_traits<char16_t>::length(const char
 
 inline
 const char16_t*
-char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& 
__a)
+char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& 
__a) _NOEXCEPT
 {
     for (; __n; --__n)
     {
@@ -362,7 +362,7 @@ char_traits<char16_t>::find(const char_t
 
 inline
 char16_t*
-char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
+char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t 
__n) _NOEXCEPT
 {
     char_type* __r = __s1;
     if (__s1 < __s2)
@@ -382,7 +382,7 @@ char_traits<char16_t>::move(char_type* _
 
 inline
 char16_t*
-char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
+char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t 
__n) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy 
overlapped range");
     char_type* __r = __s1;
@@ -393,7 +393,7 @@ char_traits<char16_t>::copy(char_type* _
 
 inline
 char16_t*
-char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
+char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) 
_NOEXCEPT
 {
     char_type* __r = __s;
     for (; __n; --__n, ++__s)
@@ -418,17 +418,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
         {return __c1 < __c2;}
 
     _LIBCPP_INLINE_VISIBILITY
-    static int              compare(const char_type* __s1, const char_type* 
__s2, size_t __n);
+    static int              compare(const char_type* __s1, const char_type* 
__s2, size_t __n) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static size_t           length(const char_type* __s);
+    static size_t           length(const char_type* __s) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static const char_type* find(const char_type* __s, size_t __n, const 
char_type& __a);
+    static const char_type* find(const char_type* __s, size_t __n, const 
char_type& __a) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static char_type*       move(char_type* __s1, const char_type* __s2, 
size_t __n);
+    static char_type*       move(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static char_type*       copy(char_type* __s1, const char_type* __s2, 
size_t __n);
+    static char_type*       copy(char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
-    static char_type*       assign(char_type* __s, size_t __n, char_type __a);
+    static char_type*       assign(char_type* __s, size_t __n, char_type __a) 
_NOEXCEPT;
 
     static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
         {return eq_int_type(__c, eof()) ? ~eof() : __c;}
@@ -444,7 +444,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
 
 inline
 int
-char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, 
size_t __n)
+char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, 
size_t __n) _NOEXCEPT
 {
     for (; __n; --__n, ++__s1, ++__s2)
     {
@@ -458,7 +458,7 @@ char_traits<char32_t>::compare(const cha
 
 inline
 size_t
-char_traits<char32_t>::length(const char_type* __s)
+char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT
 {
     size_t __len = 0;
     for (; !eq(*__s, char_type(0)); ++__s)
@@ -468,7 +468,7 @@ char_traits<char32_t>::length(const char
 
 inline
 const char32_t*
-char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& 
__a)
+char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& 
__a) _NOEXCEPT
 {
     for (; __n; --__n)
     {
@@ -481,7 +481,7 @@ char_traits<char32_t>::find(const char_t
 
 inline
 char32_t*
-char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
+char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t 
__n) _NOEXCEPT
 {
     char_type* __r = __s1;
     if (__s1 < __s2)
@@ -501,7 +501,7 @@ char_traits<char32_t>::move(char_type* _
 
 inline
 char32_t*
-char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
+char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t 
__n) _NOEXCEPT
 {
     _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy 
overlapped range");
     char_type* __r = __s1;
@@ -512,7 +512,7 @@ char_traits<char32_t>::copy(char_type* _
 
 inline
 char32_t*
-char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
+char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) 
_NOEXCEPT
 {
     char_type* __r = __s;
     for (; __n; --__n, ++__s)

Modified: libcxx/trunk/include/string_view
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string_view?rev=276955&r1=276954&r2=276955&view=diff
==============================================================================
--- libcxx/trunk/include/string_view (original)
+++ libcxx/trunk/include/string_view Wed Jul 27 23:52:02 2016
@@ -356,7 +356,7 @@ public:
        }
 
        _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
-       int compare(const _CharT* __s) const
+       int compare(const _CharT* __s) const _NOEXCEPT
        {
                return compare(basic_string_view(__s));
        }


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to