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

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 01:05:17 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Haojian Wu (hokein)

<details>
<summary>Changes</summary>

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
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;
 

``````````

</details>


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


More information about the llvm-commits mailing list