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

Haojian Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 06:21:56 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)
----------------
hokein wrote:

> Actually, I am surprised we take an initializer list by const-ref here. 

I think it doesn't matter much, I agree that in general `std::initializer_list` is passed by value. 

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


More information about the llvm-commits mailing list