Add clang::lifetimebound annotation to llvm::function_ref#115019
Merged
Add clang::lifetimebound annotation to llvm::function_ref#115019
Conversation
Member
|
@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,
|
dwblaikie
approved these changes
Nov 5, 2024
Collaborator
dwblaikie
left a comment
There was a problem hiding this comment.
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 |
pranavk
added a commit
to pranavk/llvm-project
that referenced
this pull request
Nov 7, 2024
…vm#115019)" This reverts commit 9f79615. This is breaking compiler-rt/lib/sanitizer_common/... Author knows about the breakage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This helps catch dangling llvm::function_ref references, see #114950, #114949, #114808, #114789