clover: make module::symbol::name a string
Acked-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
This commit is contained in:
parent
5ca9b23319
commit
2d112ed961
|
@ -293,8 +293,7 @@ clGetProgramInfo(cl_program d_prog, cl_program_info param,
|
||||||
|
|
||||||
case CL_PROGRAM_KERNEL_NAMES:
|
case CL_PROGRAM_KERNEL_NAMES:
|
||||||
buf.as_string() = fold([](const std::string &a, const module::symbol &s) {
|
buf.as_string() = fold([](const std::string &a, const module::symbol &s) {
|
||||||
return ((a.empty() ? "" : a + ";") +
|
return ((a.empty() ? "" : a + ";") + s.name);
|
||||||
std::string(s.name.begin(), s.name.size()));
|
|
||||||
}, std::string(), prog.symbols());
|
}, std::string(), prog.symbols());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,27 @@ namespace {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// (De)serialize a string.
|
||||||
|
template<>
|
||||||
|
struct _serializer<std::string> {
|
||||||
|
static void
|
||||||
|
proc(compat::ostream &os, const std::string &s) {
|
||||||
|
_proc<uint32_t>(os, s.size());
|
||||||
|
os.write(&s[0], s.size() * sizeof(std::string::value_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
proc(compat::istream &is, std::string &s) {
|
||||||
|
s.resize(_proc<uint32_t>(is));
|
||||||
|
is.read(&s[0], s.size() * sizeof(std::string::value_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
proc(module::size_t &sz, const std::string &s) {
|
||||||
|
sz += sizeof(uint32_t) + sizeof(std::string::value_type) * s.size();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// (De)serialize a module::section.
|
/// (De)serialize a module::section.
|
||||||
template<>
|
template<>
|
||||||
struct _serializer<module::section> {
|
struct _serializer<module::section> {
|
||||||
|
|
|
@ -100,12 +100,12 @@ namespace clover {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct symbol {
|
struct symbol {
|
||||||
symbol(const compat::vector<char> &name, resource_id section,
|
symbol(const std::string &name, resource_id section,
|
||||||
size_t offset, const compat::vector<argument> &args) :
|
size_t offset, const compat::vector<argument> &args) :
|
||||||
name(name), section(section), offset(offset), args(args) { }
|
name(name), section(section), offset(offset), args(args) { }
|
||||||
symbol() : name(), section(0), offset(0), args() { }
|
symbol() : name(), section(0), offset(0), args() { }
|
||||||
|
|
||||||
compat::vector<char> name;
|
std::string name;
|
||||||
resource_id section;
|
resource_id section;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
compat::vector<argument> args;
|
compat::vector<argument> args;
|
||||||
|
|
Loading…
Reference in New Issue