-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add clang::lifetimebound annotation to llvm::function_ref #115019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-adt Author: Haojian Wu (hokein) ChangesThis helps catch dangling llvm::function_ref references, see #114950, #114949, #114808, #114789 Full diff: https://github.com/llvm/llvm-project/pull/115019.diff 1 Files Affected:
diff --git a/llvm/include/llvm/ADT/STLFunctionalExtras.h b/llvm/include/llvm/ADT/STLFunctionalExtras.h
index 6f172504b3c167..3b9d40959d7142 100644
--- a/llvm/include/llvm/ADT/STLFunctionalExtras.h
+++ b/llvm/include/llvm/ADT/STLFunctionalExtras.h
@@ -16,6 +16,7 @@
#define LLVM_ADT_STLFUNCTIONALEXTRAS_H
#include "llvm/ADT/STLForwardCompat.h"
+#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <type_traits>
@@ -52,7 +53,7 @@ class function_ref<Ret(Params...)> {
template <typename Callable>
function_ref(
- Callable &&callable,
+ Callable &&callable LLVM_LIFETIME_BOUND,
// This is not the copy-constructor.
std::enable_if_t<!std::is_same<remove_cvref_t<Callable>,
function_ref>::value> * = nullptr,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please commit this when you've a chance to watch the bots relatively carefully - seems fairly likely to cause some undiscovered fallout.
64a83a7
to
7745a25
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/1656 Here is the relevant piece of the build log for the reference
|
…vm#115019)" This reverts commit 9f79615. This is breaking compiler-rt/lib/sanitizer_common/... Author knows about the breakage.
This helps catch dangling llvm::function_ref references, see #114950, #114949, #114808, #114789