Skip to content

Commit a458595

Browse files
[NFCI] Remove/inline [rarely|never] used exception ctor overloads (#14406)
SYCL 1.2 exception classes don't use `context` argument so it can be removed. `online_compile_error` was the single user of an overload, so I've removed it and change the ctor used by it. --------- Co-authored-by: Alexey Bader <[email protected]>
1 parent 4028ddc commit a458595

File tree

3 files changed

+13
-25
lines changed

3 files changed

+13
-25
lines changed

sycl/include/sycl/exception.hpp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -128,31 +128,19 @@ class __SYCL_EXPORT exception : public virtual std::exception {
128128

129129
protected:
130130
// base constructors used by SYCL 1.2.1 exception subclasses
131-
exception(std::error_code Ec, const char *Msg, const pi_int32 PIErr,
132-
std::shared_ptr<context> Context = nullptr)
133-
: exception(Ec, std::string(Msg), PIErr, Context) {}
131+
exception(std::error_code Ec, const char *Msg, const pi_int32 PIErr)
132+
: exception(Ec, std::string(Msg), PIErr) {}
134133

135-
exception(std::error_code Ec, const std::string &Msg, const pi_int32 PIErr,
136-
std::shared_ptr<context> Context = nullptr)
137-
: exception(Ec, Context, Msg + " " + detail::codeToString(PIErr)) {
134+
exception(std::error_code Ec, const std::string &Msg, const pi_int32 PIErr)
135+
: exception(Ec, nullptr, Msg + " " + detail::codeToString(PIErr)) {
138136
MPIErr = PIErr;
139137
}
140138

141-
exception(const std::string &Msg)
142-
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
143-
: MMsg(std::make_shared<detail::string>(Msg)), MContext(nullptr){}
144-
#else
145-
: MMsg(std::make_shared<std::string>(Msg)), MContext(nullptr) {
146-
}
147-
#endif
148-
149-
// base constructor for all SYCL 2020 constructors
150-
// exception(context *ctxPtr, std::error_code Ec, const std::string
151-
// &what_arg);
152-
exception(std::error_code Ec, std::shared_ptr<context> SharedPtrCtx,
153-
const std::string &what_arg)
154-
: exception(Ec, SharedPtrCtx, what_arg.c_str()) {
155-
}
139+
// base constructor for all SYCL 2020 constructors
140+
// exception(context *, std::error_code, const std::string);
141+
exception(std::error_code Ec, std::shared_ptr<context> SharedPtrCtx,
142+
const std::string &what_arg)
143+
: exception(Ec, SharedPtrCtx, what_arg.c_str()) {}
156144
exception(std::error_code Ec, std::shared_ptr<context> SharedPtrCtx,
157145
const char *WhatArg);
158146

sycl/include/sycl/ext/intel/experimental/online_compiler.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class device_arch {
6767
class online_compile_error : public sycl::exception {
6868
public:
6969
online_compile_error() = default;
70-
online_compile_error(const std::string &Msg) : sycl::exception(Msg) {}
70+
online_compile_error(const std::string &Msg)
71+
: sycl::exception(make_error_code(errc::invalid), Msg) {}
7172
};
7273

7374
/// Designates a source language for the online compiler.

sycl/test/abi/sycl_symbols_windows.dump

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,8 @@
528528
??0event@_V1@sycl@@QEAA@AEBV012@@Z
529529
??0event@_V1@sycl@@QEAA@PEAU_cl_event@@AEBVcontext@12@@Z
530530
??0event@_V1@sycl@@QEAA@XZ
531-
??0exception@_V1@sycl@@IEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
532-
??0exception@_V1@sycl@@IEAA@Verror_code@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@HV?$shared_ptr@Vcontext@_V1@sycl@@@4@@Z
533-
??0exception@_V1@sycl@@IEAA@Verror_code@std@@PEBDHV?$shared_ptr@Vcontext@_V1@sycl@@@4@@Z
531+
??0exception@_V1@sycl@@IEAA@Verror_code@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@H@Z
532+
??0exception@_V1@sycl@@IEAA@Verror_code@std@@PEBDH@Z
534533
??0exception@_V1@sycl@@IEAA@Verror_code@std@@V?$shared_ptr@Vcontext@_V1@sycl@@@4@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@@Z
535534
??0exception@_V1@sycl@@IEAA@Verror_code@std@@V?$shared_ptr@Vcontext@_V1@sycl@@@4@PEBD@Z
536535
??0exception@_V1@sycl@@QEAA@AEBV012@@Z

0 commit comments

Comments
 (0)