[llvm] [ADT] Add `[[clang::lifetimebound]]` annotations to Twine.h (PR #210474)

Balázs Benics via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 01:10:36 PDT 2026


================
@@ -458,7 +466,8 @@ class Twine {
   /// This returns the twine as a single StringRef if it can be
   /// represented as such. Otherwise the twine is written into the given
   /// SmallVector and a StringRef to the SmallVector's data is returned.
-  StringRef toStringRef(SmallVectorImpl<char> &Out) const {
+  StringRef toStringRef(SmallVectorImpl<char> &Out LLVM_LIFETIME_BOUND) const
----------------
steakhal wrote:

I think "out" outlives the Twine - thus that annotation is wrong.

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


More information about the llvm-commits mailing list