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

Haojian Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 00:01:09 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:

> Now that the patch to remove the reference from the initialiser list landed, this should no longer warn, right?

Ah, you're right. For initializer_list, we actually track its backing array, for the empty case `{}`, there is no `MaterializeTemporaryExpr` inside.

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


More information about the llvm-commits mailing list