[libcxx-commits] [libcxx] mark std::make_format_args with clang::lifetimebound attribute (PR #78997)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 22 08:00:24 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: None (kelbon)

<details>
<summary>Changes</summary>

Inspired by:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2905r2.html

[[clang::lifetimebound]] is great, it may be very useful in many places of standard library

how it will work:

https://godbolt.org/z/dqj5eazMn



---
Full diff: https://github.com/llvm/llvm-project/pull/78997.diff


1 Files Affected:

- (modified) libcxx/include/__format/format_functions.h (+1-1) 


``````````diff
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 015bff70f51d977..0de1c5dc7c5e326 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -63,7 +63,7 @@ using wformat_args = basic_format_args<wformat_context>;
 #  endif
 
 template <class _Context = format_context, class... _Args>
-_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) {
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args [[clang::lifetimebound]]) {
   return _VSTD::__format_arg_store<_Context, _Args...>(__args...);
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/78997


More information about the libcxx-commits mailing list