Bug 1967374 - Use MOZ_LIFETIME_CAPTURE_BY instead of MOZ_LIFETIME_BOUND where it makes sense r=nika
Differential Revision: https://phabricator.services.mozilla.com/D250312
This commit is contained in:
committed by
sguelton@mozilla.com
parent
aa16607cef
commit
ed1122ceea
@@ -501,6 +501,21 @@
|
|||||||
# define MOZ_LIFETIME_BOUND /* nothing */
|
# define MOZ_LIFETIME_BOUND /* nothing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MOZ_LIFETIME_CAPTURE_BY(x) indicates that objects that are referred to
|
||||||
|
* by that parameter may also be referred to by x.
|
||||||
|
* See: https://clang.llvm.org/docs/AttributeReference.html#lifetime-capture-by
|
||||||
|
*/
|
||||||
|
#if defined(__clang__) && defined(__has_cpp_attribute)
|
||||||
|
# if __has_cpp_attribute(clang::lifetime_capture_by)
|
||||||
|
# define MOZ_LIFETIME_CAPTURE_BY(x) [[clang::lifetime_capture_by(x)]]
|
||||||
|
# else
|
||||||
|
# define MOZ_LIFETIME_CAPTURE_BY(x) /* nothing */
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define MOZ_LIFETIME_CAPTURE_BY(x) /* nothing */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -110,12 +110,12 @@ class MOZ_GSL_POINTER nsTDependentString : public nsTString<T> {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using nsTString<T>::Rebind;
|
using nsTString<T>::Rebind;
|
||||||
void Rebind(const char_type* aData MOZ_LIFETIME_BOUND) {
|
void Rebind(const char_type* aData MOZ_LIFETIME_CAPTURE_BY(this)) {
|
||||||
Rebind(aData, char_traits::length(aData));
|
Rebind(aData, char_traits::length(aData));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rebind(const char_type* aStart MOZ_LIFETIME_BOUND,
|
void Rebind(const char_type* aStart MOZ_LIFETIME_CAPTURE_BY(this),
|
||||||
const char_type* aEnd MOZ_LIFETIME_BOUND);
|
const char_type* aEnd MOZ_LIFETIME_CAPTURE_BY(this));
|
||||||
void Rebind(const string_type&, index_type aStartPos);
|
void Rebind(const string_type&, index_type aStartPos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user