Commit 2a73ae66 authored by Francisco Jerez's avatar Francisco Jerez
Browse files

clover: Define error subclass to signal build option parse failure.


Reviewed-by: Serge Martin's avatarSerge Martin <edb+mesa@sigluy.net>
Tested-by: Jan Vesely's avatarJan Vesely <jan.vesely@rutgers.edu>
parent 4ef1c091
......@@ -183,9 +183,8 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
prog.build(devs, opts);
return CL_SUCCESS;
} catch (error &e) {
if (e.get() == CL_INVALID_COMPILER_OPTIONS)
return CL_INVALID_BUILD_OPTIONS;
return e.get();
}
......@@ -225,6 +224,9 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
prog.build(devs, opts, headers);
return CL_SUCCESS;
} catch (invalid_build_options_error &e) {
return CL_INVALID_COMPILER_OPTIONS;
} catch (build_error &e) {
return CL_COMPILE_PROGRAM_FAILURE;
......
......@@ -65,6 +65,12 @@ namespace clover {
cl_int code;
};
class invalid_build_options_error : public error {
public:
invalid_build_options_error(const std::string &what = "") :
error(CL_INVALID_BUILD_OPTIONS, what) {}
};
class build_error : public error {
public:
build_error(const std::string &what = "") :
......
......@@ -98,7 +98,7 @@ namespace {
if (!clang::CompilerInvocation::CreateFromArgs(
c->getInvocation(), copts.data(), copts.data() + copts.size(), diag))
throw error(CL_INVALID_COMPILER_OPTIONS);
throw invalid_build_options_error();
c->getTargetOpts().CPU = target.cpu;
c->getTargetOpts().Triple = target.triple;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment