Skip to content

Add LLVM_GSL_POINTER to llvm::function_ref. #120699

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

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

hokein
Copy link
Collaborator

@hokein hokein commented Dec 20, 2024

This can enable clang to detect dangling assignment issues, see #120698.

@hokein hokein requested a review from Xazax-hun December 20, 2024 09:04
@llvmbot
Copy link
Member

llvmbot commented Dec 20, 2024

@llvm/pr-subscribers-llvm-adt

Author: Haojian Wu (hokein)

Changes

This can enable clang to detect dangling assignment issues, see #120698.


Full diff: https://github.com/llvm/llvm-project/pull/120699.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/STLFunctionalExtras.h (+1-1)
diff --git a/llvm/include/llvm/ADT/STLFunctionalExtras.h b/llvm/include/llvm/ADT/STLFunctionalExtras.h
index 3b9d40959d7142..f1ebb581996563 100644
--- a/llvm/include/llvm/ADT/STLFunctionalExtras.h
+++ b/llvm/include/llvm/ADT/STLFunctionalExtras.h
@@ -37,7 +37,7 @@ namespace llvm {
 template<typename Fn> class function_ref;
 
 template<typename Ret, typename ...Params>
-class function_ref<Ret(Params...)> {
+class LLVM_GSL_POINTER function_ref<Ret(Params...)> {
   Ret (*callback)(intptr_t callable, Params ...params) = nullptr;
   intptr_t callable;
 

Copy link

github-actions bot commented Dec 20, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Collaborator

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@hokein hokein force-pushed the gsl-pointer-function-ref branch from 04115c7 to cf11f15 Compare January 8, 2025 08:32
@hokein hokein merged commit b037bce into llvm:main Jan 8, 2025
5 of 8 checks passed
@hokein hokein deleted the gsl-pointer-function-ref branch January 8, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants