Dimitry Andric:  many visibility fixes.  Howard:  Much appreciated.  Can you send me a patch to CREDITS.TXT?

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163862 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__hash_table b/include/__hash_table
index 3c39ac7..ba04b3e 100644
--- a/include/__hash_table
+++ b/include/__hash_table
@@ -80,9 +80,9 @@
 }
 
 template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
-template <class _ConstNodePtr> class __hash_const_iterator;
-template <class _HashIterator> class __hash_map_iterator;
-template <class _HashIterator> class __hash_map_const_iterator;
+template <class _ConstNodePtr> class _LIBCPP_VISIBLE __hash_const_iterator;
+template <class _HashIterator> class _LIBCPP_VISIBLE __hash_map_iterator;
+template <class _HashIterator> class _LIBCPP_VISIBLE __hash_map_const_iterator;
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
     class _LIBCPP_VISIBLE unordered_map;
 
diff --git a/include/__locale b/include/__locale
index f23e035..e6c357f 100644
--- a/include/__locale
+++ b/include/__locale
@@ -31,17 +31,24 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-class locale;
+class _LIBCPP_VISIBLE locale;
 
-template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
-template <class _Facet> const _Facet& use_facet(const locale&);
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+bool
+has_facet(const locale&) _NOEXCEPT;
+
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+const _Facet&
+use_facet(const locale&);
 
 class _LIBCPP_VISIBLE locale
 {
 public:
     // types:
-    class facet;
-    class id;
+    class _LIBCPP_VISIBLE facet;
+    class _LIBCPP_VISIBLE id;
 
     typedef int category;
     static const category // values assigned here are for exposition only
diff --git a/include/__tree b/include/__tree
index f57c80c..bd38b4f 100644
--- a/include/__tree
+++ b/include/__tree
@@ -614,8 +614,8 @@
 #endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
 };
 
-template <class _TreeIterator> class __map_iterator;
-template <class _TreeIterator> class __map_const_iterator;
+template <class _TreeIterator> class _LIBCPP_VISIBLE __map_iterator;
+template <class _TreeIterator> class _LIBCPP_VISIBLE __map_const_iterator;
 
 template <class _Tp, class _NodePtr, class _DiffType>
 class _LIBCPP_VISIBLE __tree_iterator
diff --git a/include/__tuple b/include/__tuple
index 8216804..1fa90a0 100644
--- a/include/__tuple
+++ b/include/__tuple
@@ -79,38 +79,47 @@
 template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
 
 template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, tuple<_Tp...> >::type&
 get(tuple<_Tp...>&) _NOEXCEPT;
 
 template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
 const typename tuple_element<_Ip, tuple<_Tp...> >::type&
 get(const tuple<_Tp...>&) _NOEXCEPT;
 
 template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, tuple<_Tp...> >::type&&
 get(tuple<_Tp...>&&) _NOEXCEPT;
 
 template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, pair<_T1, _T2> >::type&
 get(pair<_T1, _T2>&) _NOEXCEPT;
 
 template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
 get(const pair<_T1, _T2>&) _NOEXCEPT;
 
 template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
 typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
 get(pair<_T1, _T2>&&) _NOEXCEPT;
 
 template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
 _Tp&
 get(array<_Tp, _Size>&) _NOEXCEPT;
 
 template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
 const _Tp&
 get(const array<_Tp, _Size>&) _NOEXCEPT;
 
 template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
 _Tp&&
 get(array<_Tp, _Size>&&) _NOEXCEPT;
 
diff --git a/include/bitset b/include/bitset
index 0c40b9b..1167f50 100644
--- a/include/bitset
+++ b/include/bitset
@@ -626,7 +626,7 @@
 {
 }
 
-template <size_t _Size> class bitset;
+template <size_t _Size> class _LIBCPP_VISIBLE bitset;
 template <size_t _Size> struct hash<bitset<_Size> >;
 
 template <size_t _Size>
diff --git a/include/exception b/include/exception
index 2f527d9..5b75fb0 100644
--- a/include/exception
+++ b/include/exception
@@ -116,7 +116,7 @@
 
 _LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
 
-class exception_ptr;
+class _LIBCPP_VISIBLE exception_ptr;
 
 exception_ptr current_exception() _NOEXCEPT;
 _LIBCPP_NORETURN void rethrow_exception(exception_ptr);
diff --git a/include/forward_list b/include/forward_list
index 19f7484..404c6eb 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -212,8 +212,8 @@
     value_type __value_;
 };
 
