@@ -44,16 +44,29 @@ enum class errc : int {
4444 backend_mismatch = 14 ,
4545};
4646
47- // / Constructs an error code using E and sycl_category()
47+ // / Constructs an error code using sycl::errc and sycl_category().
48+ // /
49+ // / \param E SYCL 2020 error code.
50+ // /
51+ // / \returns constructed error code.
4852_LIBSYCL_EXPORT std::error_code make_error_code (sycl::errc E) noexcept ;
4953
5054// / Obtains a reference to the static error category object for SYCL errors.
55+ // /
56+ // / This object overrides the virtual function error_category::name() to return
57+ // / a pointer to the string "sycl". When the implementation throws an
58+ // / sycl::exception object Ex with this category, the error code value contained
59+ // / by the exception (Ex.code().value()) is one of the enumerated values in
60+ // / sycl::errc.
61+ // /
62+ // / \returns the error category object for SYCL errors.
5163_LIBSYCL_EXPORT const std::error_category &sycl_category () noexcept ;
5264
53- // Derive from std::exception so uncaught exceptions are printed in c++ default
54- // exception handler.
55- // Virtual inheritance is mandated by SYCL 2020.
56- // SYCL 2020 4.13.2. Exception class interface
65+ // / \brief SYCL 2020 exception class (4.13.2.) for sync and async error handling
66+ // / in a SYCL application (host code).
67+ // /
68+ // / Derived from std::exception so uncaught exceptions are printed in c++
69+ // / default exception handler. Virtual inheritance is mandated by SYCL 2020.
5770class _LIBSYCL_EXPORT exception : public virtual std::exception {
5871public:
5972 exception (std::error_code, const char *);
@@ -70,11 +83,26 @@ class _LIBSYCL_EXPORT exception : public virtual std::exception {
7083
7184 virtual ~exception ();
7285
86+ // / Returns the error code stored inside the exception.
87+ // /
88+ // / \returns the error code stored inside the exception.
7389 const std::error_code &code () const noexcept ;
90+
91+ // / Returns the error category of the error code stored inside the exception.
92+ // /
93+ // / \returns the error category of the error code stored inside the exception.
7494 const std::error_category &category () const noexcept ;
7595
96+ // / Returns string that describes the error that triggered the exception.
97+ // /
98+ // / \returns an implementation-defined non-null constant C-style string that
99+ // / describes the error that triggered the exception.
76100 const char *what () const noexcept final ;
77101
102+ // / Checks if the exception has an associated SYCL context.
103+ // /
104+ // / \returns true if this SYCL exception has an associated SYCL context and
105+ // / false if it does not.
78106 bool has_context () const noexcept ;
79107
80108private:
@@ -84,8 +112,7 @@ class _LIBSYCL_EXPORT exception : public virtual std::exception {
84112 std::error_code MErrC = make_error_code(sycl::errc::invalid);
85113};
86114
87- // / Used as a container for a list of asynchronous exceptions
88- // /
115+ // / \brief Used as a container for a list of asynchronous exceptions.
89116class _LIBSYCL_EXPORT exception_list {
90117public:
91118 using value_type = std::exception_ptr;
@@ -95,10 +122,21 @@ class _LIBSYCL_EXPORT exception_list {
95122 using iterator = std::vector<std::exception_ptr>::const_iterator;
96123 using const_iterator = std::vector<std::exception_ptr>::const_iterator;
97124
125+ // / Returns the size of the list.
126+ // /
127+ // / \returns the size of the list.
98128 size_type size () const ;
99- // first asynchronous exception
129+
130+ // / Returns an iterator to the beginning of the list of asynchronous
131+ // / exceptions.
132+ // /
133+ // / \returns an iterator to the beginning of the list of asynchronous
134+ // / exceptions.
100135 iterator begin () const ;
101- // refer to past-the-end last asynchronous exception
136+
137+ // / Returns an iterator to the end of the list of asynchronous exceptions.
138+ // /
139+ // / \returns an iterator to the end of the list of asynchronous exceptions.
102140 iterator end () const ;
103141
104142private:
0 commit comments