Home | History | Annotate | Download | only in docs
      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
      2           "http://www.w3.org/TR/html4/strict.dtd">
      3 <html>
      4 <head>
      5 <title>Clang 3.2 Release Notes</title>
      6 <link type="text/css" rel="stylesheet" href="../menu.css">
      7 <link type="text/css" rel="stylesheet" href="../content.css">
      8 <style type="text/css">
      9 td {
     10 	vertical-align: top;
     11 }
     12 </style>
     13 </head>
     14 <body>
     15 
     16 <!--#include virtual="../menu.html.incl"-->
     17 
     18 <div id="content">
     19 
     20 <h1>Clang 3.2 Release Notes</h1>
     21 
     22 <img style="float:right" src="http://llvm.org/img/DragonSmall.png"
     23      width="136" height="136" alt="LLVM Dragon Logo">
     24 
     25 <ul>
     26   <li><a href="#intro">Introduction</a></li>
     27   <li><a href="#whatsnew">What's New in Clang 3.2?</a>
     28     <ul>
     29       <li><a href="#majorfeatures">Major New Features</a></li>
     30       <li><a href="#newflags">New Compiler Flags</a></li>
     31       <li><a href="#cchanges">C Language Changes</a></li>
     32       <li><a href="#cxxchanges">C++ Language Changes</a></li>
     33       <li><a href="#objcchanges">Objective-C Language Changes</a></li>
     34       <li><a href="#apichanges">Internal API Changes</a></li>
     35       <li><a href="#pythonchanges">Python Binding Changes</a></li>
     36     </ul>
     37   </li>
     38   <li><a href="#knownproblems">Known Problems</a></li>
     39   <li><a href="#additionalinfo">Additional Information</a></li>
     40 </ul>
     41 
     42 <div class="doc_author">
     43   <p>Written by the <a href="http://llvm.org/">LLVM Team</a></p>
     44 </div>
     45 
     46 <h1 style="color:red">These are in-progress notes for the upcoming Clang 3.2
     47 release.<br>
     48 You may prefer the
     49 <a href="http://llvm.org/releases/3.1/docs/ClangReleaseNotes.html">Clang 3.1
     50 Release Notes</a>.</h1>
     51 
     52 <!-- ======================================================================= -->
     53 <h2 id="intro">Introduction</h2>
     54 <!-- ======================================================================= -->
     55 
     56 <p>This document contains the release notes for the Clang C/C++/Objective-C
     57    frontend, part of the LLVM Compiler Infrastructure, release 3.2.  Here we
     58    describe the status of Clang in some detail, including major improvements
     59    from the previous release and new feature work. For the general LLVM release
     60    notes, see <a href="http://llvm.org/docs/ReleaseNotes.html">the LLVM
     61    documentation</a>. All LLVM releases may be downloaded from the
     62    <a href="http://llvm.org/releases/">LLVM releases web site</a>.</p>
     63 
     64 <p>For more information about Clang or LLVM, including information about the
     65    latest release, please check out the main please see the
     66    <a href="http://clang.llvm.org">Clang Web Site</a> or the
     67    <a href="http://llvm.org">LLVM Web Site</a>.
     68 
     69 <p>Note that if you are reading this file from a Subversion checkout or the main
     70    Clang web page, this document applies to the <i>next</i> release, not the
     71    current one.  To see the release notes for a specific release, please see the
     72    <a href="http://llvm.org/releases/">releases page</a>.</p>
     73 
     74 <!-- ======================================================================= -->
     75 <h2 id="whatsnew">What's New in Clang 3.2?</h2>
     76 <!-- ======================================================================= -->
     77 
     78 <p>Some of the major new features and improvements to Clang are listed here.
     79   Generic improvements to Clang as a whole or to its underlying infrastructure
     80   are described first, followed by language-specific sections with improvements
     81   to Clang's support for those languages.</p>
     82 
     83 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
     84 <h3 id="majorfeatures">Major New Features</h3>
     85 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
     86 
     87 <h4 id="diagnostics">Improvements to Clang's diagnostics</h4>
     88 
     89 <p>Clang's diagnostics are constantly being improved to catch more issues,
     90 explain them more clearly, and provide more accurate source information about
     91 them. The improvements since the 3.1 release include:</p>
     92 
     93 <ul>
     94   <li><tt>-Wuninitialized</tt> has been taught to recognise uninitialized uses
     95   which always occur when an explicitly-written non-constant condition is either
     96   <tt>true</tt> or <tt>false</tt>. For example:
     97 
     98 <pre>
     99 int f(bool b) {
    100   int n;
    101   if (b)
    102     n = 1;
    103   return n;
    104 }
    105 
    106 <b>sometimes-uninit.cpp:3:7: <span class="warning">warning:</span> variable 'n' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]</b>
    107   if (b)
    108       <span class="caret">^</span>
    109 <b>sometimes-uninit.cpp:5:10: <span class="note">note:</span></b> uninitialized use occurs here
    110   return n;
    111          <span class="caret">^</span>
    112 <b>sometimes-uninit.cpp:3:3: <span class="note">note:</span></b> remove the 'if' if its condition is always true
    113   if (b)
    114   <span class="caret">^~~~~~</span>
    115 <b>sometimes-uninit.cpp:2:8: <span class="note">note:</span></b> initialize the variable 'n' to silence this warning
    116   int n;
    117        <span class="caret">^</span>
    118        <span class="caret"> = 0</span>
    119 </pre>
    120 
    121   This functionality can be enabled or disabled separately from
    122   <tt>-Wuninitialized</tt> with the <tt>-Wsometimes-uninitialized</tt> warning
    123   flag.</li>
    124 
    125   <li>Template type diffing improves the display of diagnostics with templated
    126   types in them.
    127 
    128 <pre>
    129 int f(vector&lt;map&lt;int, double&gt;&gt;);
    130 int x = f(vector&lt;map&lt;int, float&gt;&gt;());
    131 </pre>
    132   The error message is the same, but the note is different based on the options selected.
    133 <pre>
    134 <b>template-diff.cpp:5:9: <span class="error">error:</span> no matching function for call to 'f'</b>
    135 int x = f(vector&lt;map&lt;int, float&gt;&gt;());
    136         <span class="caret">^</span>
    137 </pre>
    138   Templated type diffing with type elision (default):
    139 <pre>
    140 <b>template-diff.cpp:4:5: <span class="note">note:</span></b> candidate function not viable: no known conversion from 'vector&lt;map&lt;[...], <span class="template-highlight">float</span>&gt;&gt;' to 'vector&lt;map&lt;[...], <span class="template-highlight">double</span>&gt;&gt;' for 1st argument;
    141 int f(vector&lt;map&lt;int, double&gt;&gt;);
    142     <span class="caret">^</span>
    143 </pre>
    144   Templated type diffing without type elision (-fno-elide-type):
    145 <pre>
    146 <b>template-diff.cpp:4:5: <span class="note">note:</span></b> candidate function not viable: no known conversion from 'vector&lt;map&lt;int, <span class="template-highlight">float</span>&gt;&gt;' to 'vector&lt;map&lt;int, <span class="template-highlight">double</span>&gt;&gt;' for 1st argument;
    147 int f(vector&lt;map&lt;int, double&gt;&gt;);
    148     <span class="caret">^</span>
    149 </pre>
    150   Templated tree printing with type elision (-fdiagnostics-show-template-tree):
    151 <pre>
    152 <b>template-diff.cpp:4:5: <span class="note">note:</span></b> candidate function not viable: no known conversion for 1st argument;
    153   vector&lt;
    154     map&lt;
    155       [...],
    156       [<span class="template-highlight">float</span> != <span class="template-highlight">double</span>]&gt;&gt;
    157 int f(vector&lt;map&lt;int, double&gt;&gt;);
    158     <span class="caret">^</span>
    159 </pre>
    160   Templated tree printing without type elision (-fdiagnostics-show-template-tree -fno-elide-type):
    161 <pre>
    162 <b>template-diff.cpp:4:5: <span class="note">note:</span></b> candidate function not viable: no known conversion for 1st argument;
    163   vector&lt;
    164     map&lt;
    165       int,
    166       [<span class="template-highlight">float</span> != <span class="template-highlight">double</span>]&gt;&gt;
    167 int f(vector&lt;map&lt;int, double&gt;&gt;);
    168     <span class="caret">^</span>
    169 </pre>
    170 
    171   </li>
    172 
    173   <li>Clang's <tt>-fcatch-undefined-behavior</tt> option has grown the ability
    174   to check for several new types of undefined behavior.
    175 
    176   <!-- Flesh this out prior to release. -->
    177 
    178   </li>
    179 
    180 </ul>
    181 
    182 <h4 id="tlsmodel">Support for <code>tls_model</code> attribute</h4>
    183 
    184 <p>Clang now supports the <code>tls_model</code> attribute, allowing code that
    185 uses thread-local storage to explicitly select which model to use. The available
    186 models are <code>"global-dynamic"</code>, <code>"local-dynamic"</code>,
    187 <code>"initial-exec"</code> and <code>"local-exec"</code>. See
    188 <a href="http://www.akkadia.org/drepper/tls.pdf">ELF Handling For Thread-Local
    189  Storage</a> for more information.</p>
    190 
    191 <p>The compiler is free to choose a different model if the specified model is not
    192 supported by the target, or if the compiler determines that a more specific
    193 model can be used.
    194 </p>
    195 
    196 <h4>Type safety attributes</h4>
    197 <p>Clang now supports type safety attributes that allow checking during compile
    198 time that 'void *' function arguments and arguments for variadic functions are
    199 of a particular type which is determined by some other argument to the same
    200 function call.</p>
    201 
    202 <p>Usecases include:</p>
    203 <ul>
    204 <li>MPI library implementations, where these attributes enable checking that
    205   buffer type matches the passed <code>MPI_Datatype</code>;</li>
    206 <li> HDF5 library -- similar usecase as for MPI;</li>
    207 <li> checking types of variadic functions' arguments for functions like
    208 <code>fcntl()</code> and <code>ioctl()</code>.</li>
    209 </ul>
    210 
    211 <p>See entries for <code>argument_with_type_tag</code>,
    212 <code>pointer_with_type_tag</code> and <code>type_tag_for_datatype</code>
    213 attributes in Clang language extensions documentation.</p>
    214 
    215 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    216 <h3 id="newflags">New Compiler Flags</h3>
    217 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    218 <ul>
    219   <li><tt>-gline-tables-only</tt> controls the
    220   <a href="http://clang.llvm.org/docs/UsersManual.html#debuginfosize">size of debug information</a>.
    221   This flag tells Clang to emit debug info which is just enough to obtain stack traces with
    222   function names, file names and line numbers (by such tools as gdb or addr2line).
    223   Debug info for variables or function parameters is not produced, which reduces
    224   the size of the resulting binary.
    225 
    226   <li><tt>-ftls-model</tt> controls which TLS model to use for thread-local
    227   variables. This can be overridden per variable using the
    228   <a href="#tlsmodel"><tt>tls_model</tt> attribute</a> mentioned above.
    229   For more details, see the <a href="UsersManual.html#opt_ftls-model">User's
    230   Manual</a>.</li>
    231 </ul>
    232 
    233 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    234 <h3 id="cchanges">C Language Changes in Clang</h3>
    235 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    236 
    237 <h4 id="c11changes">C11 Feature Support</h4>
    238 
    239 <p>...</p>
    240 
    241 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    242 <h3 id="cxxchanges">C++ Language Changes in Clang</h3>
    243 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    244 
    245 <h4 id="cxx11changes">C++11 Feature Support</h4>
    246 
    247 <p>...</p>
    248 
    249 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    250 <h3 id="objcchanges">Objective-C Language Changes in Clang</h3>
    251 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    252 
    253 <p>...</p>
    254 
    255 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    256 <h3 id="apichanges">Internal API Changes</h3>
    257 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    258 
    259 <p>These are major API changes that have happened since the 3.1 release of
    260    Clang. If upgrading an external codebase that uses Clang as a library, this
    261    section should help get you past the largest hurdles of upgrading.</p>
    262 
    263 <h4 id="api1">API change 1</h4>
    264 
    265 <p>...</p>
    266 
    267 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    268 <h3 id="pythonchanges">Python Binding Changes</h3>
    269 <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
    270 
    271 The following methods have been added:
    272 <ul>
    273   <li>...</li>
    274 </ul>
    275 
    276 <!-- ======================================================================= -->
    277 <h2 id="knownproblems">Significant Known Problems</h2>
    278 <!-- ======================================================================= -->
    279 
    280 <!-- ======================================================================= -->
    281 <h2 id="additionalinfo">Additional Information</h2>
    282 <!-- ======================================================================= -->
    283 
    284 <p>A wide variety of additional information is available on the
    285    <a href="http://clang.llvm.org/">Clang web page</a>.  The web page contains
    286    versions of the API documentation which are up-to-date with the Subversion
    287    version of the source code.  You can access versions of these documents
    288    specific to this release by going into the "<tt>clang/doc/</tt>" directory in
    289    the Clang tree.</p>
    290 
    291 <p>If you have any questions or comments about Clang, please feel free to
    292    contact us via
    293    the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"> mailing
    294    list</a>.</p>
    295 
    296 <!-- ======================================================================= -->
    297 <!-- Likely 3.1 release notes -->
    298 <!-- ======================================================================= -->
    299 <!--
    300 This is just a section to hold things that have already gotten started and
    301 should likely pick up proper release notes in 3.1.
    302 
    303 - C1X and C++11 atomics infrastructure and support
    304 - CUDA support?
    305 
    306 -->
    307 
    308 </div>
    309 </body>
    310 </html>
    311