66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
DiagnosticsContext dc( 0, format( "When invoking {}.", funcName.str() ) );
return InvokeOverloadSet( p.context(), pOvlSet, MakeClosedTuple( forward< O >( operands )... ),
p.context().locationId() );
};
}
template< typename T, typename I, typename RT = T >
auto ForType( source_location sloc = source_location::current() )
{
return [sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
{
using intrinsicType = Intrinsic< Value ( T, T ) >;
auto intrinsicFunc = []( const Context& c, const Value& lhs, const Value& rhs )
{
return BuildComputedValue( GetValueType< RT >(), lhs, rhs, I( ( c.locationId() ) ) );
};
auto loc = Location::Create( sloc );
pOvlSet->add( e, ToValue< intrinsicType >( move( intrinsicFunc ) ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
};
}
template< typename T, typename F >
auto ForType( F&& func, source_location sloc = source_location::current() )
{
return [&,sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
{
auto loc = Location::Create( sloc );
if constexpr( is_same_v< tag, UnaryOpTag > )
{
using intrinsicType = Intrinsic< Value ( T ) >;
pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
}
else
{
using intrinsicType = Intrinsic< Value ( T, T ) >;
pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
}
};
}
template< typename T1, typename T2, typename F >
auto ForTypes( F&& func, source_location sloc = source_location::current() )
{
return [=]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
{
using intrinsicType = Intrinsic< Value ( T1, T2 ) >;
auto loc = Location::Create( sloc );
pOvlSet->add( e, ToValue< intrinsicType >( func ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
};
}
}
#endif
|
|
|
|
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
DiagnosticsContext dc( 0, format( "When invoking {}.", funcName.str() ) );
return InvokeOverloadSet( p.context(), pOvlSet, MakeClosedTuple( forward< O >( operands )... ),
p.context().locationId() );
};
}
template< typename T, typename I, typename RT = T >
auto ForType( CURRENT_LOC )
{
return [sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
{
using intrinsicType = Intrinsic< Value ( T, T ) >;
auto intrinsicFunc = []( const Context& c, const Value& lhs, const Value& rhs )
{
return BuildComputedValue( GetValueType< RT >(), lhs, rhs, I( ( c.locationId() ) ) );
};
auto loc = Location::Create( sloc );
pOvlSet->add( e, ToValue< intrinsicType >( move( intrinsicFunc ) ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
};
}
template< typename T, typename F >
auto ForType( F&& func, CURRENT_LOC )
{
return [&,sloc]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
{
auto loc = Location::Create( sloc );
if constexpr( is_same_v< tag, UnaryOpTag > )
{
using intrinsicType = Intrinsic< Value ( T ) >;
pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
}
else
{
using intrinsicType = Intrinsic< Value ( T, T ) >;
pOvlSet->add( e, ToValue< intrinsicType >( forward< F >( func ) ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
}
};
}
template< typename T1, typename T2, typename F >
auto ForTypes( F&& func, CURRENT_LOC )
{
return [=]< typename tag >( auto&& e, auto&& pOvlSet, tag t )
{
using intrinsicType = Intrinsic< Value ( T1, T2 ) >;
auto loc = Location::Create( sloc );
pOvlSet->add( e, ToValue< intrinsicType >( func ).setLocationId( loc ),
GetBuiltinIntrinsicFuncInvocationRule() );
};
}
}
#endif
|