-template<class _Tp, class _Alloc> class forward_list;
-template<class _NodeConstPtr> class __forward_list_const_iterator;
+template<class _Tp, class _Alloc> class _LIBCPP_VISIBLE forward_list;
+template<class _NodeConstPtr> class _LIBCPP_VISIBLE __forward_list_const_iterator;
 
 template <class _NodePtr>
 class _LIBCPP_VISIBLE __forward_list_iterator
@@ -225,8 +225,8 @@
     _LIBCPP_INLINE_VISIBILITY
     explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
 
-    template<class, class> friend class forward_list;
-    template<class> friend class __forward_list_const_iterator;
+    template<class, class> friend class _LIBCPP_VISIBLE forward_list;
+    template<class> friend class _LIBCPP_VISIBLE __forward_list_const_iterator;
 
 public:
     typedef forward_iterator_tag                              iterator_category;
diff --git a/include/future b/include/future
index 9b768e3..758296a 100644
--- a/include/future
+++ b/include/future
@@ -962,12 +962,12 @@
     base::__on_zero_shared();
 }
 
-template <class _Rp> class promise;
-template <class _Rp> class shared_future;
+template <class _Rp> class _LIBCPP_VISIBLE promise;
+template <class _Rp> class _LIBCPP_VISIBLE shared_future;
 
 // future
 
-template <class _Rp> class future;
+template <class _Rp> class _LIBCPP_VISIBLE future;
 
 template <class _Rp, class _Fp>
 future<_Rp>
diff --git a/include/ios b/include/ios
index d02651b..7e489e3 100644
--- a/include/ios
+++ b/include/ios
@@ -227,7 +227,7 @@
 class _LIBCPP_VISIBLE ios_base
 {
 public:
-    class failure;
+    class _LIBCPP_VISIBLE failure;
 
     typedef unsigned int fmtflags;
     static const fmtflags boolalpha   = 0x0001;
@@ -271,7 +271,7 @@
     typedef _VSTD::streamoff streamoff;
     typedef _VSTD::streampos streampos;
 
-    class Init;
+    class _LIBCPP_VISIBLE Init;
 
     // 27.5.2.2 fmtflags state:
     _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
diff --git a/include/iosfwd b/include/iosfwd
index 7e5ac73..efdff5f 100644
--- a/include/iosfwd
+++ b/include/iosfwd
@@ -95,7 +95,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-class ios_base;
+class _LIBCPP_VISIBLE ios_base;
 
 template<class _CharT>  struct _LIBCPP_VISIBLE char_traits;
 template<class _Tp>     class _LIBCPP_VISIBLE allocator;
diff --git a/include/istream b/include/istream
index b48f856..72b2004 100644
--- a/include/istream
+++ b/include/istream
@@ -194,7 +194,7 @@
 public:
 
     // 27.7.1.1.3 Prefix/suffix:
-    class sentry;
+    class _LIBCPP_VISIBLE sentry;
 
     // 27.7.1.2 Formatted input:
     basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
diff --git a/include/iterator b/include/iterator
index 2c9ae12..167db52 100644
--- a/include/iterator
+++ b/include/iterator
@@ -1009,43 +1009,52 @@
 template <class _Iter> class __wrap_iter;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 typename __wrap_iter<_Iter1>::difference_type
 operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
 
 template <class _Iter>
+_LIBCPP_INLINE_VISIBILITY
 __wrap_iter<_Iter>
 operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
 
-template <class _Ip, class _Op> _Op copy(_Ip, _Ip, _Op);
-template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
-template <class _Ip, class _Op> _Op move(_Ip, _Ip, _Op);
-template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
     is_trivially_copy_assignable<_Tp>::value,
@@ -1313,34 +1322,42 @@
 template <class _Container, class _Iter> class __debug_iter;
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
 typename __debug_iter<_Container, _Iter1>::difference_type
 operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
 
 template <class _Container, class _Iter>
+_LIBCPP_INLINE_VISIBILITY
 __debug_iter<_Container, _Iter>
 operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
 
diff --git a/include/list b/include/list
index b486e83..8125886 100644
--- a/include/list
+++ b/include/list
@@ -213,9 +213,9 @@
     _Tp __value_;
 };
 
-template <class _Tp, class _Alloc> class list;
+template <class _Tp, class _Alloc> class _LIBCPP_VISIBLE list;
 template <class _Tp, class _Alloc> class __list_imp;
-template <class _Tp, class _VoidPtr> class __list_const_iterator;
+template <class _Tp, class _VoidPtr> class _LIBCPP_VISIBLE __list_const_iterator;
 
 template <class _Tp, class _VoidPtr>
 class _LIBCPP_VISIBLE __list_iterator
diff --git a/include/memory b/include/memory
index 5559e49..fe5dd0c 100644
--- a/include/memory
+++ b/include/memory
@@ -3580,7 +3580,7 @@
     virtual const char* what() const  _NOEXCEPT;
 };
 
-template<class _Tp> class weak_ptr;
+template<class _Tp> class _LIBCPP_VISIBLE weak_ptr;
 
 class __shared_count
 {
@@ -3746,7 +3746,7 @@
     __a.deallocate(this, 1);
 }
 
-template<class _Tp> class enable_shared_from_this;
+template<class _Tp> class _LIBCPP_VISIBLE enable_shared_from_this;
 
 template<class _Tp>
 class _LIBCPP_VISIBLE shared_ptr
@@ -5278,10 +5278,10 @@
     __sp_mut(const __sp_mut&);
     __sp_mut& operator=(const __sp_mut&);
 
-    friend __sp_mut& __get_sp_mut(const void*);
+    friend _LIBCPP_VISIBLE __sp_mut& __get_sp_mut(const void*);
 };
 
-__sp_mut& __get_sp_mut(const void*);
+_LIBCPP_VISIBLE __sp_mut& __get_sp_mut(const void*);
 
 template <class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
diff --git a/include/mutex b/include/mutex
index 61f53e0..ee20f02 100644
--- a/include/mutex
+++ b/include/mutex
@@ -425,17 +425,19 @@
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
-struct once_flag;
+struct _LIBCPP_VISIBLE once_flag;
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
 template<class _Callable, class... _Args>
-  void call_once(once_flag&, _Callable&&, _Args&&...);
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable&&, _Args&&...);
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
 
 template<class _Callable>
-  void call_once(once_flag&, _Callable);
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable);
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
diff --git a/include/ostream b/include/ostream
index e6dd4b5..b135ddb 100644
--- a/include/ostream
+++ b/include/ostream
@@ -169,7 +169,7 @@
 public:
 
     // 27.7.2.4 Prefix/suffix:
-    class sentry;
+    class _LIBCPP_VISIBLE sentry;
 
     // 27.7.2.6 Formatted output:
     basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
diff --git a/include/queue b/include/queue
index e05ab8f..4741f00 100644
--- a/include/queue
+++ b/include/queue
@@ -177,13 +177,15 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp, class _Container> class queue;
+template <class _Tp, class _Container> class _LIBCPP_VISIBLE queue;
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
 
diff --git a/include/random b/include/random
index 305f886..a1553f1 100644
--- a/include/random
+++ b/include/random
@@ -1813,10 +1813,11 @@
 };
 
 template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-class linear_congruential_engine;
+class _LIBCPP_VISIBLE linear_congruential_engine;
 
 template <class _CharT, class _Traits,
           class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+_LIBCPP_INLINE_VISIBILITY
 basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os,
            const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
@@ -2021,7 +2022,7 @@
 template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
           _UIntType __a, size_t __u, _UIntType __d, size_t __s,
           _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-class mersenne_twister_engine;
+class _LIBCPP_VISIBLE mersenne_twister_engine;
 
 template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
@@ -2035,6 +2036,7 @@
 template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
           _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
           _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
                                          _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
@@ -2424,7 +2426,7 @@
 // subtract_with_carry_engine
 
 template<class _UIntType, size_t __w, size_t __s, size_t __r>
-class subtract_with_carry_engine;
+class _LIBCPP_VISIBLE subtract_with_carry_engine;
 
 template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
 bool
