[llvm] Add clang::lifetimebound annotation to ArrayRef constructors. (PR #113547)

Gábor Horváth via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 06:56:51 PDT 2024


================
@@ -113,7 +115,8 @@ namespace llvm {
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Winit-list-lifetime"
 #endif
-    constexpr /*implicit*/ ArrayRef(const std::initializer_list<T> &Vec)
+    constexpr /*implicit*/ ArrayRef(
+        const std::initializer_list<T> &Vec LLVM_LIFETIME_BOUND)
----------------
Xazax-hun wrote:

Ah, I see! Thanks! I have not realized the backing array is also a temporary with it's lifetime extended in some scenarios. 

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


More information about the llvm-commits mailing list