Browse Source

Add documentation in HTML format

Peter Colberg 4 years ago
parent
commit
49c55975ec
16 changed files with 1136 additions and 280 deletions
  1. 0
    1
      .gitignore
  2. 8
    9
      Makefile
  3. 62
    0
      doc/CHANGES.html
  4. 7
    9
      doc/CHANGES.mdwn
  5. 54
    0
      doc/INSTALL.html
  6. 4
    2
      doc/INSTALL.mdwn
  7. 4
    1
      doc/Makefile
  8. 80
    0
      doc/README.html
  9. 3
    1
      doc/README.mdwn
  10. 11
    11
      doc/contents.mdwn
  11. 34
    0
      doc/index.html
  12. 10
    7
      doc/index.mdwn
  13. 85
    86
      doc/pandoc.css
  14. 6
    15
      doc/pandoc.html.in
  15. 628
    0
      doc/reference.html
  16. 140
    138
      doc/reference.mdwn

+ 0
- 1
.gitignore View File

@@ -1,3 +1,2 @@
1
-/doc/*.html
2 1
 /gcc/gcclua.so
3 2
 /gcc/*.o

+ 8
- 9
Makefile View File

@@ -9,7 +9,6 @@ CC     = gcc
9 9
 
10 10
 INSTALL_GCC_PLUGIN = $(shell $(CC) -print-file-name=plugin)
11 11
 INSTALL_DOC        = $(PREFIX)/share/doc/gcc-lua
12
-INSTALL_DOC_HTML   = $(INSTALL_DOC)/html
13 12
 
14 13
 INSTALL_D = install -d
15 14
 INSTALL_F = install -m 644
@@ -19,25 +18,25 @@ FILES_GCC_PLUGIN = gcclua.so
19 18
 FILES_DOC        = CHANGES.mdwn INSTALL.mdwn README.mdwn index.mdwn reference.mdwn
20 19
 FILES_DOC_HTML   = CHANGES.html INSTALL.html README.html index.html reference.html pandoc.css gcc-lua.png
21 20
 
21
+all: gcc doc
22
+
22 23
 gcc:
23 24
 	@$(MAKE) -C gcc
24 25
 
26
+doc:
27
+	@$(MAKE) -C doc
28
+
25 29
 test:
26 30
 	@$(MAKE) -C test
27 31
 
28
-install: gcc doc
32
+install: gcc
29 33
 	$(INSTALL_D) $(DESTDIR)$(INSTALL_GCC_PLUGIN)
30 34
 	cd gcc && $(INSTALL_L) $(FILES_GCC_PLUGIN) $(DESTDIR)$(INSTALL_GCC_PLUGIN)
31 35
 	$(INSTALL_D) $(DESTDIR)$(INSTALL_DOC)
32
-	cd doc && $(INSTALL_F) $(FILES_DOC) $(DESTDIR)$(INSTALL_DOC)
33
-	$(INSTALL_D) $(DESTDIR)$(INSTALL_DOC_HTML)
34
-	cd doc && $(INSTALL_F) $(FILES_DOC_HTML) $(DESTDIR)$(INSTALL_DOC_HTML)
35
-
36
-doc:
37
-	@$(MAKE) -C doc
36
+	cd doc && $(INSTALL_F) $(FILES_DOC) $(FILES_DOC_HTML) $(DESTDIR)$(INSTALL_DOC)
38 37
 
39 38
 clean:
40 39
 	@$(MAKE) -C gcc clean
41 40
 	@$(MAKE) -C doc clean
42 41
 
43
-.PHONY: gcc test install doc clean
42
+.PHONY: gcc test doc install clean

+ 62
- 0
doc/CHANGES.html View File

@@ -0,0 +1,62 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+<head>
4
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+  <meta http-equiv="Content-Style-Type" content="text/css" />
6
+  <meta name="generator" content="pandoc" />
7
+  <meta name="author" content="Peter Colberg" />
8
+  <title>Releases &mdash; Lua plugin for the GNU Compiler Collection</title>
9
+  <style type="text/css">code{white-space: pre;}</style>
10
+  <link rel="stylesheet" href="pandoc.css" type="text/css" />
11
+</head>
12
+<body>
13
+<div class="header">
14
+<ul>
15
+<li><a href="index.html">Lua plugin for GCC</a></li>
16
+<li><a href="INSTALL.html">Installing</a></li>
17
+<li><a href="README.html">User's Guide</a></li>
18
+<li><a href="reference.html">Reference</a></li>
19
+<li><a href="https://lists.colberg.org/listinfo/gcc-lua">Mailing list</a></li>
20
+<li><a href="CHANGES.html">Releases</a></li>
21
+</ul>
22
+</div>
23
+<div class="body">
24
+<h1>Releases</h1>
25
+<p>This document lists the changes between stable releases.</p>
26
+<p>The version numbers follow <a href="http://semver.org/spec/v2.0.0.html">semantic versioning</a>.</p>
27
+<h2 id="v1.2.0">gcc‑lua 1.2.0 (2013-12-12)</h2>
28
+<ul>
29
+<li><p>The <code>Makefile</code> detects whether the GCC plugin ABI is C or C++.</p>
30
+<p>The <code>gcc</code> frontend is used for both cases, and the flag <code>-xc++</code> is included when needed.</p></li>
31
+<li><p>Fix missing format strings for the output of plugin errors.</p></li>
32
+<li><p>The make variables <code>CPPFLAGS</code>, <code>CFLAGS</code>, and <code>LDFLAGS</code> may be overriden.</p>
33
+<p>This is useful for setting distribution-specific compiler flags.</p></li>
34
+<li><p>Add <code>node:stub_decl()</code> for types.</p>
35
+<p>This can be used to get a declaration node for struct, union, or enum types.</p></li>
36
+<li><p>Return column number for <code>node:location()</code> with GCC 4.8 or later.</p></li>
37
+<li><p>Add <code>node:uid()</code> for declarations.</p>
38
+<p>The unique identifier is useful for ordering declarations by definition.</p></li>
39
+<li><p>Ensure matching versions of compiler and plugin.</p></li>
40
+<li><p>Support compilation of the plugin for a cross compiler.</p></li>
41
+<li><p>Add <code>gcc.GCC_VERSION</code>.</p></li>
42
+<li><p>Support compilation of the plugin for GCC 4.5.</p></li>
43
+</ul>
44
+<p>Thanks to Dennis Schridde for contributing to this release.</p>
45
+<h2 id="v1.1.0">gcc‑lua 1.1.0 (2013-10-06)</h2>
46
+<ul>
47
+<li><p>The <code>Makefile</code> uses <code>pkg-config</code> to find the Lua headers and library.</p>
48
+<p>For most operating systems, compilation should no longer require any flags.</p></li>
49
+<li><p>Add <code>node:operand()</code> and <code>node:type()</code> for nodes of class <strong>expression</strong>.</p>
50
+<p>These were provided only for <strong>addr_expr</strong> and <strong>modify_expr</strong> nodes before.</p></li>
51
+</ul>
52
+<h2 id="v1.0.0">gcc‑lua 1.0.0 (2013-09-29)</h2>
53
+<ul>
54
+<li>Initial release of the Lua plugin for the GNU Compiler Collection.</li>
55
+</ul>
56
+</div>
57
+<div class="footer">
58
+&copy; Copyright 2012–2014, Peter Colberg.
59
+Created using <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>.
60
+</div>
61
+</body>
62
+</html>

+ 7
- 9
doc/CHANGES.mdwn View File

@@ -1,4 +1,6 @@
1
-% Releases
1
+---
2
+title: Releases
3
+---
2 4
 
3 5
 This document lists the changes between stable releases.
4 6
 
@@ -7,8 +9,7 @@ The version numbers follow [semantic versioning].
7 9
 [semantic versioning]: http://semver.org/spec/v2.0.0.html
8 10
 
9 11
 
10
-gcc‑lua 1.2.0 (2013-12-12) {#v1.2.0}
11
---------------------------
12
+## gcc‑lua 1.2.0 (2013-12-12) {#v1.2.0}
12 13
 
13 14
   * The `Makefile` detects whether the GCC plugin ABI is C or C++.
14 15
 
@@ -40,12 +41,10 @@ gcc‑lua 1.2.0 (2013-12-12) {#v1.2.0}
40 41
 
41 42
   * Support compilation of the plugin for GCC 4.5.
42 43
 
43
-I would like to thank Dennis Schridde for contributing to this release
44
-by reporting bugs, suggesting features, and testing revisions.
44
+Thanks to Dennis Schridde for contributing to this release.
45 45
 
46 46
 
47
-gcc‑lua 1.1.0 (2013-10-06) {#v1.1.0}
48
---------------------------
47
+## gcc‑lua 1.1.0 (2013-10-06) {#v1.1.0}
49 48
 
50 49
   * The `Makefile` uses `pkg-config` to find the Lua headers and library.
51 50
 
@@ -56,7 +55,6 @@ gcc‑lua 1.1.0 (2013-10-06) {#v1.1.0}
56 55
     These were provided only for **addr_expr** and **modify_expr** nodes before.
57 56
 
58 57
 
59
-gcc‑lua 1.0.0 (2013-09-29) {#v1.0.0}
60
---------------------------
58
+## gcc‑lua 1.0.0 (2013-09-29) {#v1.0.0}
61 59
 
62 60
   * Initial release of the Lua plugin for the GNU Compiler Collection.

+ 54
- 0
doc/INSTALL.html View File

@@ -0,0 +1,54 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+<head>
4
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+  <meta http-equiv="Content-Style-Type" content="text/css" />
6
+  <meta name="generator" content="pandoc" />
7
+  <meta name="author" content="Peter Colberg" />
8
+  <title>Installing &mdash; Lua plugin for the GNU Compiler Collection</title>
9
+  <style type="text/css">code{white-space: pre;}</style>
10
+  <link rel="stylesheet" href="pandoc.css" type="text/css" />
11
+</head>
12
+<body>
13
+<div class="header">
14
+<ul>
15
+<li><a href="index.html">Lua plugin for GCC</a></li>
16
+<li><a href="INSTALL.html">Installing</a></li>
17
+<li><a href="README.html">User's Guide</a></li>
18
+<li><a href="reference.html">Reference</a></li>
19
+<li><a href="https://lists.colberg.org/listinfo/gcc-lua">Mailing list</a></li>
20
+<li><a href="CHANGES.html">Releases</a></li>
21
+</ul>
22
+</div>
23
+<div class="body">
24
+<h1>Installing</h1>
25
+<p>The Lua plugin for GCC is available from a <a href="http://git.colberg.org/gcc-lua">git repository</a>:</p>
26
+<pre><code>git clone http://git.colberg.org/gcc-lua</code></pre>
27
+<p>In the repository, checkout the latest release version:</p>
28
+<pre><code>git checkout 1.2.0</code></pre>
29
+<p>If you have GnuPG, verify that the tag is signed by the following key:</p>
30
+<pre><code>git tag -v 1.2.0</code></pre>
31
+<pre><code>Primary key fingerprint: 2997 6EC2 2BD1 EBBC CC77  F3A6 183B D5ED 3527 8611
32
+     Subkey fingerprint: 983B F9D0 F02A 6014 0CEC  529F 767E 12A8 C92A 31CB</code></pre>
33
+<p>To compile the plugin, run:</p>
34
+<pre><code>make</code></pre>
35
+<p>A distribution may ship the GCC plugin development headers in a separate package. The Debian distribution, for example, provides the package gcc-4.7-plugin-dev for GCC 4.7.</p>
36
+<p>To compile the plugin using a specific version of the GNU compiler, override the make variable <code>CC</code>:</p>
37
+<pre><code>make CC=gcc-4.8</code></pre>
38
+<p>To compile the plugin for use with a cross compiler of the same version:</p>
39
+<pre><code>make CC=gcc-4.7 CROSS=arm-linux-gnueabihf-</code></pre>
40
+<p>To compile the plugin for use with a cross compiler of a different version:</p>
41
+<pre><code>make HOST_CC=gcc-4.8 TARGET_CC=arm-linux-gnueabihf-gcc-4.7</code></pre>
42
+<p>By default, <code>pkg-config</code> is used to find the Lua library.</p>
43
+<p>If the Lua library cannot be found, override <code>LUACFLAGS</code> and <code>LUALIBS</code>:</p>
44
+<pre><code>make LUACFLAGS=&quot;-I/usr/include/lua5.1&quot; LUALIBS=&quot;-L/usr/lib -llua5.1&quot;</code></pre>
45
+<p>The plugin is accompanied by a test suite:</p>
46
+<pre><code>make test</code></pre>
47
+<p>The make variables <code>CC</code>, <code>CROSS</code>, or <code>TARGET_CC</code> also apply to the test suite.</p>
48
+</div>
49
+<div class="footer">
50
+&copy; Copyright 2012–2014, Peter Colberg.
51
+Created using <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>.
52
+</div>
53
+</body>
54
+</html>

+ 4
- 2
doc/INSTALL.mdwn View File

@@ -1,6 +1,8 @@
1
-% Installing
1
+---
2
+title: Installing
3
+---
2 4
 
3
-gcc‑lua is available from a [git repository]:
5
+The Lua plugin for GCC is available from a [git repository]:
4 6
 
5 7
 ~~~
6 8
 git clone http://git.colberg.org/gcc-lua

+ 4
- 1
doc/Makefile View File

@@ -1,11 +1,14 @@
1 1
 html: CHANGES.html INSTALL.html README.html index.html reference.html
2 2
 
3 3
 %.html: %.mdwn pandoc.html
4
-	pandoc --template=pandoc.html --css=pandoc.css --toc -o $@ $<
4
+	pandoc --template=pandoc.html --css=pandoc.css --toc --toc-depth=2 -o $@ $<
5 5
 
6 6
 index.html: index.mdwn pandoc.html
7 7
 	pandoc --template=pandoc.html --css=pandoc.css -V pagetitle= -o $@ $<
8 8
 
9
+CHANGES.html: CHANGES.mdwn pandoc.html
10
+	pandoc --template=pandoc.html --css=pandoc.css -o $@ $<
11
+
9 12
 pandoc.html: contents.mdwn pandoc.html.in
10 13
 	pandoc --template=pandoc.html.in -o $@ $<
11 14
 

+ 80
- 0
doc/README.html View File

@@ -0,0 +1,80 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+<head>
4
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+  <meta http-equiv="Content-Style-Type" content="text/css" />
6
+  <meta name="generator" content="pandoc" />
7
+  <meta name="author" content="Peter Colberg" />
8
+  <title>User's Guide &mdash; Lua plugin for the GNU Compiler Collection</title>
9
+  <style type="text/css">code{white-space: pre;}</style>
10
+  <style type="text/css">
11
+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
12
+  margin: 0; padding: 0; vertical-align: baseline; border: none; }
13
+table.sourceCode { width: 100%; line-height: 100%; }
14
+td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
15
+td.sourceCode { padding-left: 5px; }
16
+code > span.kw { color: #007020; font-weight: bold; }
17
+code > span.dt { color: #902000; }
18
+code > span.dv { color: #40a070; }
19
+code > span.bn { color: #40a070; }
20
+code > span.fl { color: #40a070; }
21
+code > span.ch { color: #4070a0; }
22
+code > span.st { color: #4070a0; }
23
+code > span.co { color: #60a0b0; font-style: italic; }
24
+code > span.ot { color: #007020; }
25
+code > span.al { color: #ff0000; font-weight: bold; }
26
+code > span.fu { color: #06287e; }
27
+code > span.er { color: #ff0000; font-weight: bold; }
28
+  </style>
29
+  <link rel="stylesheet" href="pandoc.css" type="text/css" />
30
+</head>
31
+<body>
32
+<div class="header">
33
+<ul>
34
+<li><a href="index.html">Lua plugin for GCC</a></li>
35
+<li><a href="INSTALL.html">Installing</a></li>
36
+<li><a href="README.html">User's Guide</a></li>
37
+<li><a href="reference.html">Reference</a></li>
38
+<li><a href="https://lists.colberg.org/listinfo/gcc-lua">Mailing list</a></li>
39
+<li><a href="CHANGES.html">Releases</a></li>
40
+</ul>
41
+</div>
42
+<div class="body">
43
+<h1>User's Guide</h1>
44
+<div class="toc">
45
+<ul>
46
+<li><a href="#resources">Resources</a></li>
47
+</ul>
48
+</div>
49
+<p>Consider the following C source file <code>hello.c</code>:</p>
50
+<pre class="sourceCode c"><code class="sourceCode c"><span class="dt">static</span> <span class="dt">const</span> <span class="dt">char</span> hello[] = <span class="st">&quot;Hello, World!&quot;</span>;</code></pre>
51
+<p>We retrieve the string constant using a Lua script <code>hello.lua</code>:</p>
52
+<pre class="sourceCode lua"><code class="sourceCode lua"><span class="kw">local</span> gcc <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">&quot;gcc&quot;</span><span class="ot">)</span>
53
+
54
+<span class="co">-- send assembler output to /dev/null</span>
55
+gcc<span class="ot">.</span>set_asm_file_name<span class="ot">(</span>gcc<span class="ot">.</span>HOST_BIT_BUCKET<span class="ot">)</span>
56
+
57
+<span class="co">-- invoke Lua function after translation unit has been parsed</span>
58
+gcc<span class="ot">.</span>register_callback<span class="ot">(</span>gcc<span class="ot">.</span>PLUGIN_FINISH_UNIT<span class="ot">,</span> <span class="kw">function</span><span class="ot">()</span>
59
+  <span class="co">-- get global variables in reverse order of declaration</span>
60
+  <span class="kw">local</span> vars <span class="ot">=</span> gcc<span class="ot">.</span>get_variables<span class="ot">()</span>
61
+  <span class="kw">for</span> i <span class="ot">=</span> <span class="ot">#</span>vars<span class="ot">,</span> <span class="dv">1</span><span class="ot">,</span> <span class="ot">-</span><span class="dv">1</span> <span class="kw">do</span>
62
+    <span class="co">-- initial value is a string constant</span>
63
+    <span class="fu">print</span><span class="ot">(</span>vars<span class="ot">[</span>i<span class="ot">]</span>:initial<span class="ot">()</span>:value<span class="ot">())</span>
64
+  <span class="kw">end</span>
65
+<span class="kw">end</span><span class="ot">)</span></code></pre>
66
+<p>The plugin is loaded into GCC by passing its path to <code>-fplugin</code>:</p>
67
+<pre><code>gcc -S hello.c -fplugin=./gcc/gcclua.so -fplugin-arg-gcclua-script=hello.lua</code></pre>
68
+<p>For detailed examples, please refer to the source code of the test suite.</p>
69
+<h2 id="resources">Resources</h2>
70
+<p>The <a href="http://gcc.gnu.org/onlinedocs/gccint/Plugins.html">Plugins</a> section of the <a href="http://gcc.gnu.org/onlinedocs/gccint/">GCC Internals</a> documentation explains writing, building and loading plugins. The <a href="http://gcc.gnu.org/onlinedocs/gccint/GENERIC.html">GENERIC</a> section describes the format of abstract syntax trees.</p>
71
+<p>Relevant GCC source files are <code>gcc/tree.h</code>, <code>gcc/tree.def</code> and <code>gcc/tree-dump.c</code> for the GENERIC format, and <code>gcc/cgraph.h</code> for entry points to global variable, function and type declarations.</p>
72
+<p>The <a href="http://gcc.gnu.org/wiki/plugins">GCC Wiki</a> links to documentation and existing plugins.</p>
73
+<p>Boris Kolpackov has written a series on Parsing C++ with GCC plugins: <a href="http://www.codesynthesis.com/~boris/blog/2010/05/03/parsing-cxx-with-gcc-plugin-part-1/">[1]</a>, <a href="http://www.codesynthesis.com/~boris/blog/2010/05/10/parsing-cxx-with-gcc-plugin-part-2/">[2]</a>, <a href="http://www.codesynthesis.com/~boris/blog/2010/05/17/parsing-cxx-with-gcc-plugin-part-3/">[3]</a>.</p>
74
+</div>
75
+<div class="footer">
76
+&copy; Copyright 2012–2014, Peter Colberg.
77
+Created using <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>.
78
+</div>
79
+</body>
80
+</html>

+ 3
- 1
doc/README.mdwn View File

@@ -1,4 +1,6 @@
1
-% User's Guide
1
+---
2
+title: User's Guide
3
+---
2 4
 
3 5
 Consider the following C source file `hello.c`:
4 6
 

+ 11
- 11
doc/contents.mdwn View File

@@ -1,12 +1,12 @@
1
-% Lua plugin for the GNU Compiler Collection
2
-% Peter Colberg
3
-% 2012-2013
1
+---
2
+title: Lua plugin for the GNU Compiler Collection
3
+author: Peter Colberg
4
+date: "2012–2014"
5
+---
4 6
 
5
-[![](gcc-lua.png "Lua plugin for the GNU Compiler Collection")](index.html)
6
-
7
-* [Lua plugin for GCC](index.html)
8
-    + [Installing](INSTALL.html)
9
-    + [User's Guide](README.html)
10
-    + [Reference](reference.html)
11
-    + [Mailing list](https://lists.colberg.org/listinfo/gcc-lua)
12
-    + [Releases](CHANGES.html)
7
+- [Lua plugin for GCC](index.html)
8
+- [Installing](INSTALL.html)
9
+- [User's Guide](README.html)
10
+- [Reference](reference.html)
11
+- [Mailing list](https://lists.colberg.org/listinfo/gcc-lua)
12
+- [Releases](CHANGES.html)

+ 34
- 0
doc/index.html View File

@@ -0,0 +1,34 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+<head>
4
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+  <meta http-equiv="Content-Style-Type" content="text/css" />
6
+  <meta name="generator" content="pandoc" />
7
+  <meta name="author" content="Peter Colberg" />
8
+  <title>Lua plugin for the GNU Compiler Collection</title>
9
+  <style type="text/css">code{white-space: pre;}</style>
10
+  <link rel="stylesheet" href="pandoc.css" type="text/css" />
11
+</head>
12
+<body>
13
+<div class="header">
14
+<ul>
15
+<li><a href="index.html">Lua plugin for GCC</a></li>
16
+<li><a href="INSTALL.html">Installing</a></li>
17
+<li><a href="README.html">User's Guide</a></li>
18
+<li><a href="reference.html">Reference</a></li>
19
+<li><a href="https://lists.colberg.org/listinfo/gcc-lua">Mailing list</a></li>
20
+<li><a href="CHANGES.html">Releases</a></li>
21
+</ul>
22
+</div>
23
+<div class="body">
24
+<h1>About the Lua plugin for the GNU Compiler Collection</h1>
25
+<p><a href="http://colberg.org/gcc-lua/"><img src="gcc-lua.png" title="Lua plugin for GCC" /></a> The <a href="http://colberg.org/gcc-lua/">Lua plugin for GCC</a> extends the <a href="http://gcc.gnu.org/">GNU Compiler Collection</a> with the ability to run Lua scripts. The plugin provides an interface to register callback functions for plugin events, and inspect the abstract syntax tree of a translation unit. The plugin is useful for static C code analysis. The Lua plugin for GCC supports GCC 4.5 to 4.9 and <a href="http://www.lua.org/">Lua</a> 5.1 or 5.2 or <a href="http://luajit.org/">LuaJIT</a>.</p>
26
+<h2 id="acknowledgements">Acknowledgements</h2>
27
+<p>I would like to thank David Malcolm, author of the <a href="http://gcc-python-plugin.readthedocs.org">GCC Python plugin</a>, whose code and documentation was of invaluable aid in comprehending the GCC internal API.</p>
28
+</div>
29
+<div class="footer">
30
+&copy; Copyright 2012–2014, Peter Colberg.
31
+Created using <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>.
32
+</div>
33
+</body>
34
+</html>

+ 10
- 7
doc/index.mdwn View File

@@ -1,12 +1,15 @@
1
-% About the Lua plugin for the GNU Compiler Collection
1
+---
2
+title: About the Lua plugin for the GNU Compiler Collection
3
+---
2 4
 
3
-[gcc‑lua] extends the [GNU Compiler Collection] with the ability to run Lua
4
-scripts. The plugin provides an interface to register callback functions for
5
-plugin events, and inspect the abstract syntax tree of a translation unit. The
6
-plugin is useful for static C code analysis. gcc‑lua supports GCC 4.5 or later,
7
-and, [Lua] 5.1 or 5.2, or [LuaJIT].
5
+[![](gcc-lua.png "Lua plugin for GCC")][Lua plugin for GCC]
6
+The [Lua plugin for GCC] extends the [GNU Compiler Collection] with the ability
7
+to run Lua scripts. The plugin provides an interface to register callback
8
+functions for plugin events, and inspect the abstract syntax tree of a
9
+translation unit. The plugin is useful for static C code analysis. The Lua
10
+plugin for GCC supports GCC 4.5 to 4.9 and [Lua] 5.1 or 5.2 or [LuaJIT].
8 11
 
9
-[gcc‑lua]: http://colberg.org/gcc-lua/
12
+[Lua plugin for GCC]: http://colberg.org/gcc-lua/
10 13
 [GNU Compiler Collection]: http://gcc.gnu.org/
11 14
 [Lua]: http://www.lua.org/
12 15
 [LuaJIT]: http://luajit.org/

+ 85
- 86
doc/pandoc.css View File

@@ -1,6 +1,6 @@
1 1
 /*
2 2
  * Stylesheet for Pandoc.
3
- * Copyright © 2013 Peter Colberg.
3
+ * Copyright © 2013–2014 Peter Colberg.
4 4
  * For conditions of distribution and use, see copyright notice in LICENSE.
5 5
  */
