blob: c80e1c651d0ac0de14368d2315a02c867fc20f17 [file] [log] [blame]
Chandler Carruthc00c0c32011-11-28 07:16:19 +00001<html>
2<head>
3<title>Clang 3.0 Release Notes</title>
4<link type="text/css" rel="stylesheet" href="../menu.css" />
5<link type="text/css" rel="stylesheet" href="../content.css" />
6<style type="text/css">
7td {
8 vertical-align: top;
9}
10</style>
11</head>
12<body>
13
14<!--#include virtual="../menu.html.incl"-->
15
16<div id="content">
17
18<h1>Clang 3.0 Release Notes</h1>
19
20<img align=right src="http://llvm.org/img/DragonSmall.png"
21 width="136" height="136" alt="LLVM Dragon Logo">
22
23<ul>
24 <li><a href="#intro">Introduction</a></li>
25 <li><a href="#whatsnew">What's New in Clang 3.0?</a>
26 <ul>
27 <li><a href="#majorfeatures">Major New Features</a></li>
28 <li><a href="#cchanges">C Language Changes</a></li>
29 <li><a href="#cxxhanges">C++ Language Changes</a></li>
30 <li><a href="#objchanges">Objective-C Language Changes</a></li>
31 <li><a href="#apichanges">Internal API Changes</a></li>
Richard Smith855746b2011-11-28 20:02:05 +000032 </ul>
Chandler Carruthc00c0c32011-11-28 07:16:19 +000033 </li>
34 <li><a href="#knownproblems">Known Problems</a></li>
35 <li><a href="#additionalinfo">Additional Information</a></li>
36</ul>
37
38<div class="doc_author">
39 <p>Written by the <a href="http://llvm.org/">LLVM Team</a></p>
40</div>
41
42<!--
43<h1 style="color:red">These are in-progress notes for the upcoming LLVM 3.0
44release.<br>
45You may prefer the
46<a href="http://llvm.org/releases/2.9/docs/ReleaseNotes.html">LLVM 2.9
47Release Notes</a>.</h1>
48 -->
49
50<!-- ======================================================================= -->
51<h2 id="intro">Introduction</h2>
52<!-- ======================================================================= -->
53
54<p>This document contains the release notes for the Clang C/C++/Objective-C
55frontend, part of the LLVM Compiler Infrastructure, release 3.0. Here we
56describe the status of Clang in some detail, including major improvements from
57the previous release and new feature work. For the general LLVM release notes,
58see <a href ="http;//llvm.org/docs/ReleaseNotes.html">the LLVM
59 documentation</a>. All LLVM releases may be downloaded from the
60<a href="http://llvm.org/releases/">LLVM releases web site</a>.</p>
61
62<p>For more information about Clang or LLVM, including information about the
63latest release, please check out the main please see the
64<a href="http://clang.llvm.org">Clang Web Site</a> or the
65<a href="http://llvm.org">LLVM Web Site</a>.
66
67<p>Note that if you are reading this file from a Subversion checkout or the main
68Clang web page, this document applies to the <i>next</i> release, not the
69current one. To see the release notes for a specific release, please see the
70<a href="http://llvm.org/releases/">releases page</a>.</p>
71
72<!-- ======================================================================= -->
73<h2 id="whatsnew">What's New in Clang 3.0?</h2>
74<!-- ======================================================================= -->
75
76<p>Some of the major new features and improvements to Clang are listed here.
77Generic improvements to Clang as a whole or two its underlying infrastructure
78are described first, followed by language-specific sections with improvements to
79Clang's support for those languages.</p>
80
81<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
82<h3 id="majorfeatures">Major New Features</h3>
83<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
84
Chandler Carrutha3950cc2011-11-28 08:41:06 +000085<h4 id="notes">Unorganized Notes</h4>
86<p>These are completely random notes as I'm organizing my thoughts and reviewing
87the history. Anything still here needs to be distilled and turned into proper
88prose in a section of its own. When doing that, delete the notes.</p>
89<ul>
Chandler Carrutha3950cc2011-11-28 08:41:06 +000090 <li>Building Clang on windows -- mingw, 32 and 64 bit, native windows builds,
91 cygwin. get chapuni to flesh out details.</li>
Chandler Carruth1af40222011-11-28 09:43:30 +000092 <li>Compiling C/C++ w/ MinGW (32/64) and Cygwin on Windows -- chapuni</li>
93 <li>C++ -- Parsing and AST support for Windows Structured Exception
94 Handling.</li>
Chandler Carrutha3950cc2011-11-28 08:41:06 +000095 <li>Uninitialized values Clang warning rewrite -- more accurate, faster, able
96 to differentiate between the possibility of an uninitialized use and the
97 certainty of an uninitialized use.</li>
Chandler Carrutha3950cc2011-11-28 08:41:06 +000098 <li>Driver support for automatic preparation of reproduction steps for
99 compiler crashes -- Chad</li>
100 <li>OS Availability attribute -- r128127</li>
101 <li>GNU ObjectiveC Runtime support -- David Chisnall</li>
Anna Zaksa5a6d1d2011-11-28 21:31:55 +0000102 <li>Basic C++ support in the static analyzer.</li>
Chandler Carruth1af40222011-11-28 09:43:30 +0000103 <li>Improved AST support for partially constructed nodes and incomplete
104 information for LLDB and other clients which dynamically build AST nodes.</li>
105 <li>Largely complete MSVC-compatible parsing mode -- fpichet</li>
Chandler Carruth1af40222011-11-28 09:43:30 +0000106 <li>Memory reduction -- initializers, macro expansions, source locations,
107 etc.</li>
Chandler Carruthbba72a82011-11-28 10:57:14 +0000108 <li>CFI-based debug info -- nlewycky/espindola details</li>
Chandler Carruthb6a1d9d2011-11-28 11:27:33 +0000109 <li>ObjC ARC -- get a blurb from rjmccall</li>
Douglas Gregora1e3e8c2011-11-28 17:51:39 +0000110 <li>ObjC related result type/instancetype</li>
Chandler Carruth7717ce42011-11-28 12:24:23 +0000111 <li>Thread Safety attributes and correctness analysis added to Clang.</li>
Chandler Carruth7a1f1482011-11-28 13:02:29 +0000112 <li>Major improvements to the interactions between serializing and
113 deserializing the AST and the preprocessor -- argiris</li>
Chandler Carrutha3950cc2011-11-28 08:41:06 +0000114</ul>
115
Chandler Carruth58f2cbc2011-11-28 22:34:59 +0000116<h4 id="diagnostics">A multitude of improvements to Clang's diagnostics</h4>
117Clang's diagnostics are constantly being improved to catch more issues, explain
118them more clearly, and provide more accurate source information about them.
119A few improvements since the 2.9 release that have a particularly high impact:
120<ul>
121 <li>Substantially shorter messages due to better recovery, fewer include
122 stacks, and tuning verbose features such as 'a.k.a.' type printing.</li>
123 <li>
124 Able to recover and correct from misspelled type names at the begging of statements. For example, Clang now emits:
125 <code>t.c:6:3: error: use of undeclared identifier 'integer'; did you mean
126'Integer'?
127 integer *i = 0;
128 ^~~~~~~
129 Integer
130t.c:1:13: note: 'Integer' declared here
131typedef int Integer;
132 ^</code>
133 </li>
134 <li>Expanded typo correction to (among other improvements) look across
135 namespaces and suggest namespace qualifiers in addition to misspellings of the
136 identifier itself.</li>
137 <li>More rich macro expansion backtraces and some (limited) fix-it hints when
138 diagnostics stem from macro arguments.</li>
139</ul>
140
Chandler Carruth9a167122011-11-28 22:43:32 +0000141<h4 id="libclang">This release saw significant improvements to <code>libclang</code></h4>
142<ul>
143 <li>A broader set of the <code>libclang</code> API is exposed in the Python
144 bindings.</li>
145 <li>Much more of the Clang AST is exposed through <code>libclang</code>'s APIs
146 and cursors.</li>
147 <li>Cursors can now walk more effectively through macros, especially arguments
148 to function-style macros, and resolve to the underlying AST.</li>
149 <li>Improved code completion surrounding macros, macro arguments, and
150 token pasting.</li>
151 <li>Improved code completion for in-class member functions.</li>
152 <li>Crash recovery for <code>libclang</code> clients.</li>
153 <!-- Doug or Ted may want to flesh this out if there are relevant details I'm
154 glossing over... -->
155</ul>
156
Chandler Carruthb882a1d2011-11-28 21:56:30 +0000157<h4 id="driver">The Clang GCC-compatible command-line driver improved dramatically</h4>
158A great deal of work went into the GCC-compatible driver for the 3.0 release
159making it support more operating systems, emulate GCC behavior more accurately,
160and support a much broader range of Linux distributions out of the box.
161<ul>
162 <li>More accurate support for hardware architecture pre-defined macros (e.g.,
163 __i686__).</li>
164 <li>Robust library and header search paths for the vast majority of x86 and
165 x86-64 Linux distributions.</li>
166 <li>Improved support for newer Darwin platforms.</li>
167 <li>Partial support for <code>--sysroot=...</code> based cross-compiling on
168 Linux (and similar) host systems.</li>
169 <li>Improved support for locating and using libcxx when installed, especially
170 on Darwin.</li>
171 <!-- There are likely more Darwin-specific improvements to mention here? -->
172 <!-- What support was added for FreeBSD? NetBSD? Anything noteworthy? -->
173</ul>
174
Chandler Carruthc6f2af32011-11-28 19:17:25 +0000175<h4 id="ppcallbacks">Expanded support for instrumenting the preprocessor through
176 callbacks</h4>
Chandler Carruthf16d7252011-11-28 21:47:51 +0000177Several enhancements were made to the <code>PPCallbacks</code> interface to
178expand the information available to tools and library users of Clang that wish
179to introspect the preprocessing.
Chandler Carruthc6f2af32011-11-28 19:17:25 +0000180<ul>
181 <li>The exact text used between the <code>""</code>s or <code>&lt;&gt;</code>s is reported.</li>
182 <li>The header search path used to locate the header is reported.</li>
183 <li>Missing files during including headers reported.</li>
184 <li>The exact source range for expanded macros can be retrieved.</li>
185</ul>
186
Chandler Carrutha0df07d2011-11-28 22:17:58 +0000187<!--
188Need Peter and/or Tanya to flesh this out if we want it in 3.0's notes.. The
189state isn't clear just from documentation or commit logs.
190
191<h4 id="opencl">Initial work to support compiling OpenCL with Clang</h4>
192Clang has some (limited) support for compiling OpenCL.
193-->
194
Chandler Carruthc00c0c32011-11-28 07:16:19 +0000195<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
196<h3 id="cchanges">C Language Changes in Clang</h3>
197<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
198
Richard Smith62d730f2011-11-28 22:48:25 +0000199<h4 id="c1xchanges">C1X Feature Support</h4>
200
201<p>Clang 3.0 adds support for the
202<a href="http://clang.llvm.org/docs/LanguageExtensions.html#c1x">
203<code>_Alignas</code>, <code>_Generic</code>, and <code>_Static_assert</code>
204keywords</a>, drafted for inclusion in the next C standard, which is
205provisionally known as C1X. Use <code>-std=c1x</code> or <code>-std=gnu1x</code>
206to enable support for the new language standard. These features are
207backwards-compatible and are available as an extension in all language
208modes.</p>
209
Chandler Carruthc00c0c32011-11-28 07:16:19 +0000210<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
211<h3 id="cxxchanges">C++ Language Changes in Clang</h3>
212<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
213
Richard Smith855746b2011-11-28 20:02:05 +0000214<h4 id="cxx11changes">C++11 Feature Support</h4>
Richard Smith855746b2011-11-28 20:02:05 +0000215<p>Clang 3.0 adds support for
216<a href="http://clang.llvm.org/cxx_status.html#cxx11">more of the language
217features</a> added in the latest ISO C++ standard, C++11. Use
Chandler Carruthf16d7252011-11-28 21:47:51 +0000218<code>-std=c++11</code> or <code>-std=gnu++11</code> to enable support for these
Richard Smith855746b2011-11-28 20:02:05 +0000219features. The following are now considered to be of production quality:
220<ul>
Chandler Carruthf16d7252011-11-28 21:47:51 +0000221 <li>Range-based <code>for</code> loops</li>
222 <li>Alias declarations (a new syntax for <code>typedef</code> declarations),
223 including their <code>template</code> forms</li>
Richard Smith855746b2011-11-28 20:02:05 +0000224 <li>Specifying default values for class data members within a class
225 definition</li>
226 <li>Constructors delegating to other constructors of the same class</li>
Chandler Carruthf16d7252011-11-28 21:47:51 +0000227 <li>The <code>override</code> context-sensitive keyword for virtual member
Richard Smith855746b2011-11-28 20:02:05 +0000228 function declarations</li>
Chandler Carruthf16d7252011-11-28 21:47:51 +0000229 <li>Explicitly generating default function definitions with
230 <code>= default</code></li>
231 <li>The <code>nullptr</code> keyword, and the corresponding type</li>
Richard Smith855746b2011-11-28 20:02:05 +0000232 <li>Raw string literals with arbitary delimiters (for instance,
Chandler Carruthf16d7252011-11-28 21:47:51 +0000233 <code>R"delim(str"ing)delim"</code>)</li>
234 <li>Unicode string literals (for instance, <code>U"\u1234"</code>) and the
235 <code>char16_t</code> and <code>char32_t</code> built-in types
236 <li><code>noexcept</code> expressions and the <code>noexcept</code> specifier
237 on function declarations</li>
238 <li><code>alignof</code> expressions and the <code>alignas</code> specifier on
Richard Smith855746b2011-11-28 20:02:05 +0000239 variable declarations</li>
240 <li>A full set of <a href="http://clang.llvm.org/docs/LanguageExtensions.html#checking_type_traits">type traits</a>,
241 sufficient to support C++11 standard libraries</li>
242</ul>
Chandler Carruthbc02a042011-11-28 21:55:34 +0000243All warning and language selection flags which previously accepted
244<code>c++0x</code> now accept <code>c++11</code>. The old <code>c++0x</code>
245form remains as an alias.
Richard Smith855746b2011-11-28 20:02:05 +0000246
Chandler Carruthc00c0c32011-11-28 07:16:19 +0000247<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
248<h3 id="objcchanges">Objective-C Language Changes in Clang</h3>
249<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
250
251<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
252<h3 id="apichanges">Internal API Changes</h3>
253<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
254
Chandler Carruthc4dbffa2011-11-28 18:55:47 +0000255These are major API changes that have happened since the 2.9 release of Clang.
256If upgrading an external codebase that uses Clang as a library, this section
257should help get you past the largest hurdles of upgrading.
258
Chandler Carruth7d727b72011-11-28 19:06:34 +0000259<h4 id="macroexpansion">Switched terminology from "instantiation" to "expansion"
260 for macros</h4>
261A great deal of comments and code changes fell out of this, but also every API
262relating to macros with the word "instantiation" (or some variant thereof) was
263renamed. An incomplete list of the most note-worthy ones is here:
264<ul>
265 <li><code>MacroInstantiation</code> became <code>MacroExpansion</code></li>
266 <li><code>SourceManager::getInstantiationLoc</code> became
267 <code>SourceManager::getExpansionLoc</code></li>
268 <li><code>SourceManager::getInstantiationRange</code> became
269 <code>SourceManager::getExpansionRange</code></li>
270 <li><code>SourceManager::getImmediateInstantiationRange</code> became
271 <code>SourceManager::getImmediateExpansionRange</code></li>
272 <li><code>SourceManager::getDecomposedInstantiationLoc</code> became
273 <code>SourceManager::getDecomposedExpansionLoc</code></li>
274 <li><code>SourceManager::getInstantiationColumnNumber</code> became
275 <code>SourceManager::getExpansionColumnNumber</code></li>
276 <li><code>SourceManager::getInstantiationLineNumber</code> became
277 <code>SourceManager::getExpansionLineNumber</code></li>
278 <!-- TODO: Make this more complete! -->
279</ul>
280
Chandler Carruthc4dbffa2011-11-28 18:55:47 +0000281<h4 id="diagnosticrename">Diagnostic class names were shuffled</h4>
282<ul>
283 <li><code>Diagnostic</code> became <code>DiagnosticEngine</code></li>
284 <li><code>DiagnosticClient</code> became <code>DiagnosticConsumer</code></li>
285 <li><code>DiagnosticInfo</code> became <code>Diagnostic</code></li>
286</ul>
287Subclasses of <code>DiagnosticConsumer</code> were also then renamed to end with
288<code>Consumer</code>.
289
Chandler Carruthc00c0c32011-11-28 07:16:19 +0000290<!-- ======================================================================= -->
291<h2 id="knownproblems">Significant Known Problems</h2>
292<!-- ======================================================================= -->
293
294<!-- ======================================================================= -->
295<h2 id="additionalinfo">Additional Information</h2>
296<!-- ======================================================================= -->
297
298<p>A wide variety of additional information is available on the
299<a href="http://clang.llvm.org/">Clang web page</a>. The web page contains
300versions of the API documentation which are up-to-date with the Subversion
301version of the source code. You can access versions of these documents specific
302to this release by going into the "<tt>clang/doc/</tt>" directory in the Clang
303tree.</p>
304
305<p>If you have any questions or comments about Clang, please feel free to
306contact us via the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">
307mailing list</a>.</p>
308
Chandler Carruth59abf062011-11-28 22:12:44 +0000309
310<!-- ======================================================================= -->
311<!-- Likely 3.1 release notes -->
312<!-- ======================================================================= -->
313<!--
314This is just a section to hold things that have already gotten started and
315should likely pick up proper release notes in 3.1.
316
317- C1X and C++11 atomics infrastructure and support
318- CUDA support?
319
320-->
321
Chandler Carruthc00c0c32011-11-28 07:16:19 +0000322</body>
323</html>