[llvm] a7b249e - Reland "Add clang::lifetimebound annotation to llvm::function_ref"

Haojian Wu via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 04:10:58 PST 2024


Author: Haojian Wu
Date: 2024-11-11T13:10:22+01:00
New Revision: a7b249e4708d61e491390773d3bb1ee88db91a57

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

LOG: Reland "Add clang::lifetimebound annotation to llvm::function_ref"

This relands 9f79615, which was reverted in e109c49. The compiler-rt breakage is fixed.

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


        


More information about the llvm-commits mailing list