[llvm] b037bce - Add LLVM_GSL_POINTER to llvm::function_ref. (#120699)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 00:56:59 PST 2025


Author: Haojian Wu
Date: 2025-01-08T09:56:56+01:00
New Revision: b037bceef6a40c5c00c1f67cc5a334e2c4e5e041

URL: https://github.com/llvm/llvm-project/commit/b037bceef6a40c5c00c1f67cc5a334e2c4e5e041
DIFF: https://github.com/llvm/llvm-project/commit/b037bceef6a40c5c00c1f67cc5a334e2c4e5e041.diff

LOG: Add LLVM_GSL_POINTER to llvm::function_ref. (#120699)

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

Added: 
    

Modified: 
    llvm/include/llvm/ADT/STLFunctionalExtras.h

Removed: 
    


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


        


More information about the llvm-commits mailing list