@@ -2433,6 +2435,7 @@
     const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
 
 template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(
     const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
diff --git a/include/regex b/include/regex
index 16d6102..3918ee0 100644
--- a/include/regex
+++ b/include/regex
@@ -1231,11 +1231,11 @@
 
 template <class _CharT> class __node;
 
-template <class _BidirectionalIterator> class sub_match;
+template <class _BidirectionalIterator> class _LIBCPP_VISIBLE sub_match;
 
 template <class _BidirectionalIterator,
           class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
-class match_results;
+class _LIBCPP_VISIBLE match_results;
 
 template <class _CharT>
 struct __state
diff --git a/include/stack b/include/stack
index 59906bd..12fb35b 100644
--- a/include/stack
+++ b/include/stack
@@ -91,13 +91,15 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp, class _Container> class stack;
+template <class _Tp, class _Container> class _LIBCPP_VISIBLE stack;
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
 
 template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
 bool
 operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
 
diff --git a/include/system_error b/include/system_error
index e9f2b55..9f7e4e9 100644
--- a/include/system_error
+++ b/include/system_error
@@ -354,12 +354,12 @@
     : true_type { };
 #endif
 
-class error_condition;
-class error_code;
+class _LIBCPP_VISIBLE error_condition;
+class _LIBCPP_VISIBLE error_code;
 
 // class error_category
 
-class __do_message;
+class _LIBCPP_HIDDEN __do_message;
 
 class _LIBCPP_VISIBLE error_category
 {
@@ -387,7 +387,7 @@
     _LIBCPP_ALWAYS_INLINE
     bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
 
-    friend class __do_message;
+    friend class _LIBCPP_HIDDEN __do_message;
 };
 
 class _LIBCPP_HIDDEN __do_message
diff --git a/include/thread b/include/thread
index 94e7ab6..60d8885 100644
--- a/include/thread
+++ b/include/thread
@@ -173,13 +173,13 @@
     delete __p_old;
 }
 
-class thread;
-class __thread_id;
+class _LIBCPP_VISIBLE thread;
+class _LIBCPP_VISIBLE __thread_id;
 
 namespace this_thread
 {
 
-__thread_id get_id() _NOEXCEPT;
+_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
 
 }  // this_thread
 
diff --git a/include/tuple b/include/tuple
index d2bc21f..65af3eb 100644
--- a/include/tuple
+++ b/include/tuple
@@ -803,7 +803,7 @@
 
 namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
 
-template <class _Tp> class reference_wrapper;
+template <class _Tp> class _LIBCPP_VISIBLE reference_wrapper;
 
 template <class _Tp>
 struct ___make_tuple_return
diff --git a/include/type_traits b/include/type_traits
index 783ed3f..f74b778 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -2829,11 +2829,13 @@
 // bullets 1 and 2
 
 template <class _Fp, class _A0, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
     -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));
 
 template <class _Fp, class _A0, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
     -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));
@@ -2841,11 +2843,13 @@
 // bullets 3 and 4
 
 template <class _Fp, class _A0>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0)
     -> decltype(_VSTD::forward<_A0>(__a0).*__f);
 
 template <class _Fp, class _A0>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _A0&& __a0)
     -> decltype((*_VSTD::forward<_A0>(__a0)).*__f);
@@ -2853,6 +2857,7 @@
 // bullet 5
 
 template <class _Fp, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
 auto
 __invoke(_Fp&& __f, _Args&& ...__args)
     -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));
diff --git a/include/utility b/include/utility
index a0e16a7..df693ec 100644
--- a/include/utility
+++ b/include/utility
@@ -419,7 +419,7 @@
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
-template <class _Tp> class reference_wrapper;
+template <class _Tp> class _LIBCPP_VISIBLE reference_wrapper;
 
 template <class _Tp>
 struct ___make_pair_return
diff --git a/include/valarray b/include/valarray
index 01b071b..4091d0f 100644
--- a/include/valarray
+++ b/include/valarray
@@ -354,7 +354,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template<class _Tp> class valarray;
+template<class _Tp> class _LIBCPP_VISIBLE valarray;
 
 class _LIBCPP_VISIBLE slice
 {
@@ -381,25 +381,29 @@
     _LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
 };
 
-template <class _Tp> class slice_array;
-class gslice;
-template <class _Tp> class gslice_array;
-template <class _Tp> class mask_array;
-template <class _Tp> class indirect_array;
+template <class _Tp> class _LIBCPP_VISIBLE slice_array;
+class _LIBCPP_VISIBLE gslice;
+template <class _Tp> class _LIBCPP_VISIBLE gslice_array;
+template <class _Tp> class _LIBCPP_VISIBLE mask_array;
+template <class _Tp> class _LIBCPP_VISIBLE indirect_array;
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 begin(valarray<_Tp>& __v);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 const _Tp*
 begin(const valarray<_Tp>& __v);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 _Tp*
 end(valarray<_Tp>& __v);
 
 template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
 const _Tp*
 end(const valarray<_Tp>& __v);