[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 07:15:32 PDT 2026
steakhal wrote:
> Obviously these annotations should exist but it appears they were added based manual review but there's compiler warnings for them which provide suggestions. I think this should be a tool-driven change to make sure the existing functionality works/is complete.
I get the point on using tools to help annotation effort. That should eliminate some class of mistakes that can be made while annotating (traded for annotation inference bugs). I think regardless of what used to come up with a change, the change speaks for itself. If you have spotted any correctness or completeness issues on the change, I'd love to hear that.
> And also it would only report lifetime issues if the appropriate warnings are enabled in the builds. Is that the case? (I am not of the loop on this, so sorry is this turned out to be rather rhetorical).
I don't have visibility on the upstream or (potentially unbounded many) downstream bots and their configurations.
But I think that is not the important point. `llvm::StringRef` was already annotated. `llvm::Twine` should be no exception.
Do you see potential downsides of adding these and potentially more lifetime attributes to relevant ADT classes/functions?
One that I could think of is having new warnings, but that so far usually turned out to be TPs, AFAIK.
https://github.com/llvm/llvm-project/pull/210474
More information about the llvm-commits
mailing list