• Home
  • Raw
  • Download

Lines Matching +full:dangling +full:- +full:reference

2 // Use of this source code is governed by a BSD-style license that can be
32 #include "third_party/abseil-cpp/absl/functional/function_ref.h"
38 // Functor -- A movable type representing something that should be called.
41 // RunType -- A function type (as opposed to function _pointer_ type) for
43 // (Bound)Args -- A set of types that stores the arguments.
46 // ForceVoidReturn<> -- Helper class for translating function signatures to
48 // FunctorTraits<> -- Type traits used to determine the correct RunType and
51 // StorageTraits<> -- Type traits that determine how a bound argument is
53 // InvokeHelper<> -- Take a Functor + arguments and actually invokes it.
57 // Invoker<> -- Unwraps the curried parameters and executes the Functor.
58 // BindState<> -- Stores the curried parameters, and is the main entry point
86 // UnretainedWrapper will check and report if pointer is dangling upon
89 // UnretainedWrapper won't check if pointer is dangling upon invocation. For
92 // UnretainedWrapper won't check if pointer is dangling upon invocation. The
94 // allow dangling pointers that would otherwise crash if MayNotDangle was used.
95 // It should be replaced ASAP with MayNotDangle (after fixing the dangling
117 // into, to minimize `raw_ptr<T>` <-> `T*` conversions. We also would like to
119 // https://docs.google.com/document/d/1dLM34aKqbNBfRdOYxxV_T-zQU4J5wjmXwIBJZr7JvZM/edit
170 // stateful information), so disable direct dangling pointer detection
173 // If the callback is invoked, dangling pointer detection will be triggered
182 // It is allowable to convert `raw_ptr<T>` -> `T*`, but not in the other
192 // std::reference_wrapper<T> and T& do not work, since the reference lifetime is
204 "Callback cannot capture an unprotected C++ reference since this "
208 // Raw reference makes sense only if there are no PtrTraits. If there are,
226 // `ref_` is either a `raw_ref` or a regular C++ reference.
236 // dangling pointer. This is checked here. For now, it is configured to in GetInternal()
245 // crash in ASAN builds on calling a bound callback with a dangling in GetInternal()
246 // reference parameter even if that parameter is not used. This could hide in GetInternal()
253 // stateful information), so disable direct dangling pointer detection
256 // If the callback is invoked, dangling pointer detection will be triggered
269 // a method receiver (a reference on `this` argument). This is needed because
276 // NOLINTNEXTLINE(google-explicit-constructor)
282 T* operator->() const { return &obj_.get(); }
350 // It is needed to get around the fact that Bind() takes a const reference to
351 // all its arguments. Because Bind() takes a const reference to avoid
352 // unnecessary copies, it is incompatible with movable-but-not-copyable
358 // types and movable-but-not-copyable types. Thus we introduce a wrapper type
368 // and stored by value which will not work for general move-only types.
398 // InvokeHelper that will no-op itself in the event the WeakPtr<> for
420 : DropTypeListItemImpl<n - 1, TypeList<List...>> {};
432 // A type-level function that drops |n| list item from given TypeList.
443 : TakeTypeListItemImpl<n - 1, TypeList<List...>, Accum..., T> {};
455 // A type-level function that takes first |n| list item from given TypeList.
470 // A type-level function that concats two TypeLists.
485 // A type-level function that constructs a function type that has |R| as its
500 // A type-level function that extracts function arguments into a TypeList.
505 // A type-level function that extracts the return type of a function.
603 // // No non-static member variable and no virtual functions.
672 // Support for Objective-C blocks. Blocks can be bound as the compiler will
689 // to ensure that the Objective-C block is not deallocated until it has
692 // https://clang.llvm.org/docs/AutomaticReferenceCounting.html#precise-lifetime-semantics
751 // I.e. `void(*)()` and `void(*)() noexcept` are same in pre-C++17, and
858 // if they should no-op themselves.
891 // that allow cross-thread usage and perform `Lock()` in Unwrap() traits.
919 std::tuple_size_v<decltype(storage->bound_args_)>;
920 return RunImpl(std::move(storage->functor_),
921 std::move(storage->bound_args_),
932 std::tuple_size_v<decltype(storage->bound_args_)>;
933 return RunImpl(storage->functor_, storage->bound_args_,
959 // Do not `Unwrap()` here, as that immediately triggers dangling pointer
960 // detection. Dangling pointer detection should only be triggered if the
965 // Dangling pointers when invoking a cancelled callback are not considered
985 // - RunType is `double(Foo*, int, const std::string&)`,
986 // - ReturnType is `double`,
987 // - RunParamsList is `TypeList<Foo*, int, const std::string&>`,
988 // - BoundParamsList is `TypeList<Foo*, int>`,
989 // - UnboundParamsList is `TypeList<const std::string&>`,
990 // - BoundArgsList is `TypeList<Foo*, int16_t>`,
991 // - UnboundRunType is `double(const std::string&)`.
1041 std::tuple_size_v<decltype(storage->bound_args_)>;
1043 mode, storage->functor_, storage->bound_args_,
1051 // Asserts that Callback is not the first owner of a ref-counted receiver.
1059 // It's error prone to make the implicit first reference to ref-counted types.
1061 // reference to the ref-counted Foo. If PostTask() failed or the posted task
1063 // makes another reference.
1070 // Hence, base::Bind{Once,Repeating}() refuses to create the first reference
1071 // to ref-counted objects, and DCHECK()s otherwise. As above, that typically
1076 // and keep the first reference alive explicitly.
1087 DCHECK(receiver->HasAtLeastOneRef());
1133 // causing hard-to-diagnose crashes. Ideally we'd do this for all functors
1171 // // True iff all compile-time preconditions for using this specialization
1183 // repeatedly in Bind/Callback code to verify compile-time preconditions. The
1202 // `std::conjunction_v<>`. This short-circuits type instantiation, so
1326 // `int&&` -> `int&&`,
1327 // `const int&` -> `int&&`,
1328 // `OwnedWrapper<int>&` -> `int*&&`.
1330 // `int&&` -> `const int&`,
1331 // `const int&` -> `const int&`,
1332 // `OwnedWrapper<int>&` -> `int* const &`.
1338 // `int*` -> `int*`
1339 // `std::unique_ptr<int>` -> `int*`
1340 // `int` -> (assertion failure; `this` must be a pointer-like object)
1344 // Pointer-like receivers use a different specialization, so this never
1351 "must be bound using a pointer-like `this` argument.");
1383 // int* -> int*,
1384 // std::unique_ptr<int> -> int*.
1447 // a non-const lvalue reference and a reference to the unwrapped type
1506 // - bound parameter is of type
1508 // - the receiving argument is of type `MayBeDangling<T>`
1515 // - MayBeDangling<T> must not be used as receiver parameter.
1517 // - MayBeDangling<T> must be used as receiver parameter and its traits
1526 // - |Arg| can be retained internally as |Storage|.
1527 // - |Arg| can be forwarded as |Unwrapped| to |Param|.
1557 // A bound functor must take a dangling pointer argument (e.g. bound using the
1585 // move-only type:
1587 // 1. Whether the move-only argument should be moved into the internal
1589 // move-only semantics.
1590 // 2. Whether or not the bound, move-only argument should be moved to the
1592 // invoking the callback will destructively move the bound, move-only
1595 // functor with a constant reference to the bound, move-only argument. This
1600 // In contrast, `BindOnce()` only has one decision point. Once a move-only
1602 // move-only argument will always be moved to the functor when invoked.
1606 // Note: `Passed()` is a legacy of supporting move-only types when repeating
1614 "base::BindRepeating() argument is a move-only type. Use "
1625 "Bound argument for non-const reference parameter must be "
1645 "Attempting to bind a move-only type. Use std::move() to "
1675 // Takes three same-length `TypeList`s, and checks `ParamCanBeBound` for each
1724 "non-owning function references may not be bound as the "
1787 // null pointers accidentally ending up in posted tasks, causing hard-to-debug
1822 static_assert(v, "BindOnce() requires non-const rvalue for OnceCallback "
1895 // which is an optimistic thread-safe check for full validity.