[Clang] Add lifetimebound attribute to std::move/std::forward
authorAlexander Shaposhnikov <ashaposhnikov@google.com>
Thu, 19 Jan 2023 20:57:24 +0000 (20:57 +0000)
committerAlexander Shaposhnikov <ashaposhnikov@google.com>
Thu, 19 Jan 2023 20:57:24 +0000 (20:57 +0000)
commit31b0be4eba9e8e9244799f0ebcb18175faff69ab
tree80e91ec654aa8e3d25d05597be8a8c5527e2aa9d
parente2c43a547b311725067e7b56ae935e940e6fc1c3
[Clang] Add lifetimebound attribute to std::move/std::forward

Clang now automatically adds [[clang::lifetimebound]] to the parameters of
std::move, std::forward et al, this enables Clang to diagnose more cases
where the returned reference outlives the object.
Associated GitHub issue: https://github.com/llvm/llvm-project/issues/60020

Test plan: ninja check-clang check-all

Differential revision: https://reviews.llvm.org/D141744
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaDecl.cpp
clang/test/SemaCXX/attr-lifetimebound.cpp
clang/test/SemaCXX/builtin-std-move.cpp
clang/test/SemaCXX/builtins.cpp