6 6
 
@@ -19,115 +19,61 @@ body {
19 19
 
20 20
 div.header ul {
21 21
   display: table;
22
-  list-style: none;
23 22
   margin: 0;
24
-  padding: 0 0 0 10px;
25
-  height: 2.5em;
23
+  padding: 0;
26 24
 }
27 25
 
28 26
 div.header ul li {
29 27
   display: table-cell;
30
-  vertical-align: middle;
31 28
 }
32 29
 
33 30
 div.header ul li a {
34
-  font-weight: bold;
31
+  display: inline-block;
35 32
   color: #fff;
36 33
   text-shadow: 0 1px rgba(0, 0, 0, 0.5);
37
-  margin: 0 0 0 4px;
38
-  padding: 3px 6px;
39
-  border: none;
40
-  border-radius: 3px;
34
+  line-height: 2em;
35
+  padding: 0 0.5em;
36
+  border-bottom: none;
37
+}
38
+
39
+div.header ul li:first-child a {
40
+  font-weight: bold;
41 41
 }
42 42
 
43 43
 div.header ul li a:hover {
44 44
   background-color: #7a8ad1;
45
-  border-radius: 3px;
46 45
 }
47 46
 
48
-div.columns {
49
-  display: table;
50
-  table-layout: fixed;
51
-  width: 100%;
47
+div.body {
52 48
   color: #000;
49
+  background-color: #fff;
50
+  padding: 0.5em 1.3em;
51
+  border-top: 1px solid #ccc;
52
+  border-bottom: 1px solid #ccc;
53 53
 }
54 54
 
55
-div.columns div {
56
-  display: table-cell;
57
-  vertical-align: top;
58
-}
59
-
60
-div.sidebar {
61
-  background-color: #e8e9ef;
62
-  width: 12em;
63
-}
64
-
65
-div.sidebar ul {
66
-  list-style: none;
67
-  font-size: 1em;
68
-  margin: 1em;
55
+div.toc ul {
56
+  margin: 0.5em 0 1em 0;
69 57
   padding: 0;
58
+  font-size: 0.9em;
70 59
 }
71 60
 
72
-div.sidebar ul ul {
73
-  margin: 0;
74
-}
75
-
76
-div.sidebar ul ul ul {
77
-  margin-left: 1em;
78
-}
79
-
80
-div.sidebar a {
81
-  border-bottom: none;
61
+div.toc ul li {
62
+  display: inline;
82 63
 }
83 64
 
84
-div.sidebar ul ul li {
85
-  overflow: hidden;
86
-  white-space: nowrap;
87
-  text-overflow: ellipsis;
88
-  position: relative;
65
+div.toc ul li:after {
66
+  padding: 0 0.2em 0 0.3em;
67
+  content: '\b7';
89 68
 }
90 69
 
91
-div.sidebar ul ul li:hover {
92
-  overflow: visible;
93
-}
94
-
95
-div.sidebar ul li a {
96
-  font-weight: bold;
97
-  color: #444;
98
-}
99
-
100
-div.sidebar ul li a:hover {
101
-  color: #111;
102
-  border-bottom: 1px solid #111;
103
-}
104
-
105
-div.sidebar ul ul li a {
106
-  font-weight: normal;
107
-  background-color: #e8e9ef;
108
-  padding: 0 5px;
109
-  border: 1px solid transparent;
110
-  border-radius: 3px;
111
-}
112
-
113
-div.sidebar ul ul li a:hover {
114
-  border: 1px solid #888;
115
-}
116
-
117
-div.sidebar p {
118
-  text-align: center;
119
-}
120
-
121
-div.body {
122
-  background-color: #fff;
123
-  padding: 0.5em 1.3em;
124
-  border-left: 1px solid #ccc;
125
-  border-bottom: 1px solid #ccc;
70
+div.toc ul li:last-child:after {
71
+  content: none;
126 72
 }
127 73
 
128 74
 div.footer {
75
+  text-shadow: 0 1px rgba(0, 0, 0, 0.5);
129 76
   font-size: 0.8em;
130
-  color: #fff;
131 77
   text-align: center;
132 78
   padding: 0 2em 2em 2em;
133 79
 }
@@ -140,6 +86,11 @@ div.footer a:hover {
140 86
   border-bottom: 1px solid #7a8ad1;
141 87
 }
142 88
 
89
+div.figure {
90
+  text-align: center;
91
+  font-size: 0.9em;
92
+}
93
+
143 94
 a {
144 95
   color: #444;
145 96
   text-decoration: none;
@@ -170,7 +121,7 @@ h1 a {
170 121
 }
171 122
 
172 123
 h2 {
173
-  margin: 2em 0 0.2em 0;
124
+  margin: 2em 0 1em 0;
174 125
   font-size: 1.35em;
175 126
   padding: 0;
176 127
   color: #465158;
@@ -182,7 +133,7 @@ h2 a {
182 133
 }
183 134
 
184 135
 h3 {
185
-  margin: 1em 0 -0.3em 0;
136
+  margin: 1em 0 0.8em 0;
186 137
   font-size: 1.2em;
187 138
   color: #6c818f;
188 139
 }
@@ -192,7 +143,45 @@ h3 a {
192 143
   border-bottom: none;
193 144
 }
194 145
 
195
-cite, code, dt, pre {
146
+h4 {
147
+  margin: 1em 0 0.8em 0;
148
+  font-size: 1.1em;
149
+  color: #6c818f;
150
+}
151
+
152
+h4 a {
153
+  color: #6c818f;
154
+  border-bottom: none;
155
+}
156
+
157
+p, dl, ul {
158
+  margin-top: 0.5em;
159
+  margin-bottom: 1em;
160
+}
161
+
162
+p {
163
+  overflow: auto;
164
+}
165
+
166
+li p {
167
+  overflow: visible;
168
+}
169
+
170
+p img {
171
+  float: left;
172
+  margin-right: 1.3em;
173
+}
174
+
175
+ul {
176
+  padding-left: 2em;
177
+}
178
+
179
+ul ul {
180
+  margin-top: 0;
181
+  margin-bottom: 0;
182
+}
183
+
184
+cite, code, pre {
196 185
   font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
197 186
 }
198 187
 
@@ -201,13 +190,16 @@ cite, code {
201 190
 }
202 191
 
203 192
 dt {
204
-  margin-bottom: 0.5em;
205 193
   font-weight: bold;
206 194
   color: #444;
207 195
 }
208 196
 
209
-dd p {
210
-  margin-top: 0;
197
+dt code {
198
+  font-size: 1em;
199
+}
200
+
201
+dd {
202
+  margin-left: 2em;
211 203
 }
212 204
 
213 205
 pre {
@@ -225,3 +217,10 @@ pre {
225 217
 pre code {
226 218
   font-size: 1em;
227 219
 }
220
+
221
+table {
222
+  width: 100%;
223
+  margin: 1em 0;
224
+  border-spacing: 0;
225
+  border-collapse: collapse;
226
+}

+ 6
- 15
doc/pandoc.html.in View File

@@ -39,27 +39,18 @@ $$for(include-before)$$
39 39
 $$include-before$$
40 40
 $$endfor$$
41 41
 <div class="header">
42
-<ul>
43
-<li><a href="index.html">$title$</a></li>
44
-</ul>
45
-</div>
46
-<div class="columns">
47
-<div class="sidebar">
48 42
 $body$
49
-$$if(toc)$$
50
-<ul>
51
-<li><a href="#">$$title$$</a>
52
-$$toc$$
53
-</li>
54
-</ul>
55
-$$endif$$
56 43
 </div>
57 44
 <div class="body">
58 45
 $$if(title)$$
59
-<h1 class="title">$$title$$</h1>
46
+<h1>$$title$$</h1>
60 47
 $$endif$$
61
-$$body$$
48
+$$if(toc)$$
49
+<div class="toc">
50
+$$toc$$
62 51
 </div>
52
+$$endif$$
53
+$$body$$
63 54
 </div>
64 55
 <div class="footer">
65 56
 &copy; Copyright $date$$for(author)$, $author$$endfor$.

+ 628
- 0
doc/reference.html View File

@@ -0,0 +1,628 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+<head>
4
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+  <meta http-equiv="Content-Style-Type" content="text/css" />
6
+  <meta name="generator" content="pandoc" />
7
+  <meta name="author" content="Peter Colberg" />
8
+  <title>Reference &mdash; Lua plugin for the GNU Compiler Collection</title>
9
+  <style type="text/css">code{white-space: pre;}</style>
10
+  <style type="text/css">
11
+table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
12
+  margin: 0; padding: 0; vertical-align: baseline; border: none; }
13
+table.sourceCode { width: 100%; line-height: 100%; }
14
+td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
15
+td.sourceCode { padding-left: 5px; }
16
+code > span.kw { color: #007020; font-weight: bold; }
17
+code > span.dt { color: #902000; }
18
+code > span.dv { color: #40a070; }
19
+code > span.bn { color: #40a070; }
20
+code > span.fl { color: #40a070; }
21
+code > span.ch { color: #4070a0; }
22
+code > span.st { color: #4070a0; }
23
+code > span.co { color: #60a0b0; font-style: italic; }
24
+code > span.ot { color: #007020; }
25
+code > span.al { color: #ff0000; font-weight: bold; }
26
+code > span.fu { color: #06287e; }
27
+code > span.er { color: #ff0000; font-weight: bold; }
28
+  </style>
29
+  <link rel="stylesheet" href="pandoc.css" type="text/css" />
30
+</head>
31
+<body>
32
+<div class="header">
33
+<ul>
34
+<li><a href="index.html">Lua plugin for GCC</a></li>
35
+<li><a href="INSTALL.html">Installing</a></li>
36
+<li><a href="README.html">User's Guide</a></li>
37
+<li><a href="reference.html">Reference</a></li>
38
+<li><a href="https://lists.colberg.org/listinfo/gcc-lua">Mailing list</a></li>
39
+<li><a href="CHANGES.html">Releases</a></li>
40
+</ul>
41
+</div>
42
+<div class="body">
43
+<h1>Reference</h1>
44
+<div class="toc">
45
+<ul>
46
+<li><a href="#plugin-events">Plugin Events</a></li>
47
+<li><a href="#globals">Globals</a></li>
48
+<li><a href="#tree-nodes">Tree Nodes</a></li>
49
+</ul>
50
+</div>
51
+<h2 id="plugin-events">Plugin Events</h2>
52
+<dl>
53
+<dt>gcc.register_callback(event, <code>f)</code></dt>
54
+<dd><p>Registers the function <code>f</code> for the given plugin event.</p>
55
+<p>The following plugin events are supported:</p>
56
+<dl>
57
+<dt><code>gcc.PLUGIN_START_UNIT</code></dt>
58
+<dd><p>Event triggered before a translation unit is parsed.</p>
59
+<p>The callback function receives no arguments.</p>
60
+</dd>
61
+<dt><code>gcc.PLUGIN_PRE_GENERICIZE</code></dt>
62
+<dd><p>Event triggered after a function definition has been parsed.</p>
63
+<p>The callback function receives a <strong>function_decl</strong> node as its first argument.</p>
64
+</dd>
65
+<dt><code>gcc.PLUGIN_FINISH_DECL</code></dt>
66
+<dd><p>Event triggered after a declaration has been parsed.</p>
67
+<p>The callback function receives a node of the class <strong>declaration</strong> as its first argument.</p>
68
+<p><em>This event is available with GCC 4.7 or later.</em></p>
69
+</dd>
70
+<dt><code>gcc.PLUGIN_FINISH_TYPE</code></dt>
71
+<dd><p>Event triggered after a struct or union type has been parsed.</p>
72
+<p>The callback function receives a node of the class <strong>type</strong> as its first argument.</p>
73
+</dd>
74
+<dt><code>gcc.PLUGIN_FINISH_UNIT</code></dt>
75
+<dd><p>Event triggered after a translation unit has been parsed.</p>
76
+<p>The callback function receives no arguments.</p>
77
+</dd>
78
+</dl>
79
+</dd>
80
+</dl>
81
+<h2 id="globals">Globals</h2>
82
+<dl>
83
+<dt><code>gcc.get_asm_file_name()</code></dt>
84
+<dd><p>Returns assembly output filename.</p>
85
+</dd>
86
+<dt><code>gcc.set_asm_file_name(filename)</code></dt>
87
+<dd><p>Sets assembly output filename.</p>
88
+<dl>
89
+<dt><code>gcc.HOST_BIT_BUCKET</code></dt>
90
+<dd>Filename of a device that discards data written to it, for example <strong>&quot;/dev/null&quot;</strong>.
91
+</dd>
92
+</dl>
93
+</dd>
94
+<dt><code>gcc.get_main_input_basename()</code></dt>
95
+<dd><p>Returns main input filename with any leading directory components removed.</p>
96
+<p><em>This function is available with GCC 4.6 or later.</em></p>
97
+</dd>
98
+<dt><code>gcc.get_main_input_filename()</code></dt>
99
+<dd><p>Returns main input filename.</p>
100
+</dd>
101
+<dt><code>gcc.get_translation_units()</code></dt>
102
+<dd><p>Returns translation units as a sequence of <strong>translation_unit_decl</strong> nodes.</p>
103
+<p><em>This function is available with GCC 4.6 or later.</em></p>
104
+</dd>
105
+<dt><code>gcc.get_functions()</code></dt>
106
+<dd><p>Returns function declarations in translation unit as a <em>reverse</em> sequence of <strong>function_decl</strong> nodes.</p>
107
+</dd>
108
+<dt><code>gcc.get_variables()</code></dt>
109
+<dd><p>Returns variable declarations in current translation unit as a <em>reverse</em> sequence of <strong>var_decl</strong> nodes.</p>
110
+</dd>
111
+<dt><code>gcc.get_identifier(s)</code></dt>
112
+<dd><p>Returns identifier for given string as an <strong>identifier_node</strong> node.</p>
113
+</dd>
114
+<dt><code>gcc.define_macro(s)</code></dt>
115
+<dd><p>Defines preprocessor macro.</p>
116
+<pre class="sourceCode lua"><code class="sourceCode lua">gcc<span class="ot">.</span>define_macro<span class="ot">(</span><span class="st">&quot;TURTLES&quot;</span><span class="ot">)</span>
117
+gcc<span class="ot">.</span>define_macro<span class="ot">(</span><span class="st">&quot;PI=3&quot;</span><span class="ot">)</span>
118
+gcc<span class="ot">.</span>define_macro<span class="ot">(</span><span class="st">&quot;SIN(x)=x&quot;</span><span class="ot">)</span></code></pre>
119
+</dd>
120
+<dt><code>gcc.GCC_VERSION</code></dt>
121
+<dd><p>A number corresponding to the GCC version the plugin was built for, e.g., <strong>4008</strong> for GCC 4.8.</p>
122
+</dd>
123
+</dl>
124
+<h2 id="tree-nodes">Tree Nodes</h2>
125
+<p>Any <a href="http://gcc.gnu.org/onlinedocs/gccint/GENERIC.html">tree node</a> provides the following methods:</p>
126
+<dl>
127
+<dt><code>node:class()</code></dt>
128
+<dd><p>Returns tree code class as a string.</p>
129
+</dd>
130
+<dt><code>node:code()</code></dt>
131
+<dd><p>Returns tree code as a string.</p>
132
+</dd>
133
+</dl>
134
+<h3 id="declarations">Declarations</h3>
135
+<p>This tree code class is used for declarations.</p>
136
+<dl>
137
+<dt><code>declaration</code></dt>
138
+<dd><p>The class provides the following methods:</p>
139
+<dl>
140
+<dt><code>node:align()</code></dt>
141
+<dd><p>Returns alignment in bits.</p>
142
+</dd>
143
+<dt><code>node:align_unit()</code></dt>
144
+<dd><p>Returns alignment in bytes.</p>
145
+</dd>
146
+<dt><code>node:assembler_name()</code></dt>
147
+<dd><p>Returns tree node of assembler name.</p>
148
+</dd>
149
+<dt><code>node:artificial()</code></dt>
150
+<dd><p>Returns <strong>true</strong> if declaration is a compiler-generated entity, or <strong>false</strong> otherwise.</p>
151
+</dd>
152
+<dt><code>node:attributes()</code></dt>
153
+<dd><p>Returns tree node of attributes.</p>
154
+</dd>
155
+<dt><code>node:chain()</code></dt>
156
+<dd><p>Returns tree node of next declaration.</p>
157
+</dd>
158
+<dt><code>node:name()</code></dt>
159
+<dd><p>Returns name as an <strong>identifier_node</strong> node.</p>
160
+</dd>
161
+<dt><code>node:location()</code></dt>
162
+<dd><p>Returns source filename and line number.</p>
163
+<p>With GCC 4.8 or later, further returns column number.</p>
164
+</dd>
165
+<dt><code>node:size()</code></dt>
166
+<dd><p>Returns size in bits.</p>
167
+</dd>
168
+<dt><code>node:size_unit()</code></dt>
169
+<dd><p>Returns size in bytes.</p>
170
+</dd>
171
+<dt><code>node:type()</code></dt>
172
+<dd><p>Returns tree node of type of declaration.</p>
173
+</dd>
174
+<dt><code>node:uid()</code></dt>
175
+<dd><p>Returns unique number.</p>
176
+</dd>
177
+<dt><code>node:user_align()</code></dt>
178
+<dd><p>Returns <strong>true</strong> if declaration has user-defined alignment, or <strong>false</strong> otherwise.</p>
179
+</dd>
180
+</dl>
181
+<p>The following tree codes provide further methods:</p>
182
+<dl>
183
+<dt><code>const_decl</code></dt>
184
+<dd><p>C enum value.</p>
185
+<dl>
186
+<dt><code>node:initial()</code></dt>
187
+<dd>Returns tree node of constant value.
188
+</dd>
189
+</dl>
190
+</dd>
191
+<dt><code>field_decl</code></dt>
192
+<dd><p>C struct or union field.</p>
193
+<dl>
194
+<dt><code>node:bit_field()</code></dt>
195
+<dd><p>Returns <strong>true</strong> if field is a bitfield, or <strong>false</strong> otherwise.</p>
196
+</dd>
197
+<dt><code>node:bit_field_type()</code></dt>
198
+<dd><p>Returns tree node of type specified for a bitfield.</p>
199
+</dd>
200
+<dt><code>node:initial()</code></dt>
201
+<dd><p>Returns initial value.</p>
202
+</dd>
203
+</dl>
204
+</dd>
205
+<dt><code>function_decl</code></dt>
206
+<dd><p>Function declaration.</p>
207
+<dl>
208
+<dt><code>node:args()</code></dt>
209
+<dd><p>Returns tree node of argument declarations.</p>
210
+</dd>
211
+<dt><code>node:body()</code></dt>
212
+<dd><p>Returns tree node of body expression.</p>
213
+</dd>
214
+<dt><code>node:external()</code></dt>
215
+<dd><p>Returns <strong>true</strong> if function refers to definition elsewhere, or <strong>false</strong> otherwise.</p>
216
+</dd>
217
+<dt><code>node:public()</code></dt>
218
+<dd><p>Returns <strong>true</strong> if function is accessible outside translation unit, or <strong>false</strong> otherwise.</p>
219
+</dd>
220
+</dl>
221
+</dd>
222
+<dt><code>translation_unit_decl</code></dt>
223
+<dd><p>Translation unit.</p>
224
+<dl>
225
+<dt><code>node:block()</code></dt>
226
+<dd><p>Returns tree node of block.</p>
227
+</dd>
228
+<dt><code>node:language()</code></dt>
229
+<dd><p>Returns language of translation unit.</p>
230
+<p><em>This function is available with GCC 4.6 or later.</em></p>
231
+</dd>
232
+</dl>
233
+</dd>
234
+<dt><code>type_decl</code></dt>
235
+<dd><p>Type declaration.</p>
236
+<dl>
237
+<dt><code>node:public()</code></dt>
238
+<dd>Returns <strong>true</strong> if type is accessible outside translation unit, or <strong>false</strong> otherwise.
239
+</dd>
240
+</dl>
241
+</dd>
242
+<dt><code>var_decl</code></dt>
243
+<dd><p>Variable declaration.</p>
244
+<dl>
245
+<dt><code>node:external()</code></dt>
246
+<dd><p>Returns <strong>true</strong> if variable refers to definition elsewhere, or <strong>false</strong> otherwise.</p>
247
+</dd>
248
+<dt><code>node:initial()</code></dt>
249
+<dd><p>Returns tree node of initial value.</p>
250
+</dd>
251
+<dt><code>node:public()</code></dt>
252
+<dd><p>Returns <strong>true</strong> if variable is accessible outside translation unit, or <strong>false</strong> otherwise.</p>
253
+</dd>
254
+</dl>
255
+</dd>
256
+</dl>
257
+</dd>
258
+</dl>
259
+<h3 id="types">Types</h3>
260
+<p>This tree code class is used for type objects.</p>
261
+<dl>
262
+<dt><code>type</code></dt>
263
+<dd><p>The class provides the following methods:</p>
264
+<dl>
265
+<dt><code>node:align()</code></dt>
266
+<dd><p>Returns alignment in bits.</p>
267
+</dd>
268
+<dt><code>node:align_unit()</code></dt>
269
+<dd><p>Returns alignment in bytes.</p>
270
+</dd>
271
+<dt><code>node:attributes()</code></dt>
272
+<dd><p>Returns tree node of attributes.</p>
273
+</dd>
274
+<dt><code>node:canonical()</code></dt>
275
+<dd><p>Returns tree node of canonical type.</p>
276
+<p>The canonical type includes qualifiers.</p>
277
+</dd>
278
+<dt><code>node:const()</code></dt>
279
+<dd><p>Returns <strong>true</strong> if type has <code>const</code> qualifier, or <strong>false</strong> otherwise.</p>
280
+</dd>
281
+<dt><code>node:main_variant()</code></dt>
282
+<dd><p>Returns tree node of main variant of type.</p>
283
+<p>The main variant excludes qualifiers.</p>
284
+</dd>
285
+<dt><code>node:name()</code></dt>
286
+<dd><p>Returns tree node of type name.</p>
287
+</dd>
288
+<dt><code>node:packed()</code></dt>
289
+<dd><p>Returns <strong>true</strong> if type has attribute <code>packed</code>.</p>
290
+</dd>
291
+<dt><code>node:restrict()</code></dt>
292
+<dd><p>Returns <strong>true</strong> if type has <code>restrict</code> qualifier, or <strong>false</strong> otherwise.</p>
293
+</dd>
294
+<dt><code>node:size()</code></dt>
295
+<dd><p>Returns size of type in bits.</p>
296
+</dd>
297
+<dt><code>node:size_unit()</code></dt>
298
+<dd><p>Returns size of type in bytes.</p>
299
+</dd>
300
+<dt><code>node:stub_decl()</code></dt>
301
+<dd><p>Returns stub declaration as a <strong>type_decl</strong> node.</p>
302
+</dd>
303
+<dt><code>node:user_align()</code></dt>
304
+<dd><p>Returns <strong>true</strong> if type has user-defined alignment, or <strong>false</strong> otherwise.</p>
305
+</dd>
306
+<dt><code>node:volatile()</code></dt>
307
+<dd><p>Returns <strong>true</strong> if type has <code>volatile</code> qualifier, or <strong>false</strong> otherwise.</p>
308
+</dd>
309
+</dl>
310
+<p>The following tree codes provide further methods:</p>
311
+<dl>
312
+<dt><code>array_type</code></dt>
313
+<dd><p>Array type.</p>
314
+<dl>
315
+<dt><code>node:domain()</code></dt>
316
+<dd><p>Returns tree node of lower and upper array bounds.</p>
317
+</dd>
318
+<dt><code>node:type()</code></dt>
319
+<dd><p>Returns type of array elements.</p>
320
+</dd>
321
+</dl>
322
+</dd>
323
+<dt><code>enumeral_type</code></dt>
324
+<dd><p>C enum.</p>
325
+<dl>
326
+<dt><code>node:values()</code></dt>
327
+<dd>Returns tree node of enum values.
328
+</dd>
329
+</dl>
330
+<p>The following methods are available with the C++ frontend.</p>
331
+<dl>
332
+<dt><code>node:anonymous()</code></dt>
333
+<dd>Returns <strong>true</strong> if enum is unnamed, or <strong>false</strong> otherwise.
334
+</dd>
335
+</dl>
336
+</dd>
337
+<dt><code>function_type</code></dt>
338
+<dd><p>Function type.</p>
339
+<dl>
340
+<dt><code>node:args()</code></dt>
341
+<dd><p>Returns tree node of argument types.</p>
342
+</dd>
343
+<dt><code>node:type()</code></dt>
344
+<dd><p>Returns tree node of return type.</p>
345
+</dd>
346
+</dl>
347
+</dd>
348
+<dt><code>integer_type</code></dt>
349
+<dd><p>Integer type.</p>
350
+<dl>
351
+<dt><code>node:max()</code></dt>
352
+<dd><p>Returns tree node of maximum value.</p>
353
+</dd>
354
+<dt><code>node:min()</code></dt>
355
+<dd><p>Returns tree node of minimum value.</p>
356
+</dd>
357
+<dt><code>node:unsigned()</code></dt>
358
+<dd><p>Returns <strong>true</strong> if type is unsigned, or <strong>false</strong> otherwise.</p>
359
+</dd>
360
+</dl>
361
+</dd>
362
+<dt><code>pointer_type</code></dt>
363
+<dd><p>Pointer type.</p>
364
+<dl>
365
+<dt><code>node:type()</code></dt>
366
+<dd><p>Returns tree node of pointed type.</p>
367
+</dd>
368
+<dt><code>node:unsigned()</code></dt>
369
+<dd><p>Returns <strong>true</strong> if type is unsigned, or <strong>false</strong> otherwise.</p>
370
+</dd>
371
+</dl>
372
+</dd>
373
+<dt><code>record_type</code></dt>
374
+<dd><p>C struct.</p>
375
+<dl>
376
+<dt><code>node:fields()</code></dt>
377
+<dd>Returns tree node of struct fields.
378
+</dd>
379
+</dl>
380
+<p>The following methods are available with the C++ frontend.</p>
381
+<dl>
382
+<dt><code>node:anonymous()</code></dt>
383
+<dd>Returns <strong>true</strong> if struct is unnamed, or <strong>false</strong> otherwise.
384
+</dd>
385
+</dl>
386
+</dd>
387
+<dt><code>reference_type</code></dt>
388
+<dd><p>Reference type.</p>
389
+<dl>
390
+<dt><code>node:type()</code></dt>
391
+<dd>Returns tree node of referenced type.
392
+</dd>
393
+</dl>
394
+</dd>
395
+<dt><code>union_type</code></dt>
396
+<dd><p>C union.</p>
397
+<dl>
398
+<dt><code>node:fields()</code></dt>
399
+<dd>Returns tree node of union fields.
400
+</dd>
401
+</dl>
402
+<p>The following methods are available with the C++ frontend.</p>
403
+<dl>
404
+<dt><code>node:anonymous()</code></dt>
405
+<dd>Returns <strong>true</strong> if union is unnamed, or <strong>false</strong> otherwise.
406
+</dd>
407
+</dl>
408
+</dd>
409
+<dt><code>vector_type</code></dt>
410
+<dd><p>GCC vector type.</p>
411
+<dl>
412
+<dt><code>node:type()</code></dt>
413
+<dd><p>Returns tree node of vector element type.</p>
414
+</dd>
415
+<dt><code>node:units()</code></dt>
416
+<dd><p>Returns number of vector elements.</p>
417
+</dd>
418
+</dl>
419
+</dd>
420
+</dl>
421
+</dd>
422
+</dl>
423
+<h3 id="constants">Constants</h3>
424
+<p>This tree code class is used for constant values.</p>
425
+<dl>
426
+<dt><code>constant</code></dt>
427
+<dd><p>The class provides the following methods:</p>
428
+<dl>
429
+<dt><code>node:type()</code></dt>
430
+<dd>Returns tree node of type of constant.
431
+</dd>
432
+</dl>
433
+<p>The following tree codes provide further methods:</p>
434
+<dl>
435
+<dt><code>integer_cst</code></dt>
436
+<dd><p>Integer constant.</p>
437
+<dl>
438
+<dt><code>node:value()</code></dt>
439
+<dd>Returns value as a number.
440
+</dd>
441
+</dl>
442
+</dd>
443
+<dt><code>real_cst</code></dt>
444
+<dd><p>Floating-point constant.</p>
445
+<dl>
446
+<dt><code>node:value()</code></dt>
447
+<dd>Returns value as a number.
448
+</dd>
449
+</dl>
450
+</dd>
451
+<dt><code>string_cst</code></dt>
452
+<dd><p>String constant.</p>
453
+<dl>
454
+<dt><code>node:value()</code></dt>
455
+<dd>Returns value as a string.
456
+</dd>
457
+</dl>
458
+</dd>
459
+</dl>
460
+</dd>
461
+</dl>
462
+<h3 id="unary-expressions">Unary expressions</h3>
463
+<p>This tree code class is used for unary arithmetic expressions.</p>
464
+<dl>
465
+<dt><code>unary</code></dt>
466
+<dd><p>The class provides the following methods:</p>
467
+<dl>
468
+<dt><code>node:operand()</code></dt>
469
+<dd><p>Returns tree node of operand.</p>
470
+</dd>
471
+<dt><code>node:type()</code></dt>
472
+<dd><p>Returns tree node of type of expression.</p>
473
+</dd>
474
+</dl>
475
+</dd>
476
+</dl>
477
+<h3 id="binary-expressions">Binary expressions</h3>
478
+<p>This tree code class is used for binary arithmetic expressions.</p>
479
+<dl>
480
+<dt><code>binary</code></dt>
481
+<dd><p>The class provides the following methods:</p>
482
+<dl>
483
+<dt><code>node:operand()</code></dt>
484
+<dd><p>Returns tree nodes of operands.</p>
485
+</dd>
486
+<dt><code>node:type()</code></dt>
487
+<dd><p>Returns tree node of type of expression.</p>
488
+</dd>
489
+</dl>
490
+</dd>
491
+</dl>
492
+<h3 id="statement-expressions">Statement expressions</h3>
493
+<p>This tree code class is used for statement expressions.</p>
494
+<dl>
495
+<dt><code>statement</code></dt>
496
+<dd><p>The following tree codes provide further methods:</p>
497
+<dl>
498
+<dt><code>return_expr</code></dt>
499
+<dd><p>Return statement.</p>
500
+<dl>
501
+<dt><code>node:operand()</code></dt>
502
+<dd>Returns tree node of return value.
503
+</dd>
504
+</dl>
505
+</dd>
506
+</dl>
507
+</dd>
508
+</dl>
509
+<h3 id="variable-length-expressions">Variable-length expressions</h3>
510
+<p>This tree code class is used for function calls, and expressions with a variable number of operands.</p>
511
+<dl>
512
+<dt><code>vl_exp</code></dt>
513
+<dd><p>The class provides the following methods:</p>
514
+<dl>
515
+<dt><code>node:type()</code></dt>
516
+<dd>Returns tree node of type of expression.
517
+</dd>
518
+</dl>
519
+<p>The following tree codes provide further methods:</p>
520
+<dl>
521
+<dt><code>call_expr</code></dt>
522
+<dd><p>Call expression.</p>
523
+<dl>
524
+<dt><code>node:function()</code></dt>
525
+<dd><p>Returns tree node of function declaration.</p>
526
+</dd>
527
+<dt><code>node:args()</code></dt>
528
+<dd><p>Returns tree nodes of arguments.</p>
529
+</dd>
530
+</dl>
531
+</dd>
532
+</dl>
533
+</dd>
534
+</dl>
535
+<h3 id="other-expressions">Other expressions</h3>
536
+<p>This tree code class is used for other expressions.</p>
537
+<dl>
538
+<dt><code>expression</code></dt>
539
+<dd><p>The class provides the following methods:</p>
540
+<dl>
541
+<dt><code>node:operand()</code></dt>
542
+<dd><p>Returns tree nodes of operands of expression.</p>
543
+</dd>
544
+<dt><code>node:type()</code></dt>
545
+<dd><p>Returns tree node of type of expression.</p>
546
+</dd>
547
+</dl>
548
+<p>The following tree codes provide further methods:</p>
549
+<dl>
550
+<dt><code>bind_expr</code></dt>
551
+<dd><p>Bind expression of local variables.</p>
552
+<dl>
553
+<dt><code>node:block()</code></dt>
554
+<dd><p>Returns tree node of block corresponding to bind expression.</p>
555
+</dd>
556
+<dt><code>node:body()</code></dt>
557
+<dd><p>Returns tree node of expression computed using the variables.</p>
558
+</dd>
559
+<dt><code>node:vars()</code></dt>
560
+<dd><p>Returns tree node of chain of declarations.</p>
561
+</dd>
562
+</dl>
563
+</dd>
564
+</dl>
565
+</dd>
566
+</dl>
567
+<h3 id="exceptional-codes">Exceptional codes</h3>
568
+<p>This tree code class is used for codes that fit no other category.</p>
569
+<dl>
570
+<dt><code>exceptional</code></dt>
571
+<dd><p>The following tree codes provide further methods:</p>
572
+<dl>
573
+<dt><code>block</code></dt>
574
+<dd><p>Symbol-binding block.</p>
575
+<dl>
576
+<dt><code>node:vars()</code></dt>
577
+<dd>Returns tree node of chain of declarations.
578
+</dd>
579
+</dl>
580
+</dd>
581
+<dt><code>constructor</code></dt>
582
+<dd><p>Array or struct initializer list.</p>
583
+<dl>
584
+<dt><code>node:elements()</code></dt>
585
+<dd>Returns sequence of tree nodes of constructor elements.
586
+</dd>
587
+</dl>
588
+</dd>
589
+<dt><code>identifier_node</code></dt>
590
+<dd><p>Identifier.</p>
591
+<dl>
592
+<dt><code>node:value()</code></dt>
593
+<dd>Returns identifier string.
594
+</dd>
595
+</dl>
596
+</dd>
597
+<dt><code>statement_list</code></dt>
598
+<dd><p>Statement list.</p>
599
+<dl>
600
+<dt><code>node:statements()</code></dt>
601
+<dd>Returns sequence of tree nodes of statements.
602
+</dd>
603
+</dl>
604
+</dd>
605
+<dt><code>tree_list</code></dt>
606
+<dd><p>Singly-linked list of key-value pairs.</p>
607
+<dl>
608
+<dt><code>node:chain()</code></dt>
609
+<dd><p>Returns tree node of next element in list.</p>
610
+</dd>
611
+<dt><code>node:purpose()</code></dt>
612
+<dd><p>Returns tree node of key.</p>
613
+</dd>
614
+<dt><code>node:value()</code></dt>
615
+<dd><p>Returns tree node of value.</p>
616
+</dd>
617
+</dl>
618
+</dd>
619
+</dl>
620
+</dd>
621
+</dl>
622
+</div>
623
+<div class="footer">
624
+&copy; Copyright 2012–2014, Peter Colberg.
625
+Created using <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>.
626
+</div>
627
+</body>
628
+</html>

+ 140
- 138
doc/reference.mdwn View File

@@ -1,28 +1,30 @@
1
-% Reference
1
+---
2
+title: Reference
3
+---
2 4
 
3 5
 Plugin Events
4 6
 -------------
5 7
 
6
-gcc.register_callback(event, f)
8
+gcc.register_callback(event, `f)`
7 9
 
8 10
   : Registers the function `f` for the given plugin event.
9 11
 
10 12
     The following plugin events are supported:
11 13
 
12
-    gcc.PLUGIN_START_UNIT
14
+    `gcc.PLUGIN_START_UNIT`
13 15
 
14 16
       : Event triggered before a translation unit is parsed.
15 17
 
16 18
         The callback function receives no arguments.
17 19
 
18
-    gcc.PLUGIN_PRE_GENERICIZE
20
+    `gcc.PLUGIN_PRE_GENERICIZE`
19 21
 
20 22
       : Event triggered after a function definition has been parsed.
21 23
 
22 24
         The callback function receives a **function_decl** node as its first
23 25
         argument.
24 26
 
25
-    gcc.PLUGIN_FINISH_DECL
27
+    `gcc.PLUGIN_FINISH_DECL`
26 28
 
27 29
       : Event triggered after a declaration has been parsed.
28 30
 
@@ -31,14 +33,14 @@ gcc.register_callback(event, f)
31 33
 
32 34
         *This event is available with GCC 4.7 or later.*
33 35
 
34
-    gcc.PLUGIN_FINISH_TYPE
36
+    `gcc.PLUGIN_FINISH_TYPE`
35 37
 
36 38
       : Event triggered after a struct or union type has been parsed.
37 39
 
38 40
         The callback function receives a node of the class **type** as its
39 41
         first argument.
40 42
 
41
-    gcc.PLUGIN_FINISH_UNIT
43
+    `gcc.PLUGIN_FINISH_UNIT`
42 44
 
43 45
       : Event triggered after a translation unit has been parsed.
44 46
 
@@ -48,50 +50,50 @@ gcc.register_callback(event, f)
48 50
 Globals
49 51
 -------
50 52
 
51
-gcc.get_asm_file_name()
53
+`gcc.get_asm_file_name()`
52 54
 
53 55
   : Returns assembly output filename.
54 56
 
55
-gcc.set_asm_file_name(filename)
57
+`gcc.set_asm_file_name(filename)`
56 58
 
57 59
   : Sets assembly output filename.
58 60
 
59
-    gcc.HOST_BIT_BUCKET
61
+    `gcc.HOST_BIT_BUCKET`
60 62
 
61 63
       : Filename of a device that discards data written to it, for example
62 64
         **"/dev/null"**.
63 65
 
64
-gcc.get_main_input_basename()
66
+`gcc.get_main_input_basename()`
65 67
 
66 68
   : Returns main input filename with any leading directory components removed.
67 69
 
68 70
     *This function is available with GCC 4.6 or later.*
69 71
 
70
-gcc.get_main_input_filename()
72
+`gcc.get_main_input_filename()`
71 73
 
72 74
   : Returns main input filename.
73 75
 
74
-gcc.get_translation_units()
76
+`gcc.get_translation_units()`
75 77
 
76 78
   : Returns translation units as a sequence of **translation_unit_decl** nodes.
77 79
 
78 80
     *This function is available with GCC 4.6 or later.*
79 81
 
80
-gcc.get_functions()
82
+`gcc.get_functions()`
81 83
 
82 84
   : Returns function declarations in translation unit as a *reverse* sequence
83 85
     of **function_decl** nodes.
84 86
 
85
-gcc.get_variables()
87
+`gcc.get_variables()`
86 88
 
87 89
   : Returns variable declarations in current translation unit as a *reverse*
88 90
     sequence of **var_decl** nodes.
89 91
 
90
-gcc.get_identifier(s)
92
+`gcc.get_identifier(s)`
91 93
 
92 94
   : Returns identifier for given string as an **identifier_node** node.
93 95
 
94
-gcc.define_macro(s)
96
+`gcc.define_macro(s)`
95 97
 
96 98
   : Defines preprocessor macro.
97 99
 
@@ -101,7 +103,7 @@ gcc.define_macro(s)
101 103
     gcc.define_macro("SIN(x)=x")
102 104
     ~~~
103 105
 
104
-gcc.GCC_VERSION
106
+`gcc.GCC_VERSION`
105 107
 
106 108
   : A number corresponding to the GCC version the plugin was built for,
107 109
     e.g., **4008** for GCC 4.8.
@@ -111,11 +113,11 @@ Tree Nodes
111 113
 
112 114
 Any [tree node] provides the following methods:
113 115
 
114
-node:class()
116
+`node:class()`
115 117
 
116 118
   : Returns tree code class as a string.
117 119
 
118
-node:code()
120
+`node:code()`
119 121
 
120 122
   : Returns tree code as a string.
121 123
 
@@ -126,146 +128,146 @@ node:code()
126 128
 
127 129
 This tree code class is used for declarations.
128 130
 
129
-declaration
131
+`declaration`
130 132
 
131 133
   : The class provides the following methods:
132 134
 
133
-    node:align()
135
+    `node:align()`
134 136
 
135 137
       : Returns alignment in bits.
136 138
 
137
-    node:align_unit()
139
+    `node:align_unit()`
138 140
 
139 141
       : Returns alignment in bytes.
140 142
 
141
-    node:assembler_name()
143
+    `node:assembler_name()`
142 144
 
143 145
       : Returns tree node of assembler name.
144 146
 
145
-    node:artificial()
147
+    `node:artificial()`
146 148
 
147 149
       : Returns **true** if declaration is a compiler-generated entity, or
148 150
         **false** otherwise.
149 151
 
150
-    node:attributes()
152
+    `node:attributes()`
151 153
 
152 154
       : Returns tree node of attributes.
153 155
 
154
-    node:chain()
156
+    `node:chain()`
155 157
 
156 158
       : Returns tree node of next declaration.
157 159
 
158
-    node:name()
160
+    `node:name()`
159 161
 
160 162
       : Returns name as an **identifier_node** node.
161 163
 
162
-    node:location()
164
+    `node:location()`
163 165
 
164 166
       : Returns source filename and line number.
165 167
 
166 168
         With GCC 4.8 or later, further returns column number.
167 169
 
168
-    node:size()
170
+    `node:size()`
169 171
 
170 172
       : Returns size in bits.
171 173
 
172
-    node:size_unit()
174
+    `node:size_unit()`
173 175
 
174 176
       : Returns size in bytes.
175 177
 
176
-    node:type()
178
+    `node:type()`
177 179
 
178 180
       : Returns tree node of type of declaration.
179 181
 
180
-    node:uid()
182
+    `node:uid()`
181 183
 
182 184
       : Returns unique number.
183 185
 
184
-    node:user_align()
186
+    `node:user_align()`
185 187
 
186 188
       : Returns **true** if declaration has user-defined alignment, or **false** otherwise.
187 189
 
188 190
     The following tree codes provide further methods:
189 191
 
190
-    const_decl
192
+    `const_decl`
191 193
 
192 194
       : C enum value.
193 195
 
194
-        node:initial()
196
+        `node:initial()`
195 197
 
196 198
           : Returns tree node of constant value.
197 199
 
198
-    field_decl
200
+    `field_decl`
199 201
 
200 202
       : C struct or union field.
201 203
 
202
-        node:bit_field()
204
+        `node:bit_field()`
203 205
 
204 206
           : Returns **true** if field is a bitfield, or **false** otherwise.
205 207
 
206
-        node:bit_field_type()
208
+        `node:bit_field_type()`
207 209
 
208 210
           : Returns tree node of type specified for a bitfield.
209 211
 
210
-        node:initial()
212
+        `node:initial()`
211 213
 
212 214
           : Returns initial value.
213 215
 
214
-    function_decl
216
+    `function_decl`
215 217
 
216 218
       : Function declaration.
217 219
 
218
-        node:args()
220
+        `node:args()`
219 221
 
220 222
           : Returns tree node of argument declarations.
221 223
 
222
-        node:body()
224
+        `node:body()`
223 225
 
224 226
           : Returns tree node of body expression.
225 227
 
226
-        node:external()
228
+        `node:external()`
227 229
 
228 230
           : Returns **true** if function refers to definition elsewhere, or **false** otherwise.
229 231
 
230
-        node:public()
232
+        `node:public()`
231 233
 
232 234
           : Returns **true** if function is accessible outside translation unit, or **false** otherwise.
233 235
 
234
-    translation_unit_decl
236
+    `translation_unit_decl`
235 237
 
236 238
       : Translation unit.
237 239
 
238
-        node:block()
240
+        `node:block()`
239 241
 
240 242
           : Returns tree node of block.
241 243
 
242
-        node:language()
244
+        `node:language()`
243 245
 
244 246
           : Returns language of translation unit.
245 247
 
246 248
             *This function is available with GCC 4.6 or later.*
247 249
 
248
-    type_decl
250
+    `type_decl`
249 251
 
250 252
       : Type declaration.
251 253
 
252
-        node:public()
254
+        `node:public()`
253 255
 
254 256
           : Returns **true** if type is accessible outside translation unit, or **false** otherwise.
255 257
 
256
-    var_decl
258
+    `var_decl`
257 259
 
258 260
       : Variable declaration.
259 261
 
260
-        node:external()
262
+        `node:external()`
261 263
 
262 264
           : Returns **true** if variable refers to definition elsewhere, or **false** otherwise.
263 265
 
264
-        node:initial()
266
+        `node:initial()`
265 267
 
266 268
           : Returns tree node of initial value.
267 269
 
268
-        node:public()
270
+        `node:public()`
269 271
 
270 272
           : Returns **true** if variable is accessible outside translation unit, or **false** otherwise.
271 273
 
@@ -274,183 +276,183 @@ declaration
274 276
 
275 277
 This tree code class is used for type objects.
276 278
 
277
-type
279
+`type`
278 280
 
279 281
   : The class provides the following methods:
280 282
 
281
-    node:align()
283
+    `node:align()`
282 284
 
283 285
       : Returns alignment in bits.
284 286
 
285
-    node:align_unit()
287
+    `node:align_unit()`
286 288
 
287 289
       : Returns alignment in bytes.
288 290
 
289
-    node:attributes()
291
+    `node:attributes()`
290 292
 
291 293
       : Returns tree node of attributes.
292 294
 
293
-    node:canonical()
295
+    `node:canonical()`
294 296
 
295 297
       : Returns tree node of canonical type.
296 298
 
297 299
         The canonical type includes qualifiers.
298 300
 
299
-    node:const()
301
+    `node:const()`
300 302
 
301 303
       : Returns **true** if type has `const` qualifier, or **false** otherwise.
302 304
 
303
-    node:main_variant()
305
+    `node:main_variant()`
304 306
 
305 307
       : Returns tree node of main variant of type.
306 308
 
307 309
         The main variant excludes qualifiers.
308 310
 
309
-    node:name()
311
+    `node:name()`
310 312
 
311 313
       : Returns tree node of type name.
312 314
 
313
-    node:packed()
315
+    `node:packed()`
314 316
 
315 317
       : Returns **true** if type has attribute `packed`.
316 318
 
317
-    node:restrict()
319
+    `node:restrict()`
318 320
 
319 321
       : Returns **true** if type has `restrict` qualifier, or **false** otherwise.
320 322
 
321
-    node:size()
323
+    `node:size()`
322 324
 
323 325
       : Returns size of type in bits.
324 326
 
325
-    node:size_unit()
327
+    `node:size_unit()`
326 328
 
327 329
       : Returns size of type in bytes.
328 330
 
329
-    node:stub_decl()
331
+    `node:stub_decl()`
330 332
 
331 333
       : Returns stub declaration as a **type_decl** node.
332 334
 
333
-    node:user_align()
335
+    `node:user_align()`
334 336
 
335 337
       : Returns **true** if type has user-defined alignment, or **false** otherwise.
336 338
 
337
-    node:volatile()
339
+    `node:volatile()`
338 340
 
339 341
       : Returns **true** if type has `volatile` qualifier, or **false** otherwise.
340 342
 
341 343
     The following tree codes provide further methods:
342 344
 
343
-    array_type
345
+    `array_type`
344 346
 
345 347
       : Array type.
346 348
 
347
-        node:domain()
349
+        `node:domain()`
348 350
 
349 351
           : Returns tree node of lower and upper array bounds.
350 352
 
351
-        node:type()
353
+        `node:type()`
352 354
 
353 355
           : Returns type of array elements.
354 356
 
355
-    enumeral_type
357
+    `enumeral_type`
356 358
 
357 359
       : C enum.
358 360
 
359
-        node:values()
361
+        `node:values()`
360 362
 
361 363
           : Returns tree node of enum values.
362 364
 
363 365
         The following methods are available with the C++ frontend.
364 366
 
365
-        node:anonymous()
367
+        `node:anonymous()`
366 368
 
367 369
           : Returns **true** if enum is unnamed, or **false** otherwise.
368 370
 
369
-    function_type
371
+    `function_type`
370 372
 
371 373
       : Function type.
372 374
 
373
-        node:args()
375
+        `node:args()`
374 376
 
375 377
           : Returns tree node of argument types.
376 378
 
377
-        node:type()
379
+        `node:type()`
378 380
 
379 381
           : Returns tree node of return type.
380 382
 
381
-    integer_type
383
+    `integer_type`
382 384
 
383 385
       : Integer type.
384 386
 
385
-        node:max()
387
+        `node:max()`
386 388
 
387 389
           : Returns tree node of maximum value.
388 390
 
389
-        node:min()
391
+        `node:min()`
390 392
 
391 393
           : Returns tree node of minimum value.
392 394
 
393
-        node:unsigned()
395
+        `node:unsigned()`
394 396
 
395 397
           : Returns **true** if type is unsigned, or **false** otherwise.
396 398
 
397
-    pointer_type
399
+    `pointer_type`
398 400
 
399 401
       : Pointer type.
400 402
 
401
-        node:type()
403
+        `node:type()`
402 404
 
403 405
           : Returns tree node of pointed type.
404 406
 
405
-        node:unsigned()
407
+        `node:unsigned()`
406 408
 
407 409
           : Returns **true** if type is unsigned, or **false** otherwise.
408 410
 
409
-    record_type
411
+    `record_type`
410 412
 
411 413
       : C struct.
412 414
 
413
-        node:fields()
415
+        `node:fields()`
414 416
 
415 417
           : Returns tree node of struct fields.
416 418
 
417 419
         The following methods are available with the C++ frontend.
418 420
 
419
-        node:anonymous()
421
+        `node:anonymous()`
420 422
 
421 423
           : Returns **true** if struct is unnamed, or **false** otherwise.
422 424
 
423
-    reference_type
425
+    `reference_type`
424 426
 
425 427
       : Reference type.
426 428
 
427
-        node:type()
429
+        `node:type()`
428 430
 
429 431
           : Returns tree node of referenced type.
430 432
 
431
-    union_type
433
+    `union_type`
432 434
 
433 435
       : C union.
434 436
 
435
-        node:fields()
437
+        `node:fields()`
436 438
 
437 439
           : Returns tree node of union fields.
438 440
 
439 441
         The following methods are available with the C++ frontend.
440 442
 
441
-        node:anonymous()
443
+        `node:anonymous()`
442 444
 
443 445
           : Returns **true** if union is unnamed, or **false** otherwise.
444 446
 
445
-    vector_type
447
+    `vector_type`
446 448
 
447 449
       : GCC vector type.
448 450
 
449
-        node:type()
451
+        `node:type()`
450 452
 
451 453
           : Returns tree node of vector element type.
452 454
 
453
-        node:units()
455
+        `node:units()`
454 456
 
455 457
           : Returns number of vector elements.
456 458
 
@@ -459,37 +461,37 @@ type
459 461
 
460 462
 This tree code class is used for constant values.
461 463
 
462
-constant
464
+`constant`
463 465
 
464 466
   : The class provides the following methods:
465 467
 
466
-    node:type()
468
+    `node:type()`
467 469
 
468 470
       : Returns tree node of type of constant.
469 471
 
470 472
     The following tree codes provide further methods:
471 473
 
472
-    integer_cst
474
+    `integer_cst`
473 475
 
474 476
       : Integer constant.
475 477
 
476
-        node:value()
478
+        `node:value()`
477 479
 
478 480
           : Returns value as a number.
479 481
 
480
-    real_cst
482
+    `real_cst`
481 483
 
482 484
       : Floating-point constant.
483 485
 
484
-        node:value()
486
+        `node:value()`
485 487
 
486 488
           : Returns value as a number.
487 489
 
488
-    string_cst
490
+    `string_cst`
489 491
 
490 492
       : String constant.
491 493
 
492
-        node:value()
494
+        `node:value()`
493 495
 
494 496
           : Returns value as a string.
495 497
 
@@ -498,15 +500,15 @@ constant
498 500
 
499 501
 This tree code class is used for unary arithmetic expressions.
500 502
 
501
-unary
503
+`unary`
502 504
 
503 505
   : The class provides the following methods:
504 506
 
505
-    node:operand()
507
+    `node:operand()`
506 508
 
507 509
       : Returns tree node of operand.
508 510
 
509
-    node:type()
511
+    `node:type()`
510 512
 
511 513
       : Returns tree node of type of expression.
512 514
 
@@ -515,15 +517,15 @@ unary
515 517
 
516 518
 This tree code class is used for binary arithmetic expressions.
517 519
 
518
-binary
520
+`binary`
519 521
 
520 522
   : The class provides the following methods:
521 523
 
522
-    node:operand()
524
+    `node:operand()`
523 525
 
524 526
       : Returns tree nodes of operands.
525 527
 
526
-    node:type()
528
+    `node:type()`
527 529
 
528 530
       : Returns tree node of type of expression.
529 531
 
@@ -532,15 +534,15 @@ binary
532 534
 
533 535
 This tree code class is used for statement expressions.
534 536
 
535
-statement
537
+`statement`
536 538
 
537 539
   : The following tree codes provide further methods:
538 540
 
539
-    return_expr
541
+    `return_expr`
540 542
 
541 543
       : Return statement.
542 544
 
543
-        node:operand()
545
+        `node:operand()`
544 546
 
545 547
           : Returns tree node of return value.
546 548
 
@@ -550,25 +552,25 @@ statement
550 552
 This tree code class is used for function calls, and expressions with a
551 553
 variable number of operands.
552 554
 
553
-vl_exp
555
+`vl_exp`
554 556
 
555 557
   : The class provides the following methods:
556 558
 
557
-    node:type()
559
+    `node:type()`
558 560
 
559 561
       : Returns tree node of type of expression.
560 562
 
561 563
     The following tree codes provide further methods:
562 564
 
563
-    call_expr
565
+    `call_expr`
564 566
 
565 567
       : Call expression.
566 568
 
567
-        node:function()
569
+        `node:function()`
568 570
 
569 571
           : Returns tree node of function declaration.
570 572
 
571
-        node:args()
573
+        `node:args()`
572 574
 
573 575
           : Returns tree nodes of arguments.
574 576
 
@@ -577,33 +579,33 @@ vl_exp
577 579
 
578 580
 This tree code class is used for other expressions.
579 581
 
580
-expression
582
+`expression`
581 583
 
582 584
   : The class provides the following methods:
583 585
 
584
-    node:operand()
586
+    `node:operand()`
585 587
 
586 588
       : Returns tree nodes of operands of expression.
587 589
 
588
-    node:type()
590
+    `node:type()`
589 591
 
590 592
       : Returns tree node of type of expression.
591 593
 
592 594
     The following tree codes provide further methods:
593 595
 
594
-    bind_expr
596
+    `bind_expr`
595 597
 
596 598
       : Bind expression of local variables.
597 599
 
598
-        node:block()
600
+        `node:block()`
599 601
 
600 602
           : Returns tree node of block corresponding to bind expression.
601 603
 
602
-        node:body()
604
+        `node:body()`
603 605
 
604 606
           : Returns tree node of expression computed using the variables.
605 607
 
606
-        node:vars()
608
+        `node:vars()`
607 609
 
608 610
           : Returns tree node of chain of declarations.
609 611
 
@@ -612,54 +614,54 @@ expression
612 614
 
613 615
 This tree code class is used for codes that fit no other category.
614 616
 
615
-exceptional
617
+`exceptional`
616 618
 
617 619
   : The following tree codes provide further methods:
618 620
 
619
-    block
621
+    `block`
620 622
 
621 623
       : Symbol-binding block.
622 624
 
623
-        node:vars()
625
+        `node:vars()`
624 626
 
625 627
           : Returns tree node of chain of declarations.
626 628
 
627
-    constructor
629
+    `constructor`
628 630
 
629 631
       : Array or struct initializer list.
630 632
 
631
-        node:elements()
633
+        `node:elements()`
632 634
 
633 635
           : Returns sequence of tree nodes of constructor elements.
634 636
 
635
-    identifier_node
637
+    `identifier_node`
636 638
 
637 639
       : Identifier.
638 640
 
639
-        node:value()
641
+        `node:value()`
640 642
 
641 643
           : Returns identifier string.
642 644
 
643
-    statement_list
645
+    `statement_list`
644 646
 
645 647
       : Statement list.
646 648
 
647
-        node:statements()
649
+        `node:statements()`
648 650
 
649 651
           : Returns sequence of tree nodes of statements.
650 652
 
651
-    tree_list
653
+    `tree_list`
652 654
 
653 655
       : Singly-linked list of key-value pairs.
654 656
 
655
-        node:chain()
657
+        `node:chain()`
656 658
 
657 659
           : Returns tree node of next element in list.
658 660
 
659
-        node:purpose()
661
+        `node:purpose()`
660 662
 
661 663
           : Returns tree node of key.
662 664
 
663
-        node:value()
665
+        `node:value()`
664 666
 
665 667
           : Returns tree node of value.

Loading…
Cancel
Save