1+ //===----- dppl_mem_ownership_attrs.h - DPPL-SYCL interface --*-- C++ --*--===//
2+ //
3+ // Python Data Parallel Processing Library (PyDPPL)
4+ //
5+ // Copyright 2020 Intel Corporation
6+ //
7+ // Licensed under the Apache License, Version 2.0 (the "License");
8+ // you may not use this file except in compliance with the License.
9+ // You may obtain a copy of the License at
10+ //
11+ // http://www.apache.org/licenses/LICENSE-2.0
12+ //
13+ // Unless required by applicable law or agreed to in writing, software
14+ // distributed under the License is distributed on an "AS IS" BASIS,
15+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+ // See the License for the specific language governing permissions and
17+ // limitations under the License.
18+ //
19+ //===----------------------------------------------------------------------===//
20+ ///
21+ /// \file
22+ /// This file defines a group of macros that serve as attributes indicating the
23+ /// type of ownership of a pointer. The macros are modeled after similar
24+ /// attributes defines in Integer Set Library (isl) and serve the purpose of
25+ /// helping a programmer understand the semantics of a DPPL function.
26+ ///
27+ //===----------------------------------------------------------------------===//
28+ #pragma once
29+
30+ /**
31+ * @defgroup MEM_MGMT_ATTR_MACROS Memory management attributes.
32+ *
33+ * @{
34+ */
35+
36+ /*!
37+ * @def __dppl_give
38+ * @brief The __dppl_give attribute indicates that a new object is returned and
39+ * the caller now owns the object.
40+ *
41+ * The __dppl_give attribute informs a user that the function is allocating a
42+ * new object and returning it to the user. The user now owns the object and to
43+ * free the object, he/she should make sure to use it exactly once as a value
44+ * for a __dppl_take argument. However, the user is free to use the object as
45+ * he/she likes as a value to __dppl_keep arguments.
46+ *
47+ */
48+ #ifndef __dppl_give
49+ #define __dppl_give
50+ #endif
51+ /*!
52+ * @def __dppl_take
53+ * @brief The __dppl_take attribute indicates that the function "takes" over the
54+ * ownership of the object and the user must not use the object as an argument
55+ * to another function.
56+ *
57+ * The __dppl_take attribute mens that the function destroys it before the
58+ * function returns, and the caller must not use the object again in any other
59+ * function. If the pointer annotated with __dppl_take is NULL then it is
60+ * treated as an error, since it may prevent the normal behavior of the
61+ * function.
62+ *
63+ */
64+ #ifndef __dppl_take
65+ #define __dppl_take
66+ #endif
67+ /*!
68+ * @def __dppl_keep
69+ * @brief The __dppl_keep attribute indicates that the function only uses the
70+ * object and does not destroy it before returning.
71+ *
72+ */
73+ #ifndef __dppl_keep
74+ #define __dppl_keep
75+ #endif
76+ /*!
77+ * @def __dppl_null
78+ * @brief The __dppl_null attribute indicates that a NULL value is returned.
79+ *
80+ */
81+ #ifndef __dppl_null
82+ #define __dppl_null
83+ #endif
84+
85+ /** @} */
0 commit comments