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

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 07:39:01 PDT 2026


================
@@ -458,7 +466,7 @@ 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) const LLVM_LIFETIME_BOUND {
----------------
isuckatcs wrote:

Isn't `Out` lifetime bound as well? `StringRef(Out.data(), Out.size())` points to its buffer.

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


More information about the llvm-commits mailing list