llvm-project
f40650e4 - [orc-rt] Rewrite move_only_function in terms of CallableTraitsHelper. (#206906)

Commit
11 days ago
[orc-rt] Rewrite move_only_function in terms of CallableTraitsHelper. (#206906) Uses CallableTraitsHelper to decompose the signature template argument into (IsConst, IsNoexcept, RetT, ArgTs...), collapsing the previous per-signature-shape partial specializations of move_only_function into a two-tier type-erasure hierarchy (Callable / CallableImpl + Storage / InvocableStorage) driven by CallableTraitsHelper. User-visible effect: move_only_function now supports the four signature shapes matching std::move_only_function's C++23 semantics, and operator()'s const and noexcept qualifiers track the signature: R(A...) - mutable, may throw R(A...) const - const-callable, may throw R(A...) noexcept - mutable, guaranteed nothrow R(A...) const noexcept - const-callable, guaranteed nothrow Two ill-formed combinations are rejected at compile time: - A throwing callable passed to a noexcept-qualified move_only_function fails a static_assert on nothrow-invocability in CallableImpl's constructor. - A mutable callable passed to a const-qualified move_only_function fails to compile because the const-qualified virtual call() body cannot invoke the stored callable through a const path. Adds tests exercising the new signature shapes at runtime and static checks for the invocability and noexcept-propagation matrices across all four combinations.
Author
Parents
Loading