Nico Rieck:  this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>.

llvm-svn: 188192
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: f0544c2086a1a592e294f24d62973ce732af33da
diff --git a/include/string b/include/string
index 83dc53a..c5ed95c 100644
--- a/include/string
+++ b/include/string
@@ -462,7 +462,7 @@
 // fpos
 
 template <class _StateT>
-class _LIBCPP_TYPE_VIS fpos
+class _LIBCPP_TYPE_VIS_ONLY fpos
 {
 private:
     _StateT __st_;
@@ -499,7 +499,7 @@
 // char_traits
 
 template <class _CharT>
-struct _LIBCPP_TYPE_VIS char_traits
+struct _LIBCPP_TYPE_VIS_ONLY char_traits
 {
     typedef _CharT    char_type;
     typedef int       int_type;
@@ -625,7 +625,7 @@
 // char_traits<char>
 
 template <>
-struct _LIBCPP_TYPE_VIS char_traits<char>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<char>
 {
     typedef char      char_type;
     typedef int       int_type;
@@ -681,7 +681,7 @@
 // char_traits<wchar_t>
 
 template <>
-struct _LIBCPP_TYPE_VIS char_traits<wchar_t>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<wchar_t>
 {
     typedef wchar_t   char_type;
     typedef wint_t    int_type;
@@ -738,7 +738,7 @@
 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
 
 template <>
-struct _LIBCPP_TYPE_VIS char_traits<char16_t>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
 {
     typedef char16_t       char_type;
     typedef uint_least16_t int_type;
@@ -858,7 +858,7 @@
 }
 
 template <>
-struct _LIBCPP_TYPE_VIS char_traits<char32_t>
+struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
 {
     typedef char32_t       char_type;
     typedef uint_least32_t int_type;
@@ -1003,7 +1003,7 @@
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
 
 template <bool>
-class __basic_string_common
+class _LIBCPP_TYPE_VIS_ONLY __basic_string_common
 {
 protected:
     void __throw_length_error() const;
@@ -1036,7 +1036,7 @@
 #pragma warning( push )
 #pragma warning( disable: 4231 )
 #endif // _LIBCPP_MSVC
-_LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __basic_string_common<true>)
 #ifdef _LIBCPP_MSVC
 #pragma warning( pop )
 #endif // _LIBCPP_MSVC
@@ -1057,7 +1057,7 @@
 #endif  // _LIBCPP_ALTERNATE_STRING_LAYOUT
 
 template<class _CharT, class _Traits, class _Allocator>
-class _LIBCPP_TYPE_VIS basic_string
+class _LIBCPP_TYPE_VIS_ONLY basic_string
     : private __basic_string_common<true>
 {
 public:
@@ -3998,45 +3998,45 @@
 
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
 
-int                stoi  (const string& __str, size_t* __idx = 0, int __base = 10);
-long               stol  (const string& __str, size_t* __idx = 0, int __base = 10);
-unsigned long      stoul (const string& __str, size_t* __idx = 0, int __base = 10);
-long long          stoll (const string& __str, size_t* __idx = 0, int __base = 10);
-unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS int                stoi  (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long               stol  (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long      stoul (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long long          stoll (const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
 
-float       stof (const string& __str, size_t* __idx = 0);
-double      stod (const string& __str, size_t* __idx = 0);
-long double stold(const string& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS float       stof (const string& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS double      stod (const string& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = 0);
 
-string to_string(int __val);
-string to_string(unsigned __val);
-string to_string(long __val);
-string to_string(unsigned long __val);
-string to_string(long long __val);
-string to_string(unsigned long long __val);
-string to_string(float __val);
-string to_string(double __val);
-string to_string(long double __val);
+_LIBCPP_FUNC_VIS string to_string(int __val);
+_LIBCPP_FUNC_VIS string to_string(unsigned __val);
+_LIBCPP_FUNC_VIS string to_string(long __val);
+_LIBCPP_FUNC_VIS string to_string(unsigned long __val);
+_LIBCPP_FUNC_VIS string to_string(long long __val);
+_LIBCPP_FUNC_VIS string to_string(unsigned long long __val);
+_LIBCPP_FUNC_VIS string to_string(float __val);
+_LIBCPP_FUNC_VIS string to_string(double __val);
+_LIBCPP_FUNC_VIS string to_string(long double __val);
 
-int                stoi  (const wstring& __str, size_t* __idx = 0, int __base = 10);
-long               stol  (const wstring& __str, size_t* __idx = 0, int __base = 10);
-unsigned long      stoul (const wstring& __str, size_t* __idx = 0, int __base = 10);
-long long          stoll (const wstring& __str, size_t* __idx = 0, int __base = 10);
-unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS int                stoi  (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long               stol  (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long      stoul (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS long long          stoll (const wstring& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10);
 
-float       stof (const wstring& __str, size_t* __idx = 0);
-double      stod (const wstring& __str, size_t* __idx = 0);
-long double stold(const wstring& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS float       stof (const wstring& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS double      stod (const wstring& __str, size_t* __idx = 0);
+_LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = 0);
 
-wstring to_wstring(int __val);
-wstring to_wstring(unsigned __val);
-wstring to_wstring(long __val);
-wstring to_wstring(unsigned long __val);
-wstring to_wstring(long long __val);
-wstring to_wstring(unsigned long long __val);
-wstring to_wstring(float __val);
-wstring to_wstring(double __val);
-wstring to_wstring(long double __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(int __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(unsigned __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(unsigned long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(long long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(unsigned long long __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(float __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(double __val);
+_LIBCPP_FUNC_VIS wstring to_wstring(long double __val);
 
 template<class _CharT, class _Traits, class _Allocator>
     const typename basic_string<_CharT, _Traits, _Allocator>::size_type
@@ -4050,7 +4050,7 @@
 }
 
 template<class _CharT, class _Traits, class _Allocator>
-struct _LIBCPP_TYPE_VIS hash<basic_string<_CharT, _Traits, _Allocator> >
+struct _LIBCPP_TYPE_VIS_ONLY hash<basic_string<_CharT, _Traits, _Allocator> >
     : public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
 {
     size_t
@@ -4138,8 +4138,8 @@
 }
 #endif
 
-_LIBCPP_EXTERN_TEMPLATE(class basic_string<char>)
-_LIBCPP_EXTERN_TEMPLATE(class basic_string<wchar_t>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_string<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_string<wchar_t>)
 
 extern template
     string