xref: /aosp_15_r20/external/clang/docs/ReleaseNotes.rst (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li=====================================
2*67e74705SXin LiClang 3.9 (In-Progress) Release Notes
3*67e74705SXin Li=====================================
4*67e74705SXin Li
5*67e74705SXin Li.. contents::
6*67e74705SXin Li   :local:
7*67e74705SXin Li   :depth: 2
8*67e74705SXin Li
9*67e74705SXin LiWritten by the `LLVM Team <http://llvm.org/>`_
10*67e74705SXin Li
11*67e74705SXin Li.. warning::
12*67e74705SXin Li
13*67e74705SXin Li   These are in-progress notes for the upcoming Clang 3.9 release. You may
14*67e74705SXin Li   prefer the `Clang 3.8 Release Notes
15*67e74705SXin Li   <http://llvm.org/releases/3.8.0/tools/clang/docs/ReleaseNotes.html>`_.
16*67e74705SXin Li
17*67e74705SXin LiIntroduction
18*67e74705SXin Li============
19*67e74705SXin Li
20*67e74705SXin LiThis document contains the release notes for the Clang C/C++/Objective-C
21*67e74705SXin Lifrontend, part of the LLVM Compiler Infrastructure, release 3.9. Here we
22*67e74705SXin Lidescribe the status of Clang in some detail, including major
23*67e74705SXin Liimprovements from the previous release and new feature work. For the
24*67e74705SXin Ligeneral LLVM release notes, see `the LLVM
25*67e74705SXin Lidocumentation <http://llvm.org/docs/ReleaseNotes.html>`_. All LLVM
26*67e74705SXin Lireleases may be downloaded from the `LLVM releases web
27*67e74705SXin Lisite <http://llvm.org/releases/>`_.
28*67e74705SXin Li
29*67e74705SXin LiFor more information about Clang or LLVM, including information about
30*67e74705SXin Lithe latest release, please check out the main please see the `Clang Web
31*67e74705SXin LiSite <http://clang.llvm.org>`_ or the `LLVM Web
32*67e74705SXin LiSite <http://llvm.org>`_.
33*67e74705SXin Li
34*67e74705SXin LiNote that if you are reading this file from a Subversion checkout or the
35*67e74705SXin Limain Clang web page, this document applies to the *next* release, not
36*67e74705SXin Lithe current one. To see the release notes for a specific release, please
37*67e74705SXin Lisee the `releases page <http://llvm.org/releases/>`_.
38*67e74705SXin Li
39*67e74705SXin LiWhat's New in Clang 3.9?
40*67e74705SXin Li========================
41*67e74705SXin Li
42*67e74705SXin LiSome of the major new features and improvements to Clang are listed
43*67e74705SXin Lihere. Generic improvements to Clang as a whole or to its underlying
44*67e74705SXin Liinfrastructure are described first, followed by language-specific
45*67e74705SXin Lisections with improvements to Clang's support for those languages.
46*67e74705SXin Li
47*67e74705SXin LiMajor New Features
48*67e74705SXin Li------------------
49*67e74705SXin Li
50*67e74705SXin Li- Clang will no longer passes --build-id by default to the linker. In modern
51*67e74705SXin Li  linkers that is a relatively expensive option. It can be passed explicitly
52*67e74705SXin Li  with -Wl,--build-id. To have clang always pass it, build clang with
53*67e74705SXin Li  -DENABLE_LINKER_BUILD_ID.
54*67e74705SXin Li
55*67e74705SXin LiImprovements to Clang's diagnostics
56*67e74705SXin Li^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57*67e74705SXin Li
58*67e74705SXin LiClang's diagnostics are constantly being improved to catch more issues,
59*67e74705SXin Liexplain them more clearly, and provide more accurate source information
60*67e74705SXin Liabout them. The improvements since the 3.7 release include:
61*67e74705SXin Li
62*67e74705SXin Li-  ...
63*67e74705SXin Li
64*67e74705SXin LiNew Compiler Flags
65*67e74705SXin Li------------------
66*67e74705SXin Li
67*67e74705SXin LiThe option ....
68*67e74705SXin Li
69*67e74705SXin Li
70*67e74705SXin LiNew Pragmas in Clang
71*67e74705SXin Li-----------------------
72*67e74705SXin Li
73*67e74705SXin LiClang now supports the ...
74*67e74705SXin Li
75*67e74705SXin LiWindows Support
76*67e74705SXin Li---------------
77*67e74705SXin Li
78*67e74705SXin LiClang's support for building native Windows programs ...
79*67e74705SXin Li
80*67e74705SXin LiTLS is enabled for Cygwin defaults to -femulated-tls.
81*67e74705SXin Li
82*67e74705SXin Li
83*67e74705SXin LiC Language Changes in Clang
84*67e74705SXin Li---------------------------
85*67e74705SXin LiThe -faltivec and -maltivec flags no longer silently include altivec.h on Power platforms.
86*67e74705SXin Li
87*67e74705SXin Li`RenderScript
88*67e74705SXin Li<https://developer.android.com/guide/topics/renderscript/compute.html>`_
89*67e74705SXin Lisupport added to the Frontend and enabled by the '-x renderscript' option or
90*67e74705SXin Lithe '.rs' file extension.
91*67e74705SXin Li
92*67e74705SXin Li...
93*67e74705SXin Li
94*67e74705SXin LiC11 Feature Support
95*67e74705SXin Li^^^^^^^^^^^^^^^^^^^
96*67e74705SXin Li
97*67e74705SXin Li...
98*67e74705SXin Li
99*67e74705SXin LiC++ Language Changes in Clang
100*67e74705SXin Li-----------------------------
101*67e74705SXin Li
102*67e74705SXin Li- Clang now enforces the rule that a *using-declaration* cannot name an enumerator of a
103*67e74705SXin Li  scoped enumeration.
104*67e74705SXin Li
105*67e74705SXin Li  .. code-block:: c++
106*67e74705SXin Li
107*67e74705SXin Li    namespace Foo { enum class E { e }; }
108*67e74705SXin Li    namespace Bar {
109*67e74705SXin Li      using Foo::E::e; // error
110*67e74705SXin Li      constexpr auto e = Foo::E::e; // ok
111*67e74705SXin Li    }
112*67e74705SXin Li
113*67e74705SXin Li- Clang now enforces the rule that an enumerator of an unscoped enumeration declared at
114*67e74705SXin Li  class scope can only be named by a *using-declaration* in a derived class.
115*67e74705SXin Li
116*67e74705SXin Li  .. code-block:: c++
117*67e74705SXin Li
118*67e74705SXin Li    class Foo { enum E { e }; }
119*67e74705SXin Li    using Foo::e; // error
120*67e74705SXin Li    static constexpr auto e = Foo::e; // ok
121*67e74705SXin Li
122*67e74705SXin Li...
123*67e74705SXin Li
124*67e74705SXin LiC++1z Feature Support
125*67e74705SXin Li^^^^^^^^^^^^^^^^^^^^^
126*67e74705SXin Li
127*67e74705SXin LiClang's experimental support for the upcoming C++1z standard can be enabled with ``-std=c++1z``.
128*67e74705SXin LiChanges to C++1z features since Clang 3.8:
129*67e74705SXin Li
130*67e74705SXin Li- The ``[[fallthrough]]``, ``[[nodiscard]]``, and ``[[maybe_unused]]`` attributes are
131*67e74705SXin Li  supported in C++11 onwards, and are largely synonymous with Clang's existing attributes
132*67e74705SXin Li  ``[[clang::fallthrough]]``, ``[[gnu::warn_unused_result]]``, and ``[[gnu::unused]]``.
133*67e74705SXin Li  Use ``-Wimplicit-fallthrough`` to warn on unannotated fallthrough within ``switch``
134*67e74705SXin Li  statements.
135*67e74705SXin Li
136*67e74705SXin Li- In C++1z mode, aggregate initialization can be performed for classes with base classes:
137*67e74705SXin Li
138*67e74705SXin Li  .. code-block:: c++
139*67e74705SXin Li
140*67e74705SXin Li    struct A { int n; };
141*67e74705SXin Li    struct B : A { int x, y; };
142*67e74705SXin Li    B b = { 1, 2, 3 }; // b.n == 1, b.x == 2, b.y == 3
143*67e74705SXin Li
144*67e74705SXin Li- The range in a range-based ``for`` statement can have different types for its ``begin``
145*67e74705SXin Li  and ``end`` iterators. This is permitted as an extension in C++11 onwards.
146*67e74705SXin Li
147*67e74705SXin Li- Lambda-expressions can explicitly capture ``*this`` (to capture the surrounding object
148*67e74705SXin Li  by copy). This is permitted as an extension in C++11 onwards.
149*67e74705SXin Li
150*67e74705SXin Li- Objects of enumeration type can be direct-list-initialized from a value of the underlying
151*67e74705SXin Li  type. ``E{n}`` is equivalent to ``E(n)``, except that it implies a check for a narrowing
152*67e74705SXin Li  conversion.
153*67e74705SXin Li
154*67e74705SXin Li- Unary *fold-expression*\s over an empty pack are now rejected for all operators
155*67e74705SXin Li  other than ``&&``, ``||``, and ``,``.
156*67e74705SXin Li
157*67e74705SXin Li...
158*67e74705SXin Li
159*67e74705SXin LiObjective-C Language Changes in Clang
160*67e74705SXin Li-------------------------------------
161*67e74705SXin Li
162*67e74705SXin Li...
163*67e74705SXin Li
164*67e74705SXin LiOpenCL C Language Changes in Clang
165*67e74705SXin Li----------------------------------
166*67e74705SXin Li
167*67e74705SXin Li...
168*67e74705SXin Li
169*67e74705SXin LiOpenMP Support in Clang
170*67e74705SXin Li----------------------------------
171*67e74705SXin Li
172*67e74705SXin LiAdded support for all non-offloading features from OpenMP 4.5, including using
173*67e74705SXin Lidata members in private clauses of non-static member functions. Additionally,
174*67e74705SXin Lidata members can be used as loop control variables in loop-based directives.
175*67e74705SXin Li
176*67e74705SXin LiCurrently Clang supports OpenMP 3.1 and all non-offloading features of
177*67e74705SXin LiOpenMP 4.0/4.5. Offloading features are under development. Clang defines macro
178*67e74705SXin Li_OPENMP and sets it to OpenMP 3.1 (in accordance with OpenMP standard) by
179*67e74705SXin Lidefault. User may change this value using ``-fopenmp-version=[31|40|45]`` option.
180*67e74705SXin Li
181*67e74705SXin LiThe codegen for OpenMP constructs was significantly improved to produce much
182*67e74705SXin Limore stable and faster code.
183*67e74705SXin Li
184*67e74705SXin LiInternal API Changes
185*67e74705SXin Li--------------------
186*67e74705SXin Li
187*67e74705SXin LiThese are major API changes that have happened since the 3.8 release of
188*67e74705SXin LiClang. If upgrading an external codebase that uses Clang as a library,
189*67e74705SXin Lithis section should help get you past the largest hurdles of upgrading.
190*67e74705SXin Li
191*67e74705SXin Li-  ...
192*67e74705SXin Li
193*67e74705SXin LiAST Matchers
194*67e74705SXin Li------------
195*67e74705SXin Li
196*67e74705SXin Li- has and hasAnyArgument: Matchers no longer ignores parentheses and implicit
197*67e74705SXin Li  casts on the argument before applying the inner matcher. The fix was done to
198*67e74705SXin Li  allow for greater control by the user. In all existing checkers that use this
199*67e74705SXin Li  matcher all instances of code ``hasAnyArgument(<inner matcher>)`` or
200*67e74705SXin Li  ``has(<inner matcher>)`` must be changed to
201*67e74705SXin Li  ``hasAnyArgument(ignoringParenImpCasts(<inner matcher>))`` or
202*67e74705SXin Li  ``has(ignoringParenImpCasts(<inner matcher>))``.
203*67e74705SXin Li
204*67e74705SXin Li...
205*67e74705SXin Li
206*67e74705SXin Lilibclang
207*67e74705SXin Li--------
208*67e74705SXin Li
209*67e74705SXin Li...
210*67e74705SXin Li
211*67e74705SXin LiStatic Analyzer
212*67e74705SXin Li---------------
213*67e74705SXin Li
214*67e74705SXin Li...
215*67e74705SXin Li
216*67e74705SXin LiCore Analysis Improvements
217*67e74705SXin Li==========================
218*67e74705SXin Li
219*67e74705SXin Li- ...
220*67e74705SXin Li
221*67e74705SXin LiNew Issues Found
222*67e74705SXin Li================
223*67e74705SXin Li
224*67e74705SXin Li- ...
225*67e74705SXin Li
226*67e74705SXin LiPython Binding Changes
227*67e74705SXin Li----------------------
228*67e74705SXin Li
229*67e74705SXin LiThe following methods have been added:
230*67e74705SXin Li
231*67e74705SXin Li-  ...
232*67e74705SXin Li
233*67e74705SXin LiSignificant Known Problems
234*67e74705SXin Li==========================
235*67e74705SXin Li
236*67e74705SXin LiAdditional Information
237*67e74705SXin Li======================
238*67e74705SXin Li
239*67e74705SXin LiA wide variety of additional information is available on the `Clang web
240*67e74705SXin Lipage <http://clang.llvm.org/>`_. The web page contains versions of the
241*67e74705SXin LiAPI documentation which are up-to-date with the Subversion version of
242*67e74705SXin Lithe source code. You can access versions of these documents specific to
243*67e74705SXin Lithis release by going into the "``clang/docs/``" directory in the Clang
244*67e74705SXin Litree.
245*67e74705SXin Li
246*67e74705SXin LiIf you have any questions or comments about Clang, please feel free to
247*67e74705SXin Licontact us via the `mailing
248*67e74705SXin Lilist <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_.
249