[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:06:20 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:

Actually, I am surprised we take an initializer list by const-ref here. I wonder if the right solution here is to take it by value and keep the annotation. I think lifetime annotations might work out just right after taking it by value. 

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


More information about the llvm-commits mailing list