annotate gcc/jit/docs/cp/topics/objects.rst @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1 .. Copyright (C) 2014-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
2 Originally contributed by David Malcolm <dmalcolm@redhat.com>
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This is free software: you can redistribute it and/or modify it
kono
parents:
diff changeset
5 under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
6 the Free Software Foundation, either version 3 of the License, or
kono
parents:
diff changeset
7 (at your option) any later version.
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 This program is distributed in the hope that it will be useful, but
kono
parents:
diff changeset
10 WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
kono
parents:
diff changeset
12 General Public License for more details.
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
15 along with this program. If not, see
kono
parents:
diff changeset
16 <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 .. default-domain:: cpp
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 Objects
kono
parents:
diff changeset
21 =======
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 .. class:: gccjit::object
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 Almost every entity in the API (with the exception of
kono
parents:
diff changeset
26 :class:`gccjit::context` and :c:type:`gcc_jit_result *`) is a
kono
parents:
diff changeset
27 "contextual" object, a :class:`gccjit::object`.
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 A JIT object:
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 * is associated with a :class:`gccjit::context`.
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 * is automatically cleaned up for you when its context is released so
kono
parents:
diff changeset
34 you don't need to manually track and cleanup all objects, just the
kono
parents:
diff changeset
35 contexts.
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 The C++ class hierarchy within the ``gccjit`` namespace looks like this::
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 +- object
kono
parents:
diff changeset
40 +- location
kono
parents:
diff changeset
41 +- type
kono
parents:
diff changeset
42 +- struct
kono
parents:
diff changeset
43 +- field
kono
parents:
diff changeset
44 +- function
kono
parents:
diff changeset
45 +- block
kono
parents:
diff changeset
46 +- rvalue
kono
parents:
diff changeset
47 +- lvalue
kono
parents:
diff changeset
48 +- param
kono
parents:
diff changeset
49 +- case_
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 The :class:`gccjit::object` base class has the following operations:
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 .. function:: gccjit::context gccjit::object::get_context () const
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 Which context is the obj within?
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 .. function:: std::string gccjit::object::get_debug_string () const
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 Generate a human-readable description for the given object.
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 For example,
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 .. code-block:: c++
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 printf ("obj: %s\n", obj.get_debug_string ().c_str ());
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 might give this text on stdout:
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 .. code-block:: bash
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 obj: 4.0 * (float)i