From c950e77d1d0431b9fa9144e9ea7eaa858d8e032e Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 17 Dec 2010 14:46:43 +0000 Subject: [PATCH] Effort to reduce the number of exported symbols llvm-svn: 122057 --- libcxx/include/__config | 2 +- libcxx/include/__locale | 3 +- libcxx/include/ios | 48 +++++++++++++++++--------- libcxx/include/locale | 20 +---------- libcxx/include/string | 70 +++++++++++++++++++++++++++++++------- libcxx/include/thread | 2 +- libcxx/include/vector | 57 ++++++++++++++++++------------- libcxx/lib/buildit | 2 ++ libcxx/lib/libc++unexp.exp | 19 +++++++++++ libcxx/src/thread.cpp | 21 ++++++++++-- 10 files changed, 166 insertions(+), 78 deletions(-) create mode 100644 libcxx/lib/libc++unexp.exp diff --git a/libcxx/include/__config b/libcxx/include/__config index 4af9bec77418..2b590cc8d753 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -82,7 +82,7 @@ #define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) -#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) +#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) #if defined(__clang__) diff --git a/libcxx/include/__locale b/libcxx/include/__locale index 790d37ab5b4a..67f191c0ab20 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -55,7 +55,8 @@ public: explicit locale(const string&); locale(const locale&, const char*, category); locale(const locale&, const string&, category); - template locale(const locale&, _Facet*); + template + _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*); locale(const locale&, const locale&, category); ~locale() throw(); diff --git a/libcxx/include/ios b/libcxx/include/ios index bd81a6605bb2..b0e7ab96346e 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -272,16 +272,16 @@ public: class Init; // 27.5.2.2 fmtflags state: - fmtflags flags() const; - fmtflags flags(fmtflags __fmtfl); - fmtflags setf(fmtflags __fmtfl); - fmtflags setf(fmtflags __fmtfl, fmtflags __mask); - void unsetf(fmtflags __mask); + _LIBCPP_INLINE_VISIBILITY fmtflags flags() const; + _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl); + _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl); + _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask); + _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask); - streamsize precision() const; - streamsize precision(streamsize __prec); - streamsize width() const; - streamsize width(streamsize __wide); + _LIBCPP_INLINE_VISIBILITY streamsize precision() const; + _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec); + _LIBCPP_INLINE_VISIBILITY streamsize width() const; + _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide); // 27.5.2.3 locales: locale imbue(const locale& __loc); @@ -307,17 +307,17 @@ private: public: static bool sync_with_stdio(bool __sync = true); - iostate rdstate() const; + _LIBCPP_INLINE_VISIBILITY iostate rdstate() const; void clear(iostate __state = goodbit); - void setstate(iostate __state); + _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state); - bool good() const; - bool eof() const; - bool fail() const; - bool bad() const; + _LIBCPP_INLINE_VISIBILITY bool good() const; + _LIBCPP_INLINE_VISIBILITY bool eof() const; + _LIBCPP_INLINE_VISIBILITY bool fail() const; + _LIBCPP_INLINE_VISIBILITY bool bad() const; - iostate exceptions() const; - void exceptions(iostate __except); + _LIBCPP_INLINE_VISIBILITY iostate exceptions() const; + _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except); void __set_badbit_and_consider_rethrow(); void __set_failbit_and_consider_rethrow(); @@ -587,38 +587,52 @@ public: _LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);} // 27.5.4.1 Constructor/destructor: + _LIBCPP_INLINE_VISIBILITY explicit basic_ios(basic_streambuf* __sb); virtual ~basic_ios(); // 27.5.4.2 Members: + _LIBCPP_INLINE_VISIBILITY basic_ostream* tie() const; + _LIBCPP_INLINE_VISIBILITY basic_ostream* tie(basic_ostream* __tiestr); + _LIBCPP_INLINE_VISIBILITY basic_streambuf* rdbuf() const; + _LIBCPP_INLINE_VISIBILITY basic_streambuf* rdbuf(basic_streambuf* __sb); basic_ios& copyfmt(const basic_ios& __rhs); + _LIBCPP_INLINE_VISIBILITY char_type fill() const; + _LIBCPP_INLINE_VISIBILITY char_type fill(char_type __ch); + _LIBCPP_INLINE_VISIBILITY locale imbue(const locale& __loc); + _LIBCPP_INLINE_VISIBILITY char narrow(char_type __c, char __dfault) const; + _LIBCPP_INLINE_VISIBILITY char_type widen(char __c) const; protected: _LIBCPP_ALWAYS_INLINE basic_ios() {// purposefully does no initialization } + _LIBCPP_INLINE_VISIBILITY void init(basic_streambuf* __sb); + _LIBCPP_INLINE_VISIBILITY void move(basic_ios& __rhs); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_ALWAYS_INLINE void move(basic_ios&& __rhs) {move(__rhs);} #endif + _LIBCPP_INLINE_VISIBILITY void swap(basic_ios& __rhs); + _LIBCPP_INLINE_VISIBILITY void set_rdbuf(basic_streambuf* __sb); private: basic_ostream* __tie_; diff --git a/libcxx/include/locale b/libcxx/include/locale index 60aab1d84bf0..b88c6ac3e44d 100644 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -1768,7 +1768,7 @@ public: }; template -class __time_get_c_storage +class __time_get_c_storage // purposefully not decorated { protected: typedef basic_string<_CharT> string_type; @@ -2650,24 +2650,15 @@ protected: _LIBCPP_ALWAYS_INLINE ~moneypunct() {} - _LIBCPP_ALWAYS_INLINE virtual char_type do_decimal_point() const {return numeric_limits::max();} - _LIBCPP_ALWAYS_INLINE virtual char_type do_thousands_sep() const {return numeric_limits::max();} - _LIBCPP_ALWAYS_INLINE virtual string do_grouping() const {return string();} - _LIBCPP_ALWAYS_INLINE virtual string_type do_curr_symbol() const {return string_type();} - _LIBCPP_ALWAYS_INLINE virtual string_type do_positive_sign() const {return string_type();} - _LIBCPP_ALWAYS_INLINE virtual string_type do_negative_sign() const {return string_type(1, '-');} - _LIBCPP_ALWAYS_INLINE virtual int do_frac_digits() const {return 0;} - _LIBCPP_ALWAYS_INLINE virtual pattern do_pos_format() const {pattern __p = {symbol, sign, none, value}; return __p;} - _LIBCPP_ALWAYS_INLINE virtual pattern do_neg_format() const {pattern __p = {symbol, sign, none, value}; return __p;} }; @@ -2704,23 +2695,14 @@ protected: _LIBCPP_ALWAYS_INLINE ~moneypunct_byname() {} - _LIBCPP_ALWAYS_INLINE virtual char_type do_decimal_point() const {return __decimal_point_;} - _LIBCPP_ALWAYS_INLINE virtual char_type do_thousands_sep() const {return __thousands_sep_;} - _LIBCPP_ALWAYS_INLINE virtual string do_grouping() const {return __grouping_;} - _LIBCPP_ALWAYS_INLINE virtual string_type do_curr_symbol() const {return __curr_symbol_;} - _LIBCPP_ALWAYS_INLINE virtual string_type do_positive_sign() const {return __positive_sign_;} - _LIBCPP_ALWAYS_INLINE virtual string_type do_negative_sign() const {return __negative_sign_;} - _LIBCPP_ALWAYS_INLINE virtual int do_frac_digits() const {return __frac_digits_;} - _LIBCPP_ALWAYS_INLINE virtual pattern do_pos_format() const {return __pos_format_;} - _LIBCPP_ALWAYS_INLINE virtual pattern do_neg_format() const {return __neg_format_;} private: diff --git a/libcxx/include/string b/libcxx/include/string index 3056a6bbe460..92f0ed19f777 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -1028,33 +1028,43 @@ private: public: static const size_type npos = -1; - basic_string(); - explicit basic_string(const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY basic_string(); + _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a); basic_string(const basic_string& __str); basic_string(const basic_string& __str, const allocator_type& __a); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES basic_string(basic_string&& __str); basic_string(basic_string&& __str, const allocator_type& __a); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - basic_string(const_pointer __s); + _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s); + _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s, size_type __n); + _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s, size_type __n, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY basic_string(size_type __n, value_type __c); + _LIBCPP_INLINE_VISIBILITY basic_string(size_type __n, value_type __c, const allocator_type& __a); basic_string(const basic_string& __str, size_type __pos, size_type __n = npos, const allocator_type& __a = allocator_type()); template + _LIBCPP_INLINE_VISIBILITY basic_string(_InputIterator __first, _InputIterator __last); template + _LIBCPP_INLINE_VISIBILITY basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list __il); + _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list __il, const allocator_type& __a); ~basic_string(); basic_string& operator=(const basic_string& __str); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_string& operator=(basic_string&& __str); #endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);} @@ -1086,7 +1096,7 @@ public: _LIBCPP_INLINE_VISIBILITY size_type size() const {return __is_long() ? __get_long_size() : __get_short_size();} _LIBCPP_INLINE_VISIBILITY size_type length() const {return size();} - size_type max_size() const; + _LIBCPP_INLINE_VISIBILITY size_type max_size() const; _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return (__is_long() ? __get_long_cap() : __min_cap) - 1;} @@ -1096,6 +1106,7 @@ public: void reserve(size_type res_arg = 0); _LIBCPP_INLINE_VISIBILITY void shrink_to_fit() {reserve();} + _LIBCPP_INLINE_VISIBILITY void clear(); _LIBCPP_INLINE_VISIBILITY bool empty() const {return size() == 0;} @@ -1110,6 +1121,7 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list __il) {return append(__il);} + _LIBCPP_INLINE_VISIBILITY basic_string& append(const basic_string& __str); basic_string& append(const basic_string& __str, size_type __pos, size_type __n); basic_string& append(const_pointer __s, size_type __n); @@ -1134,12 +1146,14 @@ public: basic_string& append(initializer_list __il) {return append(__il.begin(), __il.size());} void push_back(value_type __c); + _LIBCPP_INLINE_VISIBILITY void pop_back(); - reference front(); - const_reference front() const; - reference back(); - const_reference back() const; + _LIBCPP_INLINE_VISIBILITY reference front(); + _LIBCPP_INLINE_VISIBILITY const_reference front() const; + _LIBCPP_INLINE_VISIBILITY reference back(); + _LIBCPP_INLINE_VISIBILITY const_reference back() const; + _LIBCPP_INLINE_VISIBILITY basic_string& assign(const basic_string& __str); basic_string& assign(const basic_string& __str, size_type __pos, size_type __n); basic_string& assign(const_pointer __s, size_type __n); @@ -1163,12 +1177,14 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& assign(initializer_list __il) {return assign(__il.begin(), __il.size());} + _LIBCPP_INLINE_VISIBILITY basic_string& insert(size_type __pos1, const basic_string& __str); basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n); basic_string& insert(size_type __pos, const_pointer __s, size_type __n); basic_string& insert(size_type __pos, const_pointer __s); basic_string& insert(size_type __pos, size_type __n, value_type __c); iterator insert(const_iterator __pos, value_type __c); + _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __pos, size_type __n, value_type __c); template typename enable_if @@ -1190,17 +1206,24 @@ public: {return insert(__pos, __il.begin(), __il.end());} basic_string& erase(size_type __pos = 0, size_type __n = npos); + _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __pos); + _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __first, const_iterator __last); + _LIBCPP_INLINE_VISIBILITY basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str); basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2); basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2); basic_string& replace(size_type __pos, size_type __n1, const_pointer __s); basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); + _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str); + _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n); + _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s); + _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c); template typename enable_if @@ -1214,8 +1237,10 @@ public: {return replace(__i1, __i2, __il.begin(), __il.end());} size_type copy(pointer __s, size_type __n, size_type __pos = 0) const; + _LIBCPP_INLINE_VISIBILITY basic_string substr(size_type __pos = 0, size_type __n = npos) const; + _LIBCPP_INLINE_VISIBILITY void swap(basic_string& __str); _LIBCPP_INLINE_VISIBILITY const_pointer c_str() const {return data();} @@ -1223,44 +1248,62 @@ public: _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return __alloc();} + _LIBCPP_INLINE_VISIBILITY size_type find(const basic_string& __str, size_type __pos = 0) const; size_type find(const_pointer __s, size_type __pos, size_type __n) const; + _LIBCPP_INLINE_VISIBILITY size_type find(const_pointer __s, size_type __pos = 0) const; size_type find(value_type __c, size_type __pos = 0) const; + _LIBCPP_INLINE_VISIBILITY size_type rfind(const basic_string& __str, size_type __pos = npos) const; size_type rfind(const_pointer __s, size_type __pos, size_type __n) const; + _LIBCPP_INLINE_VISIBILITY size_type rfind(const_pointer __s, size_type __pos = npos) const; size_type rfind(value_type __c, size_type __pos = npos) const; + _LIBCPP_INLINE_VISIBILITY size_type find_first_of(const basic_string& __str, size_type __pos = 0) const; size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const; + _LIBCPP_INLINE_VISIBILITY size_type find_first_of(const_pointer __s, size_type __pos = 0) const; + _LIBCPP_INLINE_VISIBILITY size_type find_first_of(value_type __c, size_type __pos = 0) const; + _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const basic_string& __str, size_type __pos = npos) const; size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const; + _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const_pointer __s, size_type __pos = npos) const; + _LIBCPP_INLINE_VISIBILITY size_type find_last_of(value_type __c, size_type __pos = npos) const; + _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const; size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const; + _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const; + _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(value_type __c, size_type __pos = 0) const; + _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const; size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const; + _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const; + _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(value_type __c, size_type __pos = npos) const; + _LIBCPP_INLINE_VISIBILITY int compare(const basic_string& __str) const; + _LIBCPP_INLINE_VISIBILITY int compare(size_type __pos1, size_type __n1, const basic_string& __str) const; int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const; int compare(const_pointer __s) const; int compare(size_type __pos1, size_type __n1, const_pointer __s) const; int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const; - bool __invariants() const; + _LIBCPP_INLINE_VISIBILITY bool __invariants() const; private: _LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __r_.second();} _LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __r_.second();} @@ -1338,6 +1381,7 @@ private: size_type __n_copy, size_type __n_del, size_type __n_add, const_pointer __p_new_stuff); + _LIBCPP_INLINE_VISIBILITY void __erase_to_end(size_type __pos); _LIBCPP_INLINE_VISIBILITY @@ -1361,7 +1405,9 @@ private: {} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY void __move_assign(basic_string& __str, false_type); + _LIBCPP_INLINE_VISIBILITY void __move_assign(basic_string& __str, true_type); #endif @@ -1380,8 +1426,8 @@ private: static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) {} - void __invalidate_all_iterators(); - void __invalidate_iterators_past(size_type); + _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); + _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type); friend basic_string operator+<>(const basic_string&, const basic_string&); friend basic_string operator+<>(const value_type*, const basic_string&); @@ -1741,7 +1787,6 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list -_LIBCPP_INLINE_VISIBILITY inline basic_string<_CharT, _Traits, _Allocator>::~basic_string() { __invalidate_all_iterators(); @@ -3204,6 +3249,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type _ // __invariants template +_LIBCPP_INLINE_VISIBILITY inline bool basic_string<_CharT, _Traits, _Allocator>::__invariants() const { diff --git a/libcxx/include/thread b/libcxx/include/thread index abb56f4cb6c0..8b3edb7f62dd 100644 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -297,7 +297,7 @@ public: class __assoc_sub_state; -class __thread_struct_imp; +class _LIBCPP_HIDDEN __thread_struct_imp; class __thread_struct { diff --git a/libcxx/include/vector b/libcxx/include/vector index 074e44546afd..9b9f2e815edb 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -318,8 +318,8 @@ protected: _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();} _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();} - __vector_base(); - __vector_base(const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY __vector_base(); + _LIBCPP_INLINE_VISIBILITY __vector_base(const allocator_type& __a); ~__vector_base(); _LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);} @@ -327,8 +327,8 @@ protected: _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last) {__destruct_at_end(__new_last, is_trivially_destructible());} - void __destruct_at_end(const_pointer __new_last, false_type); - void __destruct_at_end(const_pointer __new_last, true_type); + _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, false_type); + _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, true_type); _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const __vector_base& __c) @@ -484,7 +484,9 @@ public: template vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0); + _LIBCPP_INLINE_VISIBILITY vector(initializer_list __il); + _LIBCPP_INLINE_VISIBILITY vector(initializer_list __il, const allocator_type& __a); #ifdef _LIBCPP_DEBUG _LIBCPP_INLINE_VISIBILITY @@ -493,10 +495,14 @@ public: vector(const vector& __x); vector(const vector& __x, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY vector& operator=(const vector& __x); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY vector(vector&& __x); + _LIBCPP_INLINE_VISIBILITY vector(vector&& __x, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY @@ -526,10 +532,10 @@ public: _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return this->__alloc();} - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; + _LIBCPP_INLINE_VISIBILITY iterator begin(); + _LIBCPP_INLINE_VISIBILITY const_iterator begin() const; + _LIBCPP_INLINE_VISIBILITY iterator end(); + _LIBCPP_INLINE_VISIBILITY const_iterator end() const; _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} @@ -563,7 +569,7 @@ public: _LIBCPP_INLINE_VISIBILITY const value_type* data() const {return _STD::__to_raw_pointer(this->__begin_);} - void push_back(const_reference __x); + _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES void push_back(value_type&& __x); #ifndef _LIBCPP_HAS_NO_VARIADICS @@ -601,7 +607,7 @@ public: iterator insert(const_iterator __position, initializer_list __il) {return insert(__position, __il.begin(), __il.end());} - iterator erase(const_iterator __position); + _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); _LIBCPP_INLINE_VISIBILITY void clear() {__base::clear();} @@ -614,15 +620,17 @@ public: bool __invariants() const; private: - void __invalidate_all_iterators(); + _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); void allocate(size_type __n); void deallocate(); - size_type __recommend(size_type __new_size) const; - void __construct_at_end(size_type __n); + _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; + _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n); void __construct_at_end(size_type __n, false_type); - void __construct_at_end(size_type __n, true_type); + _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, true_type); + _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, const_reference __x); - void __construct_at_end(size_type __n, const_reference __x, false_type); + void __construct_at_end(size_type __n, const_reference __x, false_type); + _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, const_reference __x, true_type); template typename enable_if @@ -634,7 +642,9 @@ private: void __move_construct_at_end(pointer __first, pointer __last); void __append(size_type __n); void __append(size_type __n, const_reference __x); + _LIBCPP_INLINE_VISIBILITY iterator __make_iter(pointer __p); + _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(const_pointer __p) const; void __swap_out_circular_buffer(__split_buffer& __v); pointer __swap_out_circular_buffer(__split_buffer& __v, pointer __p); @@ -1757,8 +1767,8 @@ private: {return (__n - 1) / __bits_per_word + 1;} public: - vector(); - explicit vector(const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY vector(); + _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a); ~vector(); explicit vector(size_type __n); vector(size_type __n, const value_type& __v); @@ -1785,9 +1795,9 @@ public: vector(initializer_list __il, const allocator_type& __a); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - vector(vector&& __v); + _LIBCPP_INLINE_VISIBILITY vector(vector&& __v); vector(vector&& __v, const allocator_type& __a); - vector& operator=(vector&& __v); + _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list __il) @@ -1874,7 +1884,7 @@ public: iterator insert(const_iterator __position, initializer_list __il) {return insert(__position, __il.begin(), __il.end());} - iterator erase(const_iterator __position); + _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); _LIBCPP_INLINE_VISIBILITY void clear() {__size_ = 0;} @@ -1887,13 +1897,13 @@ public: bool __invariants() const; private: - void __invalidate_all_iterators(); + _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); void allocate(size_type __n); void deallocate(); _LIBCPP_INLINE_VISIBILITY static size_type __align(size_type __new_size) {return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);}; - size_type __recommend(size_type __new_size) const; - void __construct_at_end(size_type __n, bool __x); + _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; + _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x); template typename enable_if < @@ -2250,7 +2260,6 @@ vector::vector(initializer_list __il, const alloca } template -_LIBCPP_INLINE_VISIBILITY inline vector::~vector() { if (__begin_ != 0) diff --git a/libcxx/lib/buildit b/libcxx/lib/buildit index db22942831bd..e296f0218205 100755 --- a/libcxx/lib/buildit +++ b/libcxx/lib/buildit @@ -41,6 +41,7 @@ case $TRIPLE in -compatibility_version 1 \ -install_name /usr/lib/libc++.dylib \ -Wl,-reexport_library,/usr/lib/libc++abi.dylib \ + -Wl,-unexported_symbols_list,libc++unexp.exp \ /usr/lib/libSystem.B.dylib" else LDSHARED_FLAGS="-o libc++.1.dylib \ @@ -49,6 +50,7 @@ case $TRIPLE in -install_name /usr/lib/libc++.dylib \ ${SDKROOT}/usr/lib/libc++abi.dylib \ -lSystem \ + -Wl,-unexported_symbols_list,libc++unexp.exp \ -Wl,-reexported_symbols_list,libc++abi.exp \ -Wl,-force_symbols_not_weak_list,notweak.exp" fi diff --git a/libcxx/lib/libc++unexp.exp b/libcxx/lib/libc++unexp.exp new file mode 100644 index 000000000000..9507fc57f184 --- /dev/null +++ b/libcxx/lib/libc++unexp.exp @@ -0,0 +1,19 @@ +# all guard variables +__ZGVNSt3__* +# all vtables +# __ZTV* +# all VTT +# __ZTT* +# all non-virtual thunks +# __ZTh* +# all virtual thunks +# __ZTv* +# typeinfo for std::__1::__types +# There are no std::__types +# __ZTINSt3__1[0-9][0-9]*__* +# typeinfo name for std::__1::__types +__ZTSNSt3__1[0-9][0-9]*__* +# anything using __hidden_allocator +*__hidden_allocator* +# anything using __sso_allocator +*__sso_allocator* diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp index 15ab40e3e821..4ccff3277f53 100644 --- a/libcxx/src/thread.cpp +++ b/libcxx/src/thread.cpp @@ -92,10 +92,25 @@ __thread_local_data() // __thread_struct_imp -class __thread_struct_imp +template +class _LIBCPP_HIDDEN __hidden_allocator { - typedef vector<__assoc_sub_state*> _AsyncStates; - typedef vector > _Notify; +public: + typedef T value_type; + + T* allocate(size_t __n) + {return static_cast(::operator new(__n * sizeof(T)));} + void deallocate(T* __p, size_t) {::operator delete((void*)__p);} + + size_t max_size() const {return size_t(~0) / sizeof(T);} +}; + +class _LIBCPP_HIDDEN __thread_struct_imp +{ + typedef vector<__assoc_sub_state*, + __hidden_allocator<__assoc_sub_state*> > _AsyncStates; + typedef vector, + __hidden_allocator > > _Notify; _AsyncStates async_states_; _Notify notify_;