xref: /minix3/external/bsd/llvm/dist/clang/docs/ReleaseNotes.rst (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc=======================
2*0a6a1f1dSLionel SambucClang 3.6 Release Notes
3*0a6a1f1dSLionel Sambuc=======================
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc.. contents::
6f4a2713aSLionel Sambuc   :local:
7f4a2713aSLionel Sambuc   :depth: 2
8f4a2713aSLionel Sambuc
9*0a6a1f1dSLionel SambucWritten by the `LLVM Team <http://llvm.org/>`_
10*0a6a1f1dSLionel Sambuc
11f4a2713aSLionel SambucIntroduction
12f4a2713aSLionel Sambuc============
13f4a2713aSLionel Sambuc
14f4a2713aSLionel SambucThis document contains the release notes for the Clang C/C++/Objective-C
15*0a6a1f1dSLionel Sambucfrontend, part of the LLVM Compiler Infrastructure, release 3.6. Here we
16f4a2713aSLionel Sambucdescribe the status of Clang in some detail, including major
17f4a2713aSLionel Sambucimprovements from the previous release and new feature work. For the
18f4a2713aSLionel Sambucgeneral LLVM release notes, see `the LLVM
19*0a6a1f1dSLionel Sambucdocumentation <http://llvm.org/releases/3.6.0/docs/ReleaseNotes.html>`_.
20*0a6a1f1dSLionel SambucAll LLVM releases may be downloaded from the `LLVM releases web
21f4a2713aSLionel Sambucsite <http://llvm.org/releases/>`_.
22f4a2713aSLionel Sambuc
23f4a2713aSLionel SambucFor more information about Clang or LLVM, including information about
24f4a2713aSLionel Sambucthe latest release, please check out the main please see the `Clang Web
25f4a2713aSLionel SambucSite <http://clang.llvm.org>`_ or the `LLVM Web
26f4a2713aSLionel SambucSite <http://llvm.org>`_.
27f4a2713aSLionel Sambuc
28*0a6a1f1dSLionel SambucWhat's New in Clang 3.6?
29f4a2713aSLionel Sambuc========================
30f4a2713aSLionel Sambuc
31f4a2713aSLionel SambucSome of the major new features and improvements to Clang are listed
32f4a2713aSLionel Sambuchere. Generic improvements to Clang as a whole or to its underlying
33f4a2713aSLionel Sambucinfrastructure are described first, followed by language-specific
34f4a2713aSLionel Sambucsections with improvements to Clang's support for those languages.
35f4a2713aSLionel Sambuc
36f4a2713aSLionel SambucMajor New Features
37f4a2713aSLionel Sambuc------------------
38f4a2713aSLionel Sambuc
39*0a6a1f1dSLionel Sambuc- The __has_attribute built-in macro no longer queries for attributes across
40*0a6a1f1dSLionel Sambuc  multiple attribute syntaxes (GNU, C++11, __declspec, etc). Instead, it only
41*0a6a1f1dSLionel Sambuc  queries GNU-style attributes. With the addition of __has_cpp_attribute and
42*0a6a1f1dSLionel Sambuc  __has_declspec_attribute, this allows for more precise coverage of attribute
43*0a6a1f1dSLionel Sambuc  syntax querying.
44*0a6a1f1dSLionel Sambuc
45*0a6a1f1dSLionel Sambuc- clang-format now supports formatting Java code.
46*0a6a1f1dSLionel Sambuc
47*0a6a1f1dSLionel Sambuc
48f4a2713aSLionel SambucImprovements to Clang's diagnostics
49*0a6a1f1dSLionel Sambuc-----------------------------------
50f4a2713aSLionel Sambuc
51f4a2713aSLionel SambucClang's diagnostics are constantly being improved to catch more issues,
52f4a2713aSLionel Sambucexplain them more clearly, and provide more accurate source information
53*0a6a1f1dSLionel Sambucabout them. The improvements since the 3.5 release include:
54f4a2713aSLionel Sambuc
55*0a6a1f1dSLionel Sambuc- Smarter typo correction. Clang now tries a bit harder to give a usable
56*0a6a1f1dSLionel Sambuc  suggestion in more cases, and can now successfully recover in more
57*0a6a1f1dSLionel Sambuc  situations where the suggestion changes how an expression is parsed.
58*0a6a1f1dSLionel Sambuc
59f4a2713aSLionel Sambuc
60f4a2713aSLionel SambucNew Compiler Flags
61f4a2713aSLionel Sambuc------------------
62f4a2713aSLionel Sambuc
63*0a6a1f1dSLionel SambucThe ``-fpic`` option now uses small pic on PowerPC.
64*0a6a1f1dSLionel Sambuc
65*0a6a1f1dSLionel Sambuc
66*0a6a1f1dSLionel SambucThe __EXCEPTIONS macro
67*0a6a1f1dSLionel Sambuc----------------------
68*0a6a1f1dSLionel Sambuc``__EXCEPTIONS`` is now defined when landing pads are emitted, not when
69*0a6a1f1dSLionel SambucC++ exceptions are enabled. The two can be different in Objective-C files:
70*0a6a1f1dSLionel SambucIf C++ exceptions are disabled but Objective-C exceptions are enabled,
71*0a6a1f1dSLionel Sambuclanding pads will be emitted. Clang 3.6 is switching the behavior of
72*0a6a1f1dSLionel Sambuc``__EXCEPTIONS``. Clang 3.5 confusingly changed the behavior of
73*0a6a1f1dSLionel Sambuc``has_feature(cxx_exceptions)``, which used to be set if landing pads were
74*0a6a1f1dSLionel Sambucemitted, but is now set if C++ exceptions are enabled. So there are 3 cases:
75*0a6a1f1dSLionel Sambuc
76*0a6a1f1dSLionel SambucClang before 3.5:
77*0a6a1f1dSLionel Sambuc   ``__EXCEPTIONS`` is set if C++ exceptions are enabled, ``cxx_exceptions``
78*0a6a1f1dSLionel Sambuc   enabled if C++ or ObjC exceptions are enabled
79*0a6a1f1dSLionel Sambuc
80*0a6a1f1dSLionel SambucClang 3.5:
81*0a6a1f1dSLionel Sambuc   ``__EXCEPTIONS`` is set if C++ exceptions are enabled, ``cxx_exceptions``
82*0a6a1f1dSLionel Sambuc   enabled if C++ exceptions are enabled
83*0a6a1f1dSLionel Sambuc
84*0a6a1f1dSLionel SambucClang 3.6:
85*0a6a1f1dSLionel Sambuc   ``__EXCEPTIONS`` is set if C++ or ObjC exceptions are enabled,
86*0a6a1f1dSLionel Sambuc   ``cxx_exceptions`` enabled if C++ exceptions are enabled
87*0a6a1f1dSLionel Sambuc
88*0a6a1f1dSLionel SambucTo reliably test if C++ exceptions are enabled, use
89*0a6a1f1dSLionel Sambuc``__EXCEPTIONS && __has_feature(cxx_exceptions)``, else things won't work in
90*0a6a1f1dSLionel Sambucall versions of Clang in Objective-C++ files.
91*0a6a1f1dSLionel Sambuc
92*0a6a1f1dSLionel Sambuc
93*0a6a1f1dSLionel SambucNew Pragmas in Clang
94*0a6a1f1dSLionel Sambuc-----------------------
95*0a6a1f1dSLionel Sambuc
96*0a6a1f1dSLionel SambucClang now supports the `#pragma unroll` and `#pragma nounroll` directives to
97*0a6a1f1dSLionel Sambucspecify loop unrolling optimization hints.  Placed just prior to the desired
98*0a6a1f1dSLionel Sambucloop, `#pragma unroll` directs the loop unroller to attempt to fully unroll the
99*0a6a1f1dSLionel Sambucloop.  The pragma may also be specified with a positive integer parameter
100*0a6a1f1dSLionel Sambucindicating the desired unroll count: `#pragma unroll _value_`.  The unroll count
101*0a6a1f1dSLionel Sambucparameter can be optionally enclosed in parentheses. The directive `#pragma
102*0a6a1f1dSLionel Sambucnounroll` indicates that the loop should not be unrolled.  These unrolling hints
103*0a6a1f1dSLionel Sambucmay also be expressed using the `#pragma clang loop` directive.  See the Clang
104*0a6a1f1dSLionel Sambuc`language extensions
105*0a6a1f1dSLionel Sambuc<http://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations>`_
106*0a6a1f1dSLionel Sambucfor details.
107*0a6a1f1dSLionel Sambuc
108*0a6a1f1dSLionel SambucWindows Support
109*0a6a1f1dSLionel Sambuc---------------
110*0a6a1f1dSLionel Sambuc
111*0a6a1f1dSLionel Sambuc- Many, many bug fixes.
112*0a6a1f1dSLionel Sambuc
113*0a6a1f1dSLionel Sambuc- Clang can now self-host using the ``msvc`` environment on x86 and x64
114*0a6a1f1dSLionel Sambuc  Windows. This means that Microsoft C++ ABI is more or less feature-complete,
115*0a6a1f1dSLionel Sambuc  minus exception support.
116*0a6a1f1dSLionel Sambuc
117*0a6a1f1dSLionel Sambuc- Added more MSVC compatibility hacks, such as allowing more lookup into
118*0a6a1f1dSLionel Sambuc  dependent bases of class templates when there is a known template pattern.
119*0a6a1f1dSLionel Sambuc  As a result, applications using Active Template Library (ATL) or Windows
120*0a6a1f1dSLionel Sambuc  Runtime Library (WRL) headers should compile correctly.
121*0a6a1f1dSLionel Sambuc
122*0a6a1f1dSLionel Sambuc- Added support for the Visual C++ ``__super`` keyword.
123*0a6a1f1dSLionel Sambuc
124*0a6a1f1dSLionel Sambuc- Added support for MSVC's ``__vectorcall`` calling convention, which is used
125*0a6a1f1dSLionel Sambuc  in the upcoming Visual Studio 2015 STL.
126*0a6a1f1dSLionel Sambuc
127*0a6a1f1dSLionel Sambuc- Added basic support for DWARF debug information in COFF files.
128*0a6a1f1dSLionel Sambuc
129f4a2713aSLionel Sambuc
130f4a2713aSLionel SambucC Language Changes in Clang
131f4a2713aSLionel Sambuc---------------------------
132f4a2713aSLionel Sambuc
133*0a6a1f1dSLionel Sambuc- The default language mode for C compilations with Clang has been changed from
134*0a6a1f1dSLionel Sambuc  C99 with GNU extensions to C11 with GNU extensions. C11 is largely
135*0a6a1f1dSLionel Sambuc  backwards-compatible with C99, but if you want to restore the former behavior
136*0a6a1f1dSLionel Sambuc  you can do so with the `-std=gnu99` flag.
137f4a2713aSLionel Sambuc
138f4a2713aSLionel SambucC11 Feature Support
139f4a2713aSLionel Sambuc^^^^^^^^^^^^^^^^^^^
140f4a2713aSLionel Sambuc
141*0a6a1f1dSLionel Sambuc- Clang now provides an implementation of the standard C11 header `<stdatomic.h>`.
142f4a2713aSLionel Sambuc
143f4a2713aSLionel SambucC++ Language Changes in Clang
144f4a2713aSLionel Sambuc-----------------------------
145f4a2713aSLionel Sambuc
146*0a6a1f1dSLionel Sambuc- An `upcoming change to C++ <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3922.html>_`
147*0a6a1f1dSLionel Sambuc  changes the semantics of certain deductions of `auto` from a braced initializer
148*0a6a1f1dSLionel Sambuc  list. Following the intent of the C++ committee, this change will be applied to
149*0a6a1f1dSLionel Sambuc  our C++11 and C++14 modes as well as our experimental C++17 mode. Clang 3.6
150*0a6a1f1dSLionel Sambuc  does not yet implement this change, but to provide a transition period, it
151*0a6a1f1dSLionel Sambuc  warns on constructs whose meaning will change. The fix in all cases is to
152*0a6a1f1dSLionel Sambuc  add an `=` prior to the left brace.
153f4a2713aSLionel Sambuc
154*0a6a1f1dSLionel Sambuc- Clang now supports putting identical constructors and destructors in
155*0a6a1f1dSLionel Sambuc  the C5/D5 comdat, reducing code duplication.
156f4a2713aSLionel Sambuc
157*0a6a1f1dSLionel Sambuc- Clang will put individual ``.init_array/.ctors`` sections in
158*0a6a1f1dSLionel Sambuc  comdats, reducing code duplication and speeding up startup.
159*0a6a1f1dSLionel Sambuc
160*0a6a1f1dSLionel Sambuc
161*0a6a1f1dSLionel SambucC++17 Feature Support
162f4a2713aSLionel Sambuc^^^^^^^^^^^^^^^^^^^^^
163f4a2713aSLionel Sambuc
164*0a6a1f1dSLionel SambucClang has experimental support for some proposed C++1z (tentatively, C++17)
165*0a6a1f1dSLionel Sambucfeatures. This support can be enabled using the `-std=c++1z` flag.
166f4a2713aSLionel Sambuc
167*0a6a1f1dSLionel SambucNew in Clang 3.6 is support for:
168f4a2713aSLionel Sambuc
169*0a6a1f1dSLionel Sambuc- Fold expressions
170f4a2713aSLionel Sambuc
171*0a6a1f1dSLionel Sambuc- `u8` character literals
172f4a2713aSLionel Sambuc
173*0a6a1f1dSLionel Sambuc- Nested namespace definitions: `namespace A::B { ... }` as a shorthand for
174*0a6a1f1dSLionel Sambuc  `namespace A { namespace B { ... } }`
175f4a2713aSLionel Sambuc
176*0a6a1f1dSLionel Sambuc- Attributes for namespaces and enumerators
177f4a2713aSLionel Sambuc
178*0a6a1f1dSLionel Sambuc- Constant evaluation for all non-type template arguments
179f4a2713aSLionel Sambuc
180*0a6a1f1dSLionel SambucNote that these features may be changed or removed in future Clang releases
181*0a6a1f1dSLionel Sambucwithout notice.
182f4a2713aSLionel Sambuc
183*0a6a1f1dSLionel SambucSupport for `for (identifier : range)` as a synonym for
184*0a6a1f1dSLionel Sambuc`for (auto &&identifier : range)` has been removed as it is no longer currently
185*0a6a1f1dSLionel Sambucconsidered for C++17.
186f4a2713aSLionel Sambuc
187*0a6a1f1dSLionel SambucFor more details on C++ feature support, see
188*0a6a1f1dSLionel Sambuc`the C++ status page <http://clang.llvm.org/cxx_status.html>`_.
189f4a2713aSLionel Sambuc
190f4a2713aSLionel Sambuc
191*0a6a1f1dSLionel SambucOpenMP Language Changes in Clang
192*0a6a1f1dSLionel Sambuc--------------------------------
193f4a2713aSLionel Sambuc
194*0a6a1f1dSLionel SambucClang 3.6 contains codegen for many individual OpenMP pragmas, but combinations are not completed yet.
195*0a6a1f1dSLionel SambucWe plan to continue codegen code drop aiming for completion in 3.7. Please see this link for up-to-date
196*0a6a1f1dSLionel Sambuc`status <https://github.com/clang-omp/clang/wiki/Status-of-supported-OpenMP-constructs>_`.
197*0a6a1f1dSLionel SambucLLVM's OpenMP runtime library, originally developed by Intel, has been modified to work on ARM, PowerPC,
198*0a6a1f1dSLionel Sambucas well as X86. The Runtime Library's compatibility with GCC 4.9 is improved
199*0a6a1f1dSLionel Sambuc- missed entry points added, barrier and fork/join code improved, one more type of barrier enabled.
200*0a6a1f1dSLionel SambucSupport for ppc64le architecture is now available and automatically detected when using cmake system.
201*0a6a1f1dSLionel SambucUsing makefile the new "ppc64le" arch type is available.
202*0a6a1f1dSLionel SambucContributors to this work include AMD, Argonne National Lab., IBM, Intel, Texas Instruments, University of Houston and many others.
203f4a2713aSLionel Sambuc
204f4a2713aSLionel Sambuc
205f4a2713aSLionel SambucAdditional Information
206f4a2713aSLionel Sambuc======================
207f4a2713aSLionel Sambuc
208f4a2713aSLionel SambucA wide variety of additional information is available on the `Clang web
209f4a2713aSLionel Sambucpage <http://clang.llvm.org/>`_. The web page contains versions of the
210f4a2713aSLionel SambucAPI documentation which are up-to-date with the Subversion version of
211f4a2713aSLionel Sambucthe source code. You can access versions of these documents specific to
212f4a2713aSLionel Sambucthis release by going into the "``clang/docs/``" directory in the Clang
213f4a2713aSLionel Sambuctree.
214f4a2713aSLionel Sambuc
215f4a2713aSLionel SambucIf you have any questions or comments about Clang, please feel free to
216f4a2713aSLionel Sambuccontact us via the `mailing
217f4a2713aSLionel Sambuclist <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>`_.
218