C-and-C_002b_002b-Trees.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: C and C++ Trees</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: C and C++ Trees">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: C and C++ Trees">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="GENERIC.html#GENERIC" rel="up" title="GENERIC">
  30. <link href="Types-for-C_002b_002b.html#Types-for-C_002b_002b" rel="next" title="Types for C++">
  31. <link href="Language_002ddependent-trees.html#Language_002ddependent-trees" rel="prev" title="Language-dependent trees">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="C-and-C_002b_002b-Trees"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Java-Trees.html#Java-Trees" accesskey="n" rel="next">Java Trees</a>, Previous: <a href="Language_002ddependent-trees.html#Language_002ddependent-trees" accesskey="p" rel="prev">Language-dependent trees</a>, Up: <a href="GENERIC.html#GENERIC" accesskey="u" rel="up">GENERIC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="C-and-C_002b_002b-Trees-1"></a>
  69. <h3 class="section">10.10 C and C++ Trees</h3>
  70. <p>This section documents the internal representation used by GCC to
  71. represent C and C++ source programs. When presented with a C or C++
  72. source program, GCC parses the program, performs semantic analysis
  73. (including the generation of error messages), and then produces the
  74. internal representation described here. This representation contains a
  75. complete representation for the entire translation unit provided as
  76. input to the front end. This representation is then typically processed
  77. by a code-generator in order to produce machine code, but could also be
  78. used in the creation of source browsers, intelligent editors, automatic
  79. documentation generators, interpreters, and any other programs needing
  80. the ability to process C or C++ code.
  81. </p>
  82. <p>This section explains the internal representation. In particular, it
  83. documents the internal representation for C and C++ source
  84. constructs, and the macros, functions, and variables that can be used to
  85. access these constructs. The C++ representation is largely a superset
  86. of the representation used in the C front end. There is only one
  87. construct used in C that does not appear in the C++ front end and that
  88. is the GNU &ldquo;nested function&rdquo; extension. Many of the macros documented
  89. here do not apply in C because the corresponding language constructs do
  90. not appear in C.
  91. </p>
  92. <p>The C and C++ front ends generate a mix of GENERIC trees and ones
  93. specific to C and C++. These language-specific trees are higher-level
  94. constructs than the ones in GENERIC to make the parser&rsquo;s job easier.
  95. This section describes those trees that aren&rsquo;t part of GENERIC as well
  96. as aspects of GENERIC trees that are treated in a language-specific
  97. manner.
  98. </p>
  99. <p>If you are developing a &ldquo;back end&rdquo;, be it is a code-generator or some
  100. other tool, that uses this representation, you may occasionally find
  101. that you need to ask questions not easily answered by the functions and
  102. macros available here. If that situation occurs, it is quite likely
  103. that GCC already supports the functionality you desire, but that the
  104. interface is simply not documented here. In that case, you should ask
  105. the GCC maintainers (via mail to <a href="mailto:gcc@gcc.gnu.org">gcc@gcc.gnu.org</a>) about
  106. documenting the functionality you require. Similarly, if you find
  107. yourself writing functions that do not deal directly with your back end,
  108. but instead might be useful to other people using the GCC front end, you
  109. should submit your patches for inclusion in GCC.
  110. </p>
  111. <table class="menu" border="0" cellspacing="0">
  112. <tr><td align="left" valign="top">&bull; <a href="Types-for-C_002b_002b.html#Types-for-C_002b_002b" accesskey="1">Types for C++</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Fundamental and aggregate types.
  113. </td></tr>
  114. <tr><td align="left" valign="top">&bull; <a href="Namespaces.html#Namespaces" accesskey="2">Namespaces</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Namespaces.
  115. </td></tr>
  116. <tr><td align="left" valign="top">&bull; <a href="Classes.html#Classes" accesskey="3">Classes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Classes.
  117. </td></tr>
  118. <tr><td align="left" valign="top">&bull; <a href="Functions-for-C_002b_002b.html#Functions-for-C_002b_002b" accesskey="4">Functions for C++</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Overloading and accessors for C++.
  119. </td></tr>
  120. <tr><td align="left" valign="top">&bull; <a href="Statements-for-C_002b_002b.html#Statements-for-C_002b_002b" accesskey="5">Statements for C++</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Statements specific to C and C++.
  121. </td></tr>
  122. <tr><td align="left" valign="top">&bull; <a href="C_002b_002b-Expressions.html#C_002b_002b-Expressions" accesskey="6">C++ Expressions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">From <code>typeid</code> to <code>throw</code>.
  123. </td></tr>
  124. </table>
  125. <hr>
  126. <div class="header">
  127. <p>
  128. Next: <a href="Java-Trees.html#Java-Trees" accesskey="n" rel="next">Java Trees</a>, Previous: <a href="Language_002ddependent-trees.html#Language_002ddependent-trees" accesskey="p" rel="prev">Language-dependent trees</a>, Up: <a href="GENERIC.html#GENERIC" accesskey="u" rel="up">GENERIC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  129. </div>
  130. </body>
  131. </html>