LLVM
22.0.0git
include
llvm
ExecutionEngine
Orc
CallableTraitsHelper.h
Go to the documentation of this file.
1
//===- CallableTraitsHelper.h - Callable arg/ret type extractor -*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// CallableTraitsHelper API.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_EXECUTIONENGINE_ORC_CALLABLETRAITSHELPER_H
14
#define LLVM_EXECUTIONENGINE_ORC_CALLABLETRAITSHELPER_H
15
16
#include <tuple>
17
#include <type_traits>
18
19
namespace
llvm::orc
{
20
21
/// CallableTraitsHelper takes an implementation class template Impl and some
22
/// callable type C and passes the return and argument types of C to the Impl
23
/// class template.
24
///
25
/// This can be used to simplify the implementation of classes that need to
26
/// operate on callable types.
27
template
<
template
<
typename
...>
typename
ImplT,
typename
C
>
28
struct
CallableTraitsHelper
29
:
public
CallableTraitsHelper
<
30
ImplT,
31
decltype(&std::remove_cv_t<std::remove_reference_t<C>>::operator())> {
32
};
33
34
template
<
template
<
typename
...>
typename
ImplT
,
typename
RetT,
35
typename
... ArgTs>
36
struct
CallableTraitsHelper
<
ImplT
, RetT(ArgTs...)>
37
:
public
ImplT
<RetT, ArgTs...> {};
38
39
template
<
template
<
typename
...>
typename
ImplT
,
typename
RetT,
40
typename
... ArgTs>
41
struct
CallableTraitsHelper
<
ImplT
, RetT (*)(ArgTs...)>
42
:
public
CallableTraitsHelper
<
ImplT
, RetT(ArgTs...)> {};
43
44
template
<
template
<
typename
...>
typename
ImplT
,
typename
RetT,
45
typename
... ArgTs>
46
struct
CallableTraitsHelper
<
ImplT
, RetT (&)(ArgTs...)>
47
:
public
CallableTraitsHelper
<
ImplT
, RetT(ArgTs...)> {};
48
49
template
<
template
<
typename
...>
typename
ImplT
,
typename
ClassT,
typename
RetT,
50
typename
... ArgTs>
51
struct
CallableTraitsHelper
<
ImplT
, RetT (ClassT::*)(ArgTs...)>
52
:
public
CallableTraitsHelper
<ImplT, RetT(ArgTs...)> {};
53
54
template
<
template
<
typename
...>
typename
ImplT
,
typename
ClassT,
typename
RetT,
55
typename
... ArgTs>
56
struct
CallableTraitsHelper
<
ImplT
, RetT (ClassT::*)(ArgTs...)
const
>
57
:
public
CallableTraitsHelper
<ImplT, RetT(ArgTs...)> {};
58
59
namespace
detail
{
60
template
<
typename
RetT,
typename
... ArgTs>
struct
CallableArgInfoImpl
{
61
using
ReturnType
= RetT;
62
using
ArgsTupleType
= std::tuple<ArgTs...>;
63
};
64
}
// namespace detail
65
66
/// CallableArgInfo provides typedefs for the return type and argument types
67
/// (as a tuple) of the given callable type.
68
template
<
typename
Callable>
69
struct
CallableArgInfo
70
:
public
CallableTraitsHelper
<detail::CallableArgInfoImpl, Callable> {};
71
72
}
// namespace llvm::orc
73
74
#endif
// LLVM_EXECUTIONENGINE_ORC_CALLABLETRAITSHELPER_H
const
aarch64 promote const
Definition
AArch64PromoteConstant.cpp:228
ImplT
detail
Definition
ClauseT.h:111
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition
CallingConv.h:34
llvm::orc
Definition
AbsoluteSymbols.h:19
llvm::orc::CallableArgInfo
CallableArgInfo provides typedefs for the return type and argument types (as a tuple) of the given ca...
Definition
CallableTraitsHelper.h:70
llvm::orc::CallableTraitsHelper
CallableTraitsHelper takes an implementation class template Impl and some callable type C and passes ...
Definition
CallableTraitsHelper.h:31
llvm::orc::detail::CallableArgInfoImpl
Definition
CallableTraitsHelper.h:60
llvm::orc::detail::CallableArgInfoImpl::ReturnType
RetT ReturnType
Definition
CallableTraitsHelper.h:61
llvm::orc::detail::CallableArgInfoImpl::ArgsTupleType
std::tuple< ArgTs... > ArgsTupleType
Definition
CallableTraitsHelper.h:62
Generated on
for LLVM by
1.14.0