Skip to content

Commit 43126f7

Browse files
[libc] address lntue's comments
1 parent 01fc5d5 commit 43126f7

File tree

10 files changed

+30
-30
lines changed

10 files changed

+30
-30
lines changed

libc/src/__support/CPP/algorithm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ template <class T = void> struct bit_or {};
2525
template <class T = void> struct bit_xor {};
2626

2727
template <class T>
28-
LIBC_INLINE constexpr const T &max(LIBC_LIFETIMEBOUND const T &a,
29-
LIBC_LIFETIMEBOUND const T &b) {
28+
LIBC_INLINE constexpr const T &max(LIBC_LIFETIME_BOUND const T &a,
29+
LIBC_LIFETIME_BOUND const T &b) {
3030
return (a < b) ? b : a;
3131
}
3232

3333
template <class T>
34-
LIBC_INLINE constexpr const T &min(LIBC_LIFETIMEBOUND const T &a,
35-
LIBC_LIFETIMEBOUND const T &b) {
34+
LIBC_INLINE constexpr const T &min(LIBC_LIFETIME_BOUND const T &a,
35+
LIBC_LIFETIME_BOUND const T &b) {
3636
return (a < b) ? a : b;
3737
}
3838

libc/src/__support/CPP/array.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ template <class T, size_t N> struct array {
3131
LIBC_INLINE constexpr T *data() { return Data; }
3232
LIBC_INLINE constexpr const T *data() const { return Data; }
3333

34-
LIBC_INLINE constexpr T &front() LIBC_LIFETIMEBOUND { return Data[0]; }
35-
LIBC_INLINE constexpr const T &front() const LIBC_LIFETIMEBOUND {
34+
LIBC_INLINE constexpr T &front() LIBC_LIFETIME_BOUND { return Data[0]; }
35+
LIBC_INLINE constexpr const T &front() const LIBC_LIFETIME_BOUND {
3636
return Data[0];
3737
}
3838

39-
LIBC_INLINE constexpr T &back() LIBC_LIFETIMEBOUND { return Data[N - 1]; }
40-
LIBC_INLINE constexpr const T &back() const LIBC_LIFETIMEBOUND {
39+
LIBC_INLINE constexpr T &back() LIBC_LIFETIME_BOUND { return Data[N - 1]; }
40+
LIBC_INLINE constexpr const T &back() const LIBC_LIFETIME_BOUND {
4141
return Data[N - 1];
4242
}
4343

44-
LIBC_INLINE constexpr T &operator[](size_t Index) LIBC_LIFETIMEBOUND {
44+
LIBC_INLINE constexpr T &operator[](size_t Index) LIBC_LIFETIME_BOUND {
4545
return Data[Index];
4646
}
4747

4848
LIBC_INLINE constexpr const T &
49-
operator[](size_t Index) const LIBC_LIFETIMEBOUND {
49+
operator[](size_t Index) const LIBC_LIFETIME_BOUND {
5050
return Data[Index];
5151
}
5252

libc/src/__support/CPP/mutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ template <typename MutexType> class lock_guard {
2929

3030
public:
3131
// Calls `m.lock()` upon resource acquisition.
32-
LIBC_INLINE explicit lock_guard(LIBC_LIFETIMEBOUND MutexType &m) : mutex(m) {
32+
LIBC_INLINE explicit lock_guard(LIBC_LIFETIME_BOUND MutexType &m) : mutex(m) {
3333
mutex.lock();
3434
}
3535

3636
// Acquires ownership of the mutex object `m` without attempting to lock
3737
// it. The behavior is undefined if the current thread does not hold the
3838
// lock on `m`. Does not call `m.lock()` upon resource acquisition.
39-
LIBC_INLINE lock_guard(LIBC_LIFETIMEBOUND MutexType &m, adopt_lock_t /* t */)
39+
LIBC_INLINE lock_guard(LIBC_LIFETIME_BOUND MutexType &m, adopt_lock_t /* t */)
4040
: mutex(m) {}
4141

4242
LIBC_INLINE ~lock_guard() { mutex.unlock(); }

libc/src/__support/CPP/optional.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ template <typename T> class optional {
108108

109109
LIBC_INLINE constexpr void reset() { storage.reset(); }
110110

111-
LIBC_INLINE constexpr const T &value() const &LIBC_LIFETIMEBOUND {
111+
LIBC_INLINE constexpr const T &value() const &LIBC_LIFETIME_BOUND {
112112
return storage.stored_value;
113113
}
114114

115-
LIBC_INLINE constexpr T &value() & LIBC_LIFETIMEBOUND {
115+
LIBC_INLINE constexpr T &value() & LIBC_LIFETIME_BOUND {
116116
return storage.stored_value;
117117
}
118118

@@ -124,10 +124,10 @@ template <typename T> class optional {
124124
return &storage.stored_value;
125125
}
126126
LIBC_INLINE constexpr T *operator->() { return &storage.stored_value; }
127-
LIBC_INLINE constexpr const T &operator*() const &LIBC_LIFETIMEBOUND {
127+
LIBC_INLINE constexpr const T &operator*() const &LIBC_LIFETIME_BOUND {
128128
return storage.stored_value;
129129
}
130-
LIBC_INLINE constexpr T &operator*() & LIBC_LIFETIMEBOUND {
130+
LIBC_INLINE constexpr T &operator*() & LIBC_LIFETIME_BOUND {
131131
return storage.stored_value;
132132
}
133133

libc/src/__support/CPP/span.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ template <typename T> class LIBC_GSL_POINTER span {
6464

6565
template <typename U, size_t N,
6666
cpp::enable_if_t<is_compatible_v<U>, bool> = true>
67-
LIBC_INLINE constexpr span(LIBC_LIFETIMEBOUND U (&arr)[N])
67+
LIBC_INLINE constexpr span(LIBC_LIFETIME_BOUND U (&arr)[N])
6868
: span_data(arr), span_size(N) {}
6969

7070
template <typename U, size_t N,
7171
cpp::enable_if_t<is_compatible_v<U>, bool> = true>
72-
LIBC_INLINE constexpr span(LIBC_LIFETIMEBOUND array<U, N> &arr)
72+
LIBC_INLINE constexpr span(LIBC_LIFETIME_BOUND array<U, N> &arr)
7373
: span_data(arr.data()), span_size(arr.size()) {}
7474

7575
template <typename U, cpp::enable_if_t<is_compatible_v<U>, bool> = true>

libc/src/__support/CPP/string.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ class string {
106106
LIBC_INLINE constexpr const char *end() const { return data() + size_; }
107107
LIBC_INLINE char *end() { return data() + size_; }
108108

109-
LIBC_INLINE constexpr const char &front() const LIBC_LIFETIMEBOUND {
109+
LIBC_INLINE constexpr const char &front() const LIBC_LIFETIME_BOUND {
110110
return data()[0];
111111
}
112-
LIBC_INLINE char &front() LIBC_LIFETIMEBOUND { return data()[0]; }
112+
LIBC_INLINE char &front() LIBC_LIFETIME_BOUND { return data()[0]; }
113113

114-
LIBC_INLINE constexpr const char &back() const LIBC_LIFETIMEBOUND {
114+
LIBC_INLINE constexpr const char &back() const LIBC_LIFETIME_BOUND {
115115
return data()[size_ - 1];
116116
}
117-
LIBC_INLINE char &back() LIBC_LIFETIMEBOUND { return data()[size_ - 1]; }
117+
LIBC_INLINE char &back() LIBC_LIFETIME_BOUND { return data()[size_ - 1]; }
118118

119119
LIBC_INLINE constexpr const char &
120-
operator[](size_t index) const LIBC_LIFETIMEBOUND {
120+
operator[](size_t index) const LIBC_LIFETIME_BOUND {
121121
return data()[index];
122122
}
123-
LIBC_INLINE char &operator[](size_t index) LIBC_LIFETIMEBOUND {
123+
LIBC_INLINE char &operator[](size_t index) LIBC_LIFETIME_BOUND {
124124
return data()[index];
125125
}
126126

libc/src/__support/CPP/string_view.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class LIBC_GSL_POINTER string_view {
7878
: Data(Str), Len(N) {}
7979

8080
template <size_t N>
81-
LIBC_INLINE constexpr string_view(LIBC_LIFETIMEBOUND const char (&Str)[N])
81+
LIBC_INLINE constexpr string_view(LIBC_LIFETIME_BOUND const char (&Str)[N])
8282
: Data(Str), Len(N) {}
8383

8484
LIBC_INLINE constexpr const char *data() const { return Data; }

libc/src/__support/CPP/utility/forward.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ namespace cpp {
1919
// forward
2020
template <typename T>
2121
LIBC_INLINE constexpr T &&
22-
forward(LIBC_LIFETIMEBOUND remove_reference_t<T> &value) {
22+
forward(LIBC_LIFETIME_BOUND remove_reference_t<T> &value) {
2323
return static_cast<T &&>(value);
2424
}
2525

2626
template <typename T>
2727
LIBC_INLINE constexpr T &&
28-
forward(LIBC_LIFETIMEBOUND remove_reference_t<T> &&value) {
28+
forward(LIBC_LIFETIME_BOUND remove_reference_t<T> &&value) {
2929
static_assert(!is_lvalue_reference_v<T>,
3030
"cannot forward an rvalue as an lvalue");
3131
return static_cast<T &&>(value);

libc/src/__support/CPP/utility/move.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace cpp {
1818
// move
1919
template <class T>
2020
LIBC_INLINE constexpr cpp::remove_reference_t<T> &&
21-
move(LIBC_LIFETIMEBOUND T &&t) {
21+
move(LIBC_LIFETIME_BOUND T &&t) {
2222
return static_cast<typename cpp::remove_reference_t<T> &&>(t);
2323
}
2424

libc/src/__support/macros/attributes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ LIBC_THREAD_MODE_EXTERNAL.
9292
#endif
9393

9494
#if __has_attribute(lifetimebound)
95-
#define LIBC_LIFETIMEBOUND [[clang::lifetimebound]]
95+
#define LIBC_LIFETIME_BOUND [[clang::lifetimebound]]
9696
#else
97-
#define LIBC_LIFETIMEBOUND
97+
#define LIBC_LIFETIME_BOUND
9898
#endif
9999

100100
#if __has_attribute(lifetime_capture_by)

0 commit comments

Comments
 (0)