diff options
| author | akhropov <[email protected]> | 2025-12-22 01:01:58 +0300 |
|---|---|---|
| committer | akhropov <[email protected]> | 2025-12-22 01:15:26 +0300 |
| commit | d2fc0bfbff0f7c15918c009590904a7f33b9ed11 (patch) | |
| tree | 2eacd70015102434b3100858f852584fe894bcbb /util | |
| parent | aecd82fc6f5a3bb0ef11ffef0fbe1323318dca06 (diff) | |
Y_LIFETIME_BOUND documentation: add info about constructors and member functions, add a link to CLang documentation.
commit_hash:0d4feb10ff7975b833e61a93d6474b5f4e5ad94e
Diffstat (limited to 'util')
| -rw-r--r-- | util/system/compiler.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/util/system/compiler.h b/util/system/compiler.h index f0dd5b9c5b1..3270f214043 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -698,10 +698,18 @@ Y_FORCE_INLINE void DoNotOptimizeAway(const T&) = delete; /** * @def Y_LIFETIME_BOUND * - * The attribute on a function parameter can be used to tell the compiler - * that function return value may refer that parameter. + * This attribute on a function parameter can be used to tell the compiler + * that the function return value may refer that parameter. + * When applied to a parameter of a constructor it means that the constructed object + * may refer that parameter. + * This attribute can also be used to annotate non-static member functions meaning that the + * return value of this function may refer to the object on which the member function is invoked. + * * The compiler may produce a compile-time warning if it is able to detect that * an object or a reference refers to another object with a shorter lifetime. + * + * @see + * Clang: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound */ #if defined(__CUDACC__) && (!Y_CUDA_AT_LEAST(11, 0) || (__clang_major__ < 13)) #define Y_LIFETIME_BOUND |
