0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 23:44:01 +01:00

ircd:🆑 Build code on construction unless coerced otherwise.

This commit is contained in:
Jason Volk 2021-03-10 03:03:03 -08:00
parent 4da7d2ae43
commit dea1118bda
2 changed files with 11 additions and 5 deletions

View file

@ -76,8 +76,8 @@ struct ircd::cl::code
public:
void build(const string_view &opts = {});
code(const vector_view<const string_view> &srcs);
code(const string_view &src);
code(const vector_view<const string_view> &srcs, const string_view &opts = {});
code(const string_view &src, const string_view &opts = {});
code() = default;
code(code &&) noexcept;
code &operator=(const code &) = delete;

View file

@ -461,15 +461,18 @@ ircd::cl::kern::arg(const int i,
// code
//
ircd::cl::code::code(const string_view &src)
ircd::cl::code::code(const string_view &src,
const string_view &build_opts)
:code
{
vector_view<const string_view>(&src, 1)
vector_view<const string_view>(&src, 1),
build_opts
}
{
}
ircd::cl::code::code(const vector_view<const string_view> &srcs)
ircd::cl::code::code(const vector_view<const string_view> &srcs,
const string_view &build_opts)
{
static const size_t iov_max
{
@ -498,6 +501,9 @@ ircd::cl::code::code(const vector_view<const string_view> &srcs)
int err {CL_SUCCESS};
handle = clCreateProgramWithSource(primary, count, src, len, &err);
throw_on_error(err);
if(!null(build_opts))
build(build_opts);
}
ircd::cl::code::code(code &&o)