Skip to content

Commit 943d225

Browse files
committed
[NFC][libc++] Use _LIBCPP_HIDE_FROM_ABI.
This updates the new __system_error directory. Reviewed By: #libc, philnik Differential Revision: https://reviews.llvm.org/D148028
1 parent 49a813b commit 943d225

File tree

4 files changed

+39
-40
lines changed

4 files changed

+39
-40
lines changed

libcxx/include/__system_error/error_category.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class _LIBCPP_TYPE_VIS error_category {
3232
#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS)
3333
error_category() noexcept;
3434
#else
35-
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default;
35+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default;
3636
#endif
3737
error_category(const error_category&) = delete;
3838
error_category& operator=(const error_category&) = delete;
@@ -43,7 +43,7 @@ class _LIBCPP_TYPE_VIS error_category {
4343
virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
4444
virtual string message(int __ev) const = 0;
4545

46-
_LIBCPP_INLINE_VISIBILITY bool operator==(const error_category& __rhs) const _NOEXCEPT { return this == &__rhs; }
46+
_LIBCPP_HIDE_FROM_ABI bool operator==(const error_category& __rhs) const _NOEXCEPT { return this == &__rhs; }
4747

4848
#if _LIBCPP_STD_VER >= 20
4949

@@ -53,9 +53,9 @@ class _LIBCPP_TYPE_VIS error_category {
5353

5454
#else // _LIBCPP_STD_VER >= 20
5555

56-
_LIBCPP_INLINE_VISIBILITY bool operator!=(const error_category& __rhs) const _NOEXCEPT { return !(*this == __rhs); }
56+
_LIBCPP_HIDE_FROM_ABI bool operator!=(const error_category& __rhs) const _NOEXCEPT { return !(*this == __rhs); }
5757

58-
_LIBCPP_INLINE_VISIBILITY bool operator<(const error_category& __rhs) const _NOEXCEPT { return this < &__rhs; }
58+
_LIBCPP_HIDE_FROM_ABI bool operator<(const error_category& __rhs) const _NOEXCEPT { return this < &__rhs; }
5959

6060
#endif // _LIBCPP_STD_VER >= 20
6161

libcxx/include/__system_error/error_code.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,83 +45,81 @@ class _LIBCPP_TYPE_VIS error_code {
4545
const error_category* __cat_;
4646

4747
public:
48-
_LIBCPP_INLINE_VISIBILITY error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {}
48+
_LIBCPP_HIDE_FROM_ABI error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {}
4949

50-
_LIBCPP_INLINE_VISIBILITY error_code(int __val, const error_category& __cat) _NOEXCEPT
51-
: __val_(__val),
52-
__cat_(&__cat) {}
50+
_LIBCPP_HIDE_FROM_ABI error_code(int __val, const error_category& __cat) _NOEXCEPT : __val_(__val), __cat_(&__cat) {}
5351

5452
template <class _Ep>
55-
_LIBCPP_INLINE_VISIBILITY
53+
_LIBCPP_HIDE_FROM_ABI
5654
error_code(_Ep __e, typename enable_if<is_error_code_enum<_Ep>::value>::type* = nullptr) _NOEXCEPT {
5755
using __adl_only::make_error_code;
5856
*this = make_error_code(__e);
5957
}
6058

61-
_LIBCPP_INLINE_VISIBILITY void assign(int __val, const error_category& __cat) _NOEXCEPT {
59+
_LIBCPP_HIDE_FROM_ABI void assign(int __val, const error_category& __cat) _NOEXCEPT {
6260
__val_ = __val;
6361
__cat_ = &__cat;
6462
}
6563

6664
template <class _Ep>
67-
_LIBCPP_INLINE_VISIBILITY typename enable_if< is_error_code_enum<_Ep>::value, error_code& >::type
65+
_LIBCPP_HIDE_FROM_ABI typename enable_if< is_error_code_enum<_Ep>::value, error_code& >::type
6866
operator=(_Ep __e) _NOEXCEPT {
6967
using __adl_only::make_error_code;
7068
*this = make_error_code(__e);
7169
return *this;
7270
}
7371

74-
_LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {
72+
_LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT {
7573
__val_ = 0;
7674
__cat_ = &system_category();
7775
}
7876

79-
_LIBCPP_INLINE_VISIBILITY int value() const _NOEXCEPT { return __val_; }
77+
_LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; }
8078

81-
_LIBCPP_INLINE_VISIBILITY const error_category& category() const _NOEXCEPT { return *__cat_; }
79+
_LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; }
8280

83-
_LIBCPP_INLINE_VISIBILITY error_condition default_error_condition() const _NOEXCEPT {
81+
_LIBCPP_HIDE_FROM_ABI error_condition default_error_condition() const _NOEXCEPT {
8482
return __cat_->default_error_condition(__val_);
8583
}
8684

8785
string message() const;
8886

89-
_LIBCPP_INLINE_VISIBILITY explicit operator bool() const _NOEXCEPT { return __val_ != 0; }
87+
_LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __val_ != 0; }
9088
};
9189

92-
inline _LIBCPP_INLINE_VISIBILITY error_code make_error_code(errc __e) _NOEXCEPT {
90+
inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(errc __e) _NOEXCEPT {
9391
return error_code(static_cast<int>(__e), generic_category());
9492
}
9593

96-
inline _LIBCPP_INLINE_VISIBILITY bool operator==(const error_code& __x, const error_code& __y) _NOEXCEPT {
94+
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_code& __x, const error_code& __y) _NOEXCEPT {
9795
return __x.category() == __y.category() && __x.value() == __y.value();
9896
}
9997

100-
inline _LIBCPP_INLINE_VISIBILITY bool operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT {
98+
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT {
10199
return __x.category().equivalent(__x.value(), __y) || __y.category().equivalent(__x, __y.value());
102100
}
103101

104102
#if _LIBCPP_STD_VER <= 17
105-
inline _LIBCPP_INLINE_VISIBILITY bool operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT {
103+
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT {
106104
return __y == __x;
107105
}
108106
#endif
109107

110108
#if _LIBCPP_STD_VER <= 17
111109

112-
inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT {
110+
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT {
113111
return !(__x == __y);
114112
}
115113

116-
inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT {
114+
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT {
117115
return !(__x == __y);
118116
}
119117

120-
inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT {
118+
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT {
121119
return !(__x == __y);
122120
}
123121

124-
inline _LIBCPP_INLINE_VISIBILITY bool operator<(const error_code& __x, const error_code& __y) _NOEXCEPT {
122+
inline _LIBCPP_HIDE_FROM_ABI bool operator<(const error_code& __x, const error_code& __y) _NOEXCEPT {
125123
return __x.category() < __y.category() || (__x.category() == __y.category() && __x.value() < __y.value());
126124
}
127125

@@ -137,7 +135,7 @@ inline _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const error_code& __x,
137135

138136
template <>
139137
struct _LIBCPP_TEMPLATE_VIS hash<error_code> : public __unary_function<error_code, size_t> {
140-
_LIBCPP_INLINE_VISIBILITY size_t operator()(const error_code& __ec) const _NOEXCEPT {
138+
_LIBCPP_HIDE_FROM_ABI size_t operator()(const error_code& __ec) const _NOEXCEPT {
141139
return static_cast<size_t>(__ec.value());
142140
}
143141
};

libcxx/include/__system_error/error_condition.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,60 +51,60 @@ class _LIBCPP_TYPE_VIS error_condition {
5151
const error_category* __cat_;
5252

5353
public:
54-
_LIBCPP_INLINE_VISIBILITY error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {}
54+
_LIBCPP_HIDE_FROM_ABI error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {}
5555

56-
_LIBCPP_INLINE_VISIBILITY error_condition(int __val, const error_category& __cat) _NOEXCEPT
56+
_LIBCPP_HIDE_FROM_ABI error_condition(int __val, const error_category& __cat) _NOEXCEPT
5757
: __val_(__val),
5858
__cat_(&__cat) {}
5959

6060
template <class _Ep>
61-
_LIBCPP_INLINE_VISIBILITY
61+
_LIBCPP_HIDE_FROM_ABI
6262
error_condition(_Ep __e, typename enable_if<is_error_condition_enum<_Ep>::value>::type* = nullptr) _NOEXCEPT {
6363
using __adl_only::make_error_condition;
6464
*this = make_error_condition(__e);
6565
}
6666

67-
_LIBCPP_INLINE_VISIBILITY void assign(int __val, const error_category& __cat) _NOEXCEPT {
67+
_LIBCPP_HIDE_FROM_ABI void assign(int __val, const error_category& __cat) _NOEXCEPT {
6868
__val_ = __val;
6969
__cat_ = &__cat;
7070
}
7171

7272
template <class _Ep>
73-
_LIBCPP_INLINE_VISIBILITY typename enable_if< is_error_condition_enum<_Ep>::value, error_condition& >::type
73+
_LIBCPP_HIDE_FROM_ABI typename enable_if< is_error_condition_enum<_Ep>::value, error_condition& >::type
7474
operator=(_Ep __e) _NOEXCEPT {
7575
using __adl_only::make_error_condition;
7676
*this = make_error_condition(__e);
7777
return *this;
7878
}
7979

80-
_LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {
80+
_LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT {
8181
__val_ = 0;
8282
__cat_ = &generic_category();
8383
}
8484

85-
_LIBCPP_INLINE_VISIBILITY int value() const _NOEXCEPT { return __val_; }
85+
_LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; }
8686

87-
_LIBCPP_INLINE_VISIBILITY const error_category& category() const _NOEXCEPT { return *__cat_; }
87+
_LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; }
8888
string message() const;
8989

90-
_LIBCPP_INLINE_VISIBILITY explicit operator bool() const _NOEXCEPT { return __val_ != 0; }
90+
_LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __val_ != 0; }
9191
};
9292

93-
inline _LIBCPP_INLINE_VISIBILITY error_condition make_error_condition(errc __e) _NOEXCEPT {
93+
inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(errc __e) _NOEXCEPT {
9494
return error_condition(static_cast<int>(__e), generic_category());
9595
}
9696

97-
inline _LIBCPP_INLINE_VISIBILITY bool operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT {
97+
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT {
9898
return __x.category() == __y.category() && __x.value() == __y.value();
9999
}
100100

101101
#if _LIBCPP_STD_VER <= 17
102102

103-
inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT {
103+
inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT {
104104
return !(__x == __y);
105105
}
106106

107-
inline _LIBCPP_INLINE_VISIBILITY bool operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT {
107+
inline _LIBCPP_HIDE_FROM_ABI bool operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT {
108108
return __x.category() < __y.category() || (__x.category() == __y.category() && __x.value() < __y.value());
109109
}
110110

@@ -121,7 +121,7 @@ operator<=>(const error_condition& __x, const error_condition& __y) noexcept {
121121

122122
template <>
123123
struct _LIBCPP_TEMPLATE_VIS hash<error_condition> : public __unary_function<error_condition, size_t> {
124-
_LIBCPP_INLINE_VISIBILITY size_t operator()(const error_condition& __ec) const _NOEXCEPT {
124+
_LIBCPP_HIDE_FROM_ABI size_t operator()(const error_condition& __ec) const _NOEXCEPT {
125125
return static_cast<size_t>(__ec.value());
126126
}
127127
};

libcxx/include/__system_error/system_error.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class _LIBCPP_TYPE_VIS system_error : public runtime_error {
3535
system_error(const system_error&) _NOEXCEPT = default;
3636
~system_error() _NOEXCEPT override;
3737

38-
_LIBCPP_INLINE_VISIBILITY const error_code& code() const _NOEXCEPT { return __ec_; }
38+
_LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
3939

4040
private:
4141
static string __init(const error_code&, string);
@@ -44,4 +44,5 @@ class _LIBCPP_TYPE_VIS system_error : public runtime_error {
4444
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_system_error(int __ev, const char* __what_arg);
4545

4646
_LIBCPP_END_NAMESPACE_STD
47+
4748
#endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H

0 commit comments

Comments
 (0)