xref: /openbsd-src/gnu/llvm/clang/docs/ReleaseNotes.rst (revision 12c855180aad702bbcca06e0398d774beeafb155)
1*12c85518Srobert===========================================
2*12c85518SrobertClang |release| |ReleaseNotesTitle|
3*12c85518Srobert===========================================
4e5dd7070Spatrick
5e5dd7070Spatrick.. contents::
6e5dd7070Spatrick   :local:
7e5dd7070Spatrick   :depth: 2
8e5dd7070Spatrick
9e5dd7070SpatrickWritten by the `LLVM Team <https://llvm.org/>`_
10e5dd7070Spatrick
11*12c85518Srobert.. only:: PreRelease
12a9ac8606Spatrick
13*12c85518Srobert  .. warning::
14*12c85518Srobert     These are in-progress notes for the upcoming Clang |version| release.
15a9ac8606Spatrick     Release notes for previous releases can be found on
16*12c85518Srobert     `the Releases Page <https://llvm.org/releases>`_.
17a9ac8606Spatrick
18e5dd7070SpatrickIntroduction
19e5dd7070Spatrick============
20e5dd7070Spatrick
21e5dd7070SpatrickThis document contains the release notes for the Clang C/C++/Objective-C
22*12c85518Srobertfrontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
23e5dd7070Spatrickdescribe the status of Clang in some detail, including major
24e5dd7070Spatrickimprovements from the previous release and new feature work. For the
25e5dd7070Spatrickgeneral LLVM release notes, see `the LLVM
26*12c85518Srobertdocumentation <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ release notes,
27*12c85518Srobertsee `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases
28*12c85518Srobertmay be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
29e5dd7070Spatrick
30e5dd7070SpatrickFor more information about Clang or LLVM, including information about the
31e5dd7070Spatricklatest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
32e5dd7070Spatrick`LLVM Web Site <https://llvm.org>`_.
33e5dd7070Spatrick
34*12c85518SrobertPotentially Breaking Changes
35*12c85518Srobert============================
36*12c85518SrobertThese changes are ones which we think may surprise users when upgrading to
37*12c85518SrobertClang |release| because of the opportunity they pose for disruption to existing
38*12c85518Srobertcode bases.
39a9ac8606Spatrick
40*12c85518Srobert- Clang's default C++/ObjC++ standard is now ``gnu++17`` instead of ``gnu++14``.
41*12c85518Srobert  This means Clang will by default accept code using features from C++17 and
42*12c85518Srobert  conforming GNU extensions. Projects incompatible with C++17 can add
43*12c85518Srobert  ``-std=gnu++14`` to their build settings to restore the previous behaviour.
44e5dd7070Spatrick
45*12c85518Srobert- The ``-fexperimental-new-pass-manager`` and ``-fno-legacy-pass-manager``
46*12c85518Srobert  flags have been removed. These flags have been silently ignored since Clang 15.
47*12c85518Srobert
48*12c85518Srobert- Clang's resource directory path previously included the full clang version.
49*12c85518Srobert  It now includes only the major version. The new resource directory is
50*12c85518Srobert  ``$prefix/lib/clang/$CLANG_MAJOR_VERSION`` and can be queried using
51*12c85518Srobert  ``clang -print-resource-dir``, just like before.
52*12c85518Srobert
53*12c85518Srobert- The ``-Wimplicit-function-declaration`` and ``-Wimplicit-int`` warnings
54*12c85518Srobert  now default to an error in C99, C11, and C17. As of C2x,
55*12c85518Srobert  support for implicit function declarations and implicit int has been removed,
56*12c85518Srobert  and the warning options will have no effect. Specifying ``-Wimplicit-int`` in
57*12c85518Srobert  C89 mode will now issue warnings instead of being a noop.
58*12c85518Srobert
59*12c85518Srobert  **NOTE**: We recommend that projects using configure scripts verify that the
60*12c85518Srobert  results do not change before/after setting
61*12c85518Srobert  ``-Werror=implicit-function-declarations`` or ``-Wimplicit-int`` to avoid
62*12c85518Srobert  incompatibility with Clang 16.
63*12c85518Srobert
64*12c85518Srobert- ``-Wincompatible-function-pointer-types`` now defaults to an error in all C
65*12c85518Srobert  language modes. It may be downgraded to a warning with
66*12c85518Srobert  ``-Wno-error=incompatible-function-pointer-types`` or disabled entirely with
67*12c85518Srobert  ``-Wno-incompatible-function-pointer-types``.
68*12c85518Srobert
69*12c85518Srobert  **NOTE:** We recommend that projects using configure scripts verify that the
70*12c85518Srobert  results do not change before/after setting
71*12c85518Srobert  ``-Werror=incompatible-function-pointer-types`` to avoid incompatibility with
72*12c85518Srobert  Clang 16.
73*12c85518Srobert
74*12c85518Srobert  .. code-block:: c
75*12c85518Srobert
76*12c85518Srobert    void func(const int *i);
77*12c85518Srobert    void other(void) {
78*12c85518Srobert      void (*fp)(int *) = func; // Previously a warning, now a downgradable error.
79*12c85518Srobert    }
80*12c85518Srobert
81*12c85518Srobert- To match GCC, ``__ppc64__`` is no longer defined on PowerPC64 targets. Use
82*12c85518Srobert  ``__powerpc64__`` instead.
83*12c85518Srobert
84*12c85518Srobert- ``-p`` is rejected for all targets which are not AIX or OpenBSD. ``-p`` led
85*12c85518Srobert  to an ``-Wunused-command-line-argument`` warning in previous releases.
86*12c85518Srobert
87*12c85518SrobertC/C++ Language Potentially Breaking Changes
88*12c85518Srobert-------------------------------------------
89*12c85518Srobert
90*12c85518Srobert- Clang now disallows types whose sizes aren't a multiple of their alignments
91*12c85518Srobert  to be used as the element type of arrays.
92*12c85518Srobert
93*12c85518Srobert  .. code-block:: c
94*12c85518Srobert
95*12c85518Srobert    typedef char int8_a16 __attribute__((aligned(16)));
96*12c85518Srobert    int8_a16 array[4]; // Now diagnosed as the element size not being a multiple of the array alignment.
97*12c85518Srobert
98*12c85518Srobert- When compiling for Windows in MSVC compatibility mode (for example by using
99*12c85518Srobert  clang-cl), the compiler will now propagate dllimport/export declspecs in
100*12c85518Srobert  explicit specializations of class template member functions (`#54717
101*12c85518Srobert  <https://github.com/llvm/llvm-project/issues/54717>`_):
102*12c85518Srobert
103*12c85518Srobert  .. code-block:: c++
104*12c85518Srobert
105*12c85518Srobert    template <typename> struct __declspec(dllexport) S {
106*12c85518Srobert      void f();
107*12c85518Srobert    };
108*12c85518Srobert    template<> void S<int>::f() {}  // clang-cl will now dllexport this.
109*12c85518Srobert
110*12c85518Srobert  This matches what MSVC does, so it improves compatibility, but it can also
111*12c85518Srobert  cause errors for code which clang-cl would previously accept, for example:
112*12c85518Srobert
113*12c85518Srobert  .. code-block:: c++
114*12c85518Srobert
115*12c85518Srobert    template <typename> struct __declspec(dllexport) S {
116*12c85518Srobert      void f();
117*12c85518Srobert    };
118*12c85518Srobert    template<> void S<int>::f() = delete;  // Error: cannot delete dllexport function.
119*12c85518Srobert
120*12c85518Srobert  .. code-block:: c++
121*12c85518Srobert
122*12c85518Srobert    template <typename> struct __declspec(dllimport) S {
123*12c85518Srobert      void f();
124*12c85518Srobert    };
125*12c85518Srobert    template<> void S<int>::f() {};  // Error: cannot define dllimport function.
126*12c85518Srobert
127*12c85518Srobert  These errors also match MSVC's behavior.
128*12c85518Srobert
129*12c85518Srobert- Clang now diagnoses indirection of ``void *`` in C++ mode as a warning which
130*12c85518Srobert  defaults to an error. This is compatible with ISO C++, GCC, ICC, and MSVC. This
131*12c85518Srobert  is also now a SFINAE error so constraint checking and SFINAE checking can be
132*12c85518Srobert  compatible with other compilers. It is expected that this will be upgraded to
133*12c85518Srobert  an error-only diagnostic in the next Clang release.
134*12c85518Srobert
135*12c85518Srobert  .. code-block:: c++
136*12c85518Srobert
137*12c85518Srobert    void func(void *p) {
138*12c85518Srobert      *p; // Now diagnosed as a warning-as-error.
139*12c85518Srobert    }
140*12c85518Srobert
141*12c85518Srobert- Clang now diagnoses use of a bit-field as an instruction operand in Microsoft
142*12c85518Srobert  style inline asm blocks as an error. Previously, a bit-field operand yielded
143*12c85518Srobert  the address of the allocation unit the bit-field was stored within; reads or
144*12c85518Srobert  writes therefore had the potential to read or write nearby bit-fields.
145*12c85518Srobert  (`#57791 <https://github.com/llvm/llvm-project/issues/57791>`_)
146*12c85518Srobert
147*12c85518Srobert  .. code-block:: c++
148*12c85518Srobert
149*12c85518Srobert    typedef struct S {
150*12c85518Srobert      unsigned bf:1;
151*12c85518Srobert    } S;
152*12c85518Srobert    void f(S s) {
153*12c85518Srobert      __asm {
154*12c85518Srobert        mov eax, s.bf // Now diagnosed as an error.
155*12c85518Srobert        mov s.bf, eax // Now diagnosed as an error.
156*12c85518Srobert      }
157*12c85518Srobert    }
158*12c85518Srobert
159*12c85518Srobert- Clang now diagnoses if structs/unions with the same name are different in
160*12c85518Srobert  different used modules. Behavior in C and Objective-C language modes now is
161*12c85518Srobert  the same as in C++.
162*12c85518Srobert
163*12c85518SrobertC++ Specific Potentially Breaking Changes
164*12c85518Srobert-----------------------------------------
165*12c85518Srobert- Clang now prohibits non-inline externally-visible definitions in C++
166*12c85518Srobert  standard header units as per ``[module.import/6]``.  In Clang 15,
167*12c85518Srobert  these definitions were allowed.  Note that such definitions are ODR
168*12c85518Srobert  violations if the header is included more than once.
169*12c85518Srobert
170*12c85518Srobert- Clang will now correctly diagnose as ill-formed a constant expression where an
171*12c85518Srobert  enum without a fixed underlying type is set to a value outside the range of
172*12c85518Srobert  the enumeration's values.
173*12c85518Srobert
174*12c85518Srobert  .. code-block:: c++
175*12c85518Srobert
176*12c85518Srobert    enum E { Zero, One, Two, Three, Four };
177*12c85518Srobert    constexpr E Val1 = (E)3;  // Ok
178*12c85518Srobert    constexpr E Val2 = (E)7;  // Ok
179*12c85518Srobert    constexpr E Val3 = (E)8;  // Now diagnosed as out of the range [0, 7]
180*12c85518Srobert    constexpr E Val4 = (E)-1; // Now diagnosed as out of the range [0, 7]
181*12c85518Srobert
182*12c85518Srobert  Due to the extended period of time this bug was present in major C++
183*12c85518Srobert  implementations (including Clang), this error has the ability to be
184*12c85518Srobert  downgraded into a warning (via: ``-Wno-error=enum-constexpr-conversion``) to
185*12c85518Srobert  provide a transition period for users. This diagnostic is expected to turn
186*12c85518Srobert  into an error-only diagnostic in the next Clang release.
187*12c85518Srobert  (`#50055 <https://github.com/llvm/llvm-project/issues/50055>`_)
188*12c85518Srobert
189*12c85518Srobert- As a side effect of implementing DR692/DR1395/DR1432, Clang now rejects some
190*12c85518Srobert  overloaded function templates as ambiguous when one of the candidates has a
191*12c85518Srobert  trailing parameter pack.
192*12c85518Srobert
193*12c85518Srobert  .. code-block:: c++
194*12c85518Srobert
195*12c85518Srobert    template <typename T> void g(T, T = T());
196*12c85518Srobert    template <typename T, typename... U> void g(T, U...);
197*12c85518Srobert    void h() {
198*12c85518Srobert      // This is rejected due to ambiguity between the pack and the
199*12c85518Srobert      // default argument. Only parameters with arguments are considered during
200*12c85518Srobert      // partial ordering of function templates.
201*12c85518Srobert      g(42);
202*12c85518Srobert    }
203*12c85518Srobert
204*12c85518SrobertABI Changes in This Version
205*12c85518Srobert---------------------------
206*12c85518Srobert- GCC doesn't pack non-POD members in packed structs unless the packed
207*12c85518Srobert  attribute is also specified on the member. Clang historically did perform
208*12c85518Srobert  such packing. Clang now matches the gcc behavior
209*12c85518Srobert  (except on Darwin, PS4 and AIX).
210*12c85518Srobert  You can switch back to the old ABI behavior with the flag:
211*12c85518Srobert  ``-fclang-abi-compat=15.0``.
212*12c85518Srobert- GCC allows POD types to have defaulted special members. Clang historically
213*12c85518Srobert  classified such types as non-POD (for the purposes of Itanium ABI). Clang now
214*12c85518Srobert  matches the gcc behavior (except on Darwin, PS4, AIX and z/OS). You can switch
215*12c85518Srobert  back to the old ABI behavior with the flag: ``-fclang-abi-compat=15.0``.
216*12c85518Srobert
217*12c85518SrobertWhat's New in Clang |release|?
218*12c85518Srobert==============================
219e5dd7070SpatrickSome of the major new features and improvements to Clang are listed
220e5dd7070Spatrickhere. Generic improvements to Clang as a whole or to its underlying
221e5dd7070Spatrickinfrastructure are described first, followed by language-specific
222e5dd7070Spatricksections with improvements to Clang's support for those languages.
223e5dd7070Spatrick
224*12c85518SrobertC++ Language Changes
225*12c85518Srobert--------------------
226*12c85518Srobert
227*12c85518SrobertC++20 Feature Support
228*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^
229*12c85518Srobert
230*12c85518SrobertNewly implemented papers:
231*12c85518Srobert
232*12c85518Srobert- Implemented `P0848: Conditionally Trivial Special Member Functions <https://wg21.link/p0848r3>`_.
233*12c85518Srobert  Note: The handling of deleted functions is not yet compliant, as Clang
234*12c85518Srobert  does not implement `DR1496 <https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1496>`_
235*12c85518Srobert  and `DR1734 <https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1734>`_.
236*12c85518Srobert
237*12c85518Srobert- Implemented `P1091R3 <https://wg21.link/p1091r3>`_ and `P1381R1 <https://wg21.link/P1381R1>`_ to
238*12c85518Srobert  support capturing structured bindings in lambdas (`#52720 <https://github.com/llvm/llvm-project/issues/52720>`_,
239*12c85518Srobert  `#54300 <https://github.com/llvm/llvm-project/issues/54300>`_,
240*12c85518Srobert  `#54301 <https://github.com/llvm/llvm-project/issues/54301>`_,
241*12c85518Srobert  `#49430 <https://github.com/llvm/llvm-project/issues/49430>`_).
242*12c85518Srobert
243*12c85518Srobert- Implemented `P2468R2: The Equality Operator You Are Looking For <http://wg21.link/p2468r2>`_.
244*12c85518Srobert
245*12c85518Srobert- Implemented `P2113R0: Proposed resolution for 2019 comment CA 112 <https://wg21.link/P2113R0>`_
246*12c85518Srobert  ([temp.func.order]p6.2.1 is not implemented, matching GCC).
247*12c85518Srobert
248*12c85518Srobert- Implemented `P0634R3: Down with typename! <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0634r3.html>`_,
249*12c85518Srobert  which removes the requirement for the ``typename`` keyword in certain contexts.
250*12c85518Srobert
251*12c85518Srobert- Implemented `P0857R0: Fixing small-ish functionality gaps in constraints <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0857r0.html>`_,
252*12c85518Srobert  which specifies constrained lambdas and constrained template *template-parameter*\s.
253*12c85518Srobert
254*12c85518Srobert- Implemented `P0960R3 <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0960r3.html>`_
255*12c85518Srobert  and `P1975R0 <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1975r0.html>`_,
256*12c85518Srobert  which allow parenthesized aggregate-initialization.
257*12c85518Srobert
258*12c85518SrobertNotable Bug Fixes to C++20 Features:
259*12c85518Srobert
260*12c85518Srobert- Clang now correctly delays the instantiation of function constraints until
261*12c85518Srobert  the time of checking, which should now allow the libstdc++ ranges implementation
262*12c85518Srobert  to work for at least trivial examples.
263*12c85518Srobert  (`#44178 <https://github.com/llvm/llvm-project/issues/44178>`_)
264*12c85518Srobert
265*12c85518Srobert- Consider explicitly defaulted constexpr/consteval special member function
266*12c85518Srobert  template instantiation to be constexpr/consteval even though a call to such
267*12c85518Srobert  a function cannot appear in a constant expression.
268*12c85518Srobert  (C++14 [dcl.constexpr]p6 (CWG DR647/CWG DR1358))
269*12c85518Srobert
270*12c85518Srobert- Correctly defer dependent immediate function invocations until template instantiation.
271*12c85518Srobert  (`#55601 <https://github.com/llvm/llvm-project/issues/55601>`_)
272*12c85518Srobert
273*12c85518Srobert- Correctly set expression evaluation context as 'immediate function context' in
274*12c85518Srobert  consteval functions.
275*12c85518Srobert  (`#51182 <https://github.com/llvm/llvm-project/issues/51182>`_)
276*12c85518Srobert
277*12c85518Srobert- Skip rebuilding lambda expressions in arguments of immediate invocations.
278*12c85518Srobert  (`#56183 <https://github.com/llvm/llvm-project/issues/56183>`_,
279*12c85518Srobert  `#51695 <https://github.com/llvm/llvm-project/issues/51695>`_,
280*12c85518Srobert  `#50455 <https://github.com/llvm/llvm-project/issues/50455>`_,
281*12c85518Srobert  `#54872 <https://github.com/llvm/llvm-project/issues/54872>`_,
282*12c85518Srobert  `#54587 <https://github.com/llvm/llvm-project/issues/54587>`_)
283*12c85518Srobert
284*12c85518Srobert- Clang implements DR2621, correcting a defect in ``using enum`` handling.  The
285*12c85518Srobert  name is found via ordinary lookup so typedefs are found.
286*12c85518Srobert
287*12c85518Srobert- Implemented CWG2635 as a Defect Report, which prohibits structured bindings from being constrained.
288*12c85518Srobert
289*12c85518Srobert- When using header modules, inclusion of a private header and violations of
290*12c85518Srobert  the `use-declaration rules
291*12c85518Srobert  <https://clang.llvm.org/docs/Modules.html#use-declaration>`_ are now
292*12c85518Srobert  diagnosed even when the includer is a textual header. This change can be
293*12c85518Srobert  temporarily reversed with ``-Xclang
294*12c85518Srobert  -fno-modules-validate-textual-header-includes``, but this flag will be
295*12c85518Srobert  removed in a future Clang release.
296*12c85518Srobert
297*12c85518SrobertC++2b Feature Support
298*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^
299*12c85518Srobert- Implemented `P2324R2: Support label at end of compound statement <https://wg21.link/p2324r2>`_.
300*12c85518Srobert- Implemented `P1169R4: static operator() <https://wg21.link/P1169R4>`_ and `P2589R1: static operator[] <https://wg21.link/P2589R1>`_.
301*12c85518Srobert- Implemented `P2513R3: char8_t Compatibility and Portability Fix <https://wg21.link/P2513R3>`_.
302*12c85518Srobert  This change was applied to C++20 as a Defect Report.
303*12c85518Srobert- Implemented `P2647R1: Permitting static constexpr variables in constexpr functions <https://wg21.link/P2647R1>`_.
304*12c85518Srobert- Implemented `CWG2640: Allow more characters in an n-char sequence <https://wg21.link/CWG2640>`_.
305*12c85518Srobert
306*12c85518SrobertResolutions to C++ Defect Reports
307*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
308*12c85518Srobert- Implemented `DR692 <https://wg21.link/cwg692>`_, `DR1395 <https://wg21.link/cwg1395>`_,
309*12c85518Srobert  and `DR1432 <https://wg21.link/cwg1432>`_. The fix for DR1432 is speculative since the
310*12c85518Srobert  issue is still open and has no proposed resolution at this time. A speculative fix
311*12c85518Srobert  for DR1432 is needed to prevent regressions that would otherwise occur due to DR692.
312*12c85518Srobert- Implemented `DR2358 <https://wg21.link/cwg2358>`_, which allows init captures in lambdas in default arguments.
313*12c85518Srobert- Implemented `DR2654 <https://wg21.link/cwg2654>`_ which undeprecates
314*12c85518Srobert  all compound assignments operations on volatile qualified variables.
315*12c85518Srobert- Implemented `DR2631 <https://wg21.link/cwg2631>`_. Invalid ``consteval`` calls in default arguments and default
316*12c85518Srobert  member initializers are diagnosed when and if the default is used.
317*12c85518Srobert  This changes the value of ``std::source_location::current()``
318*12c85518Srobert  used in default parameters calls compared to previous versions of Clang.
319*12c85518Srobert  (`#56379 <https://github.com/llvm/llvm-project/issues/56379>`_)
320*12c85518Srobert
321*12c85518SrobertC Language Changes
322a9ac8606Spatrick------------------
323*12c85518Srobert- Adjusted ``-Wformat`` warnings according to `WG14 N2562 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2562.pdf>`_.
324*12c85518Srobert  Clang will now consider default argument promotions in ``printf``, and remove
325*12c85518Srobert  unnecessary warnings. Especially ``int`` argument with specifier ``%hhd`` and
326*12c85518Srobert  ``%hd``.
327e5dd7070Spatrick
328*12c85518SrobertC2x Feature Support
329*12c85518Srobert^^^^^^^^^^^^^^^^^^^
330*12c85518Srobert- Implemented `WG14 N2662 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2662.pdf>`_,
331*12c85518Srobert  so the ``[[maybe_unused]]`` attribute may be applied to a label to silence an
332*12c85518Srobert  ``-Wunused-label`` warning.
333*12c85518Srobert- Implemented `WG14 N2508 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2508.pdf>`_,
334*12c85518Srobert  so labels can placed everywhere inside a compound statement.
335*12c85518Srobert- Implemented `WG14 N2927 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2927.htm>`_,
336*12c85518Srobert  the Not-so-magic ``typeof`` operator. Also implemented
337*12c85518Srobert  `WG14 N2930 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2930.pdf>`_,
338*12c85518Srobert  renaming ``remove_quals``, so the ``typeof_unqual`` operator is also
339*12c85518Srobert  supported. Both of these operators are supported only in C2x mode. The
340*12c85518Srobert  ``typeof`` operator specifies the type of the given parenthesized expression
341*12c85518Srobert  operand or type name, including all qualifiers. The ``typeof_unqual``
342*12c85518Srobert  operator is similar to ``typeof`` except that all qualifiers are removed,
343*12c85518Srobert  including atomic type qualification and type attributes which behave like a
344*12c85518Srobert  qualifier, such as an address space attribute.
345e5dd7070Spatrick
346*12c85518Srobert  .. code-block:: c
347e5dd7070Spatrick
348*12c85518Srobert    __attribute__((address_space(1))) const _Atomic int Val;
349*12c85518Srobert    typeof(Val) OtherVal; // type is '__attribute__((address_space(1))) const _Atomic int'
350*12c85518Srobert    typeof_unqual(Val) OtherValUnqual; // type is 'int'
351*12c85518Srobert
352*12c85518Srobert- Implemented `WG14 N3042 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3042.htm>`_,
353*12c85518Srobert  Introduce the nullptr constant. This introduces a new type ``nullptr_t``,
354*12c85518Srobert  declared in ``<stddef.h>`` which represents the type of the null pointer named
355*12c85518Srobert  constant, ``nullptr``. This constant is implicitly convertible to any pointer
356*12c85518Srobert  type and represents a type-safe null value.
357*12c85518Srobert
358*12c85518Srobert  Note, there are some known incompatibilities with this same feature in C++.
359*12c85518Srobert  The following examples were discovered during implementation and are subject
360*12c85518Srobert  to change depending on how national body comments are resolved by WG14 (C
361*12c85518Srobert  status is based on standard requirements, not necessarily implementation
362*12c85518Srobert  behavior):
363*12c85518Srobert
364*12c85518Srobert  .. code-block:: c
365*12c85518Srobert
366*12c85518Srobert    nullptr_t null_val;
367*12c85518Srobert    (nullptr_t)nullptr;       // Rejected in C, accepted in C++, Clang accepts
368*12c85518Srobert    (void)(1 ? nullptr : 0);  // Rejected in C, accepted in C++, Clang rejects
369*12c85518Srobert    (void)(1 ? null_val : 0); // Rejected in C, accepted in C++, Clang rejects
370*12c85518Srobert    bool b1 = nullptr;        // Accepted in C, rejected in C++, Clang rejects
371*12c85518Srobert    b1 = null_val;            // Accepted in C, rejected in C++, Clang rejects
372*12c85518Srobert    null_val = 0;             // Rejected in C, accepted in C++, Clang rejects
373*12c85518Srobert
374*12c85518Srobert    void func(nullptr_t);
375*12c85518Srobert    func(0);                  // Rejected in C, accepted in C++, Clang rejects
376*12c85518Srobert
377*12c85518Srobert- Implemented `WG14 N2975 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf>`_,
378*12c85518Srobert  Relax requirements for va_start. In C2x mode, functions can now be declared
379*12c85518Srobert  fully variadic and the ``va_start`` macro no longer requires passing a second
380*12c85518Srobert  argument (though it accepts a second argument for backwards compatibility).
381*12c85518Srobert  If a second argument is passed, it is neither expanded nor evaluated in C2x
382*12c85518Srobert  mode.
383*12c85518Srobert
384*12c85518Srobert  .. code-block:: c
385*12c85518Srobert
386*12c85518Srobert    void func(...) {  // Invalid in C17 and earlier, valid in C2x and later.
387*12c85518Srobert      va_list list;
388*12c85518Srobert      va_start(list); // Invalid in C17 and earlier, valid in C2x and later.
389*12c85518Srobert      va_end(list);
390*12c85518Srobert    }
391*12c85518Srobert
392*12c85518Srobert- Diagnose type definitions in the ``type`` argument of ``__builtin_offsetof``
393*12c85518Srobert  as a conforming C extension according to
394*12c85518Srobert  `WG14 N2350 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm>`_.
395*12c85518Srobert  Also documents the builtin appropriately. Note, a type definition in C++
396*12c85518Srobert  continues to be rejected.
397*12c85518Srobert
398*12c85518SrobertOpenCL Kernel Language Changes
399*12c85518Srobert------------------------------
400*12c85518Srobert
401*12c85518Srobert- Improved diagnostics for C++ templates used in kernel arguments.
402*12c85518Srobert- Removed redundant pragma for the ``arm-integer-dot-product`` extension.
403*12c85518Srobert- Improved support of enqueued block for AMDGPU.
404*12c85518Srobert- Added ``nounwind`` attribute implicitly to all functions.
405*12c85518Srobert- Improved builtin functions support:
406*12c85518Srobert
407*12c85518Srobert  * Allow disabling default header-based feature/extension support by passing ``-D__undef_<feature>``.
408*12c85518Srobert  * Fixed conditional definition of the depth image and ``read_write image3d`` builtins.
409e5dd7070Spatrick
410e5dd7070SpatrickNon-comprehensive list of changes in this release
411e5dd7070Spatrick-------------------------------------------------
412*12c85518Srobert- It's now possible to set the crash diagnostics directory through
413*12c85518Srobert  the environment variable ``CLANG_CRASH_DIAGNOSTICS_DIR``.
414*12c85518Srobert  The ``-fcrash-diagnostics-dir`` flag takes precedence.
415e5dd7070Spatrick
416*12c85518Srobert- Unicode support has been updated to support Unicode 15.0.
417*12c85518Srobert  New unicode codepoints are supported as appropriate in diagnostics,
418*12c85518Srobert  C and C++ identifiers, and escape sequences.
419*12c85518Srobert
420*12c85518Srobert- In identifiers, Clang allows a restricted set of additional mathematical symbols
421*12c85518Srobert  as an extension. These symbols correspond to a proposed Unicode
422*12c85518Srobert  `Mathematical notation profile for default identifiers
423*12c85518Srobert  <https://www.unicode.org/L2/L2022/22230-math-profile.pdf>`_.
424*12c85518Srobert  (`#54732 <https://github.com/llvm/llvm-project/issues/54732>`_)
425*12c85518Srobert
426*12c85518Srobert- Clang now supports loading multiple configuration files. The files from
427*12c85518Srobert  default configuration paths are loaded first, unless ``--no-default-config``
428*12c85518Srobert  option is used. All files explicitly specified using ``--config=`` option
429*12c85518Srobert  are loaded afterwards.
430*12c85518Srobert
431*12c85518Srobert- When loading default configuration files, clang now unconditionally uses
432*12c85518Srobert  the real target triple (respecting options such as ``--target=`` and ``-m32``)
433*12c85518Srobert  rather than the executable prefix. The respective configuration files are
434*12c85518Srobert  also loaded when clang is called via an executable without a prefix (e.g.
435*12c85518Srobert  plain ``clang``).
436*12c85518Srobert
437*12c85518Srobert- Default configuration paths were partially changed. Clang now attempts to load
438*12c85518Srobert  ``<triple>-<driver>.cfg`` first, and falls back to loading both
439*12c85518Srobert  ``<driver>.cfg`` and ``<triple>.cfg`` if the former is not found. `Triple`
440*12c85518Srobert  is the target triple and `driver` first tries the canonical name
441*12c85518Srobert  for the driver (respecting ``--driver-mode=``), and then the name found
442*12c85518Srobert  in the executable.
443*12c85518Srobert
444*12c85518Srobert- If the environment variable ``SOURCE_DATE_EPOCH`` is set, it specifies a UNIX
445*12c85518Srobert  timestamp to be used in replacement of the current date and time in
446*12c85518Srobert  the ``__DATE__``, ``__TIME__``, and ``__TIMESTAMP__`` macros. See
447*12c85518Srobert  `<https://reproducible-builds.org/docs/source-date-epoch/>`_.
448*12c85518Srobert
449*12c85518Srobert- Clang now supports ``__has_constexpr_builtin`` function-like macro that
450*12c85518Srobert  evaluates to 1 if the builtin is supported and can be constant evaluated.
451*12c85518Srobert  It can be used to writing conditionally constexpr code that uses builtins.
452*12c85518Srobert
453*12c85518Srobert- The time profiler (using ``-ftime-trace`` option) now traces various constant
454*12c85518Srobert  evaluation events.
455*12c85518Srobert
456*12c85518Srobert- Clang can now generate a PCH when using ``-fdelayed-template-parsing`` for
457*12c85518Srobert  code with templates containing loop hint pragmas, OpenMP pragmas, and
458*12c85518Srobert  ``#pragma unused``.
459e5dd7070Spatrick
460e5dd7070SpatrickNew Compiler Flags
461e5dd7070Spatrick------------------
462e5dd7070Spatrick
463*12c85518Srobert- Implemented ``-fcoro-aligned-allocation`` flag. This flag implements
464*12c85518Srobert  Option 2 of P2014R0 aligned allocation of coroutine frames
465*12c85518Srobert  (`P2014R0 <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2014r0.pdf>`_).
466*12c85518Srobert  With this flag, the coroutines will try to lookup aligned allocation
467*12c85518Srobert  function all the time. The compiler will emit an error if it fails to
468*12c85518Srobert  find aligned allocation function. So if the user code implemented self
469*12c85518Srobert  defined allocation function for coroutines, the existing code will be
470*12c85518Srobert  broken. A little divergence with P2014R0 is that clang will lookup
471*12c85518Srobert  ``::operator new(size_­t, std::aligned_val_t, nothrow_­t)`` if there is
472*12c85518Srobert  ``get_­return_­object_­on_­allocation_­failure``. We feel this is more consistent
473*12c85518Srobert  with the intention.
474e5dd7070Spatrick
475*12c85518Srobert- Added ``--no-default-config`` to disable automatically loading configuration
476*12c85518Srobert  files using default paths.
477389bb291Spatrick
478*12c85518Srobert- Added the new level, ``3``, to the ``-fstrict-flex-arrays=`` flag. The new
479*12c85518Srobert  level is the strict, standards-conforming mode for flexible array members. It
480*12c85518Srobert  recognizes only incomplete arrays as flexible array members (which is how the
481*12c85518Srobert  feature is defined by the C standard).
482389bb291Spatrick
483*12c85518Srobert  .. code-block:: c
484*12c85518Srobert
485*12c85518Srobert    struct foo {
486*12c85518Srobert      int a;
487*12c85518Srobert      int b[]; // Flexible array member.
488*12c85518Srobert    };
489*12c85518Srobert
490*12c85518Srobert    struct bar {
491*12c85518Srobert      int a;
492*12c85518Srobert      int b[0]; // NOT a flexible array member.
493*12c85518Srobert    };
494*12c85518Srobert
495*12c85518Srobert- Added ``-fmodule-output`` to enable the one-phase compilation model for
496*12c85518Srobert  standard C++ modules. See
497*12c85518Srobert  `Standard C++ Modules <https://clang.llvm.org/docs/StandardCPlusPlusModules.html>`_
498*12c85518Srobert  for more information.
499*12c85518Srobert
500*12c85518Srobert- Added ``-Rpass-analysis=stack-frame-layout`` which will emit new diagnostic
501*12c85518Srobert  information about the layout of stack frames through the remarks
502*12c85518Srobert  infrastructure. Since it uses remarks the diagnostic information is available
503*12c85518Srobert  both on the CLI, and in a machine readable format.
504e5dd7070Spatrick
505a9ac8606SpatrickDeprecated Compiler Flags
506a9ac8606Spatrick-------------------------
507*12c85518Srobert- ``-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang``
508*12c85518Srobert  has been deprecated. The flag will be removed in Clang 18.
509*12c85518Srobert  ``-ftrivial-auto-var-init=zero`` is now available unconditionally, to be
510*12c85518Srobert  compatible with GCC.
511*12c85518Srobert- ``-fcoroutines-ts`` has been deprecated. The flag will be removed in Clang 17.
512*12c85518Srobert  Please use ``-std=c++20`` or higher to use standard C++ coroutines instead.
513*12c85518Srobert- ``-fmodules-ts`` has been deprecated. The flag will be removed in Clang 17.
514*12c85518Srobert  Please use ``-std=c++20`` or higher to use standard C++ modules instead.
515e5dd7070Spatrick
516e5dd7070SpatrickModified Compiler Flags
517e5dd7070Spatrick-----------------------
518*12c85518Srobert- Clang now permits specifying ``--config=`` multiple times, to load multiple
519*12c85518Srobert  configuration files.
520e5dd7070Spatrick
521*12c85518Srobert- The option ``-rtlib=platform`` can now be used for all targets to override
522*12c85518Srobert  a different option value (either one set earlier on the command line, or a
523*12c85518Srobert  built-in hardcoded default). (Previously the MSVC and Darwin targets didn't
524*12c85518Srobert  allow this parameter combination.)
525a9ac8606Spatrick
526a9ac8606SpatrickRemoved Compiler Flags
527a9ac8606Spatrick-------------------------
528*12c85518Srobert- Clang now no longer supports ``-cc1 -fconcepts-ts``.  This flag has been deprecated
529*12c85518Srobert  and encouraged use of ``-std=c++20`` since Clang 10, so we're now removing it.
530e5dd7070Spatrick
531e5dd7070SpatrickAttribute Changes in Clang
532e5dd7070Spatrick--------------------------
533*12c85518Srobert- Added support for ``__attribute__((guard(nocf)))`` and C++-style
534*12c85518Srobert  ``[[clang::guard(nocf)]]``, which is equivalent to ``__declspec(guard(nocf))``
535*12c85518Srobert  when using the MSVC environment. This is to support enabling Windows Control
536*12c85518Srobert  Flow Guard checks with the ability to disable them for specific functions when
537*12c85518Srobert  using the MinGW environment. This attribute is only available for Windows
538a9ac8606Spatrick  targets.
539e5dd7070Spatrick
540*12c85518Srobert- Introduced a new function attribute ``__attribute__((nouwtable))`` to suppress
541*12c85518Srobert  LLVM IR ``uwtable`` function attribute.
542e5dd7070Spatrick
543*12c85518Srobert- Updated the value returned by ``__has_c_attribute(nodiscard)`` to ``202003L``
544*12c85518Srobert  based on the final date specified by the C2x committee draft. We already
545*12c85518Srobert  supported the ability to specify a message in the attribute, so there were no
546*12c85518Srobert  changes to the attribute behavior.
547e5dd7070Spatrick
548*12c85518Srobert- Updated the value returned by ``__has_c_attribute(fallthrough)`` to ``201910L``
549*12c85518Srobert  based on the final date specified by the C2x committee draft. We previously
550*12c85518Srobert  used ``201904L`` (the date the proposal was seen by the committee) by mistake.
551*12c85518Srobert  There were no other changes to the attribute behavior.
552e5dd7070Spatrick
553*12c85518Srobert- Introduced a new record declaration attribute ``__attribute__((enforce_read_only_placement))``
554*12c85518Srobert  to support analysis of instances of a given type focused on read-only program
555*12c85518Srobert  memory placement. It emits a warning if something in the code provably prevents
556*12c85518Srobert  an instance from a read-only memory placement.
557e5dd7070Spatrick
558*12c85518Srobert- Introduced new attribute ``__attribute__((target_version("cpu_features")))``
559*12c85518Srobert  and expanded the functionality of the existing attribute
560*12c85518Srobert  ``__attribute__((target_clones("cpu_features1","cpu_features2",...)))`` to
561*12c85518Srobert  support Function Multi Versioning on AArch64 target. It detects at runtime
562*12c85518Srobert  which function versions are supported by CPU and calls the one with highest
563*12c85518Srobert  priority. Refer to `clang attributes
564*12c85518Srobert  <https://clang.llvm.org/docs/AttributeReference.html#target-version>`_ for
565*12c85518Srobert  more details.
566e5dd7070Spatrick
567*12c85518SrobertImprovements to Clang's diagnostics
568*12c85518Srobert-----------------------------------
569*12c85518Srobert- Disabled a FIX-IT suggested for a case of bad conversion in system headers.
570e5dd7070Spatrick
571*12c85518Srobert- Clang will now check compile-time determinable string literals as format strings.
572*12c85518Srobert  (`#55805 <https://github.com/llvm/llvm-project/issues/55805>`_)
573e5dd7070Spatrick
574*12c85518Srobert- ``-Wformat`` now recognizes ``%b`` for the ``printf``/``scanf`` family of
575*12c85518Srobert  functions and ``%B`` for the ``printf`` family of functions.
576*12c85518Srobert  (`#56885 <https://github.com/llvm/llvm-project/issues/56885>`_)
577e5dd7070Spatrick
578*12c85518Srobert- Introduced ``-Wsingle-bit-bitfield-constant-conversion``, grouped under
579*12c85518Srobert  ``-Wbitfield-constant-conversion``, which diagnoses implicit truncation when
580*12c85518Srobert  ``1`` is assigned to a 1-bit signed integer bitfield. To reduce
581*12c85518Srobert  potential false positives, this diagnostic will not diagnose use of the
582*12c85518Srobert  ``true`` macro (from ``<stdbool.h>``) in C language mode despite the macro
583*12c85518Srobert  being defined to expand to ``1``. (`#53253 <https://github.com/llvm/llvm-project/issues/53253>`_)
584*12c85518Srobert
585*12c85518Srobert- Clang will now print more information about failed static assertions. In
586*12c85518Srobert  particular, simple static assertion expressions are evaluated to their
587*12c85518Srobert  compile-time value and printed out if the assertion fails.
588*12c85518Srobert
589*12c85518Srobert- Diagnostics about uninitialized ``constexpr`` variables have been improved
590*12c85518Srobert  to mention the missing constant initializer.
591*12c85518Srobert
592*12c85518Srobert- Correctly diagnose a future keyword if it exists as a keyword in the higher
593*12c85518Srobert  language version and specifies in which version it will be a keyword. This
594*12c85518Srobert  supports both C and C++.
595*12c85518Srobert
596*12c85518Srobert- ``no_sanitize("...")`` on a global variable for known but not relevant
597*12c85518Srobert  sanitizers is now just a warning. It now says that this will be ignored
598*12c85518Srobert  instead of incorrectly saying no_sanitize only applies to functions and
599*12c85518Srobert  methods.
600*12c85518Srobert
601*12c85518Srobert- No longer mention ``reinterpet_cast`` in the invalid constant expression
602*12c85518Srobert  diagnostic note when in C mode.
603*12c85518Srobert
604*12c85518Srobert- Clang will now give a more suitale diagnostic for declaration of block
605*12c85518Srobert  scope identifiers that have external/internal linkage that has an initializer.
606*12c85518Srobert  (`#57478 <https://github.com/llvm/llvm-project/issues/57478>`_)
607*12c85518Srobert
608*12c85518Srobert- A new analysis pass will helps preserve sugar when combining deductions, in an
609*12c85518Srobert  order agnostic way. This will be in effect when deducing template arguments,
610*12c85518Srobert  when deducing function return type from multiple return statements, for the
611*12c85518Srobert  conditional operator, and for most binary operations. Type sugar is combined
612*12c85518Srobert  in a way that strips the sugar which is different between terms, and preserves
613*12c85518Srobert  those which are common.
614*12c85518Srobert
615*12c85518Srobert- Correctly diagnose the use of an integer literal without a suffix whose
616*12c85518Srobert  underlying type is ``long long`` or ``unsigned long long`` as an extension in
617*12c85518Srobert  C89 mode . Clang previously only diagnosed if the literal had an explicit
618*12c85518Srobert  ``LL`` suffix.
619*12c85518Srobert
620*12c85518Srobert- Clang now correctly diagnoses index that refers past the last possible element
621*12c85518Srobert  of FAM-like arrays.
622*12c85518Srobert
623*12c85518Srobert- Clang now correctly emits a warning when dereferencing a void pointer in C mode.
624*12c85518Srobert  (`#53631 <https://github.com/llvm/llvm-project/issues/53631>`_)
625*12c85518Srobert
626*12c85518Srobert- Clang will now diagnose an overload set where a candidate has a constraint that
627*12c85518Srobert  refers to an expression with a previous error as nothing viable, so that it
628*12c85518Srobert  doesn't generate strange cascading errors, particularly in cases where a
629*12c85518Srobert  subsuming constraint fails, which would result in a less-specific overload to
630*12c85518Srobert  be selected.
631*12c85518Srobert
632*12c85518Srobert- Add a fix-it hint for the ``-Wdefaulted-function-deleted`` warning to
633*12c85518Srobert  explicitly delete the function.
634*12c85518Srobert
635*12c85518Srobert- Fixed an accidental duplicate diagnostic involving the declaration of a
636*12c85518Srobert  function definition without a prototype which is preceded by a static
637*12c85518Srobert  declaration of the function with a prototype.
638*12c85518Srobert  (`#58181 <https://github.com/llvm/llvm-project/issues/58181>`_)
639*12c85518Srobert
640*12c85518Srobert- Copy-elided initialization of lock scopes is now handled differently in
641*12c85518Srobert  ``-Wthread-safety-analysis``: annotations on the move constructor are no
642*12c85518Srobert  longer taken into account, in favor of annotations on the function returning
643*12c85518Srobert  the lock scope by value. This could result in new warnings if code depended
644*12c85518Srobert  on the previous undocumented behavior. As a side effect of this change,
645*12c85518Srobert  constructor calls outside of initializer expressions are no longer ignored,
646*12c85518Srobert  which can result in new warnings (or make existing warnings disappear).
647*12c85518Srobert
648*12c85518Srobert- The wording of diagnostics regarding arithmetic on fixed-sized arrays and
649*12c85518Srobert  pointers is improved to include the type of the array and whether it's cast
650*12c85518Srobert  to another type. This should improve comprehension for why an index is
651*12c85518Srobert  out-of-bounds.
652*12c85518Srobert
653*12c85518Srobert- Clang now correctly points to the problematic parameter for the ``-Wnonnull``
654*12c85518Srobert  warning. (`#58273 <https://github.com/llvm/llvm-project/issues/58273>`_)
655*12c85518Srobert
656*12c85518Srobert- Introduced ``-Wcast-function-type-strict`` and
657*12c85518Srobert  ``-Wincompatible-function-pointer-types-strict`` to warn about function type
658*12c85518Srobert  mismatches in casts and assignments that may result in runtime indirect call
659*12c85518Srobert  `Control-Flow Integrity (CFI)
660*12c85518Srobert  <https://clang.llvm.org/docs/ControlFlowIntegrity.html>`_ failures. The
661*12c85518Srobert  ``-Wcast-function-type-strict`` diagnostic is grouped under
662*12c85518Srobert  ``-Wcast-function-type`` as it identifies a more strict set of potentially
663*12c85518Srobert  problematic function type casts.
664*12c85518Srobert
665*12c85518Srobert- Clang will now disambiguate NTTP types when printing diagnostic that contain NTTP types.
666*12c85518Srobert  (`#57562 <https://github.com/llvm/llvm-project/issues/57562>`_)
667*12c85518Srobert
668*12c85518Srobert- Better error recovery for pack expansion of expressions.
669*12c85518Srobert  (`#58673 <https://github.com/llvm/llvm-project/issues/58673>`_)
670*12c85518Srobert
671*12c85518Srobert- Better diagnostics when the user has missed ``auto`` in a declaration.
672*12c85518Srobert  (`#49129 <https://github.com/llvm/llvm-project/issues/49129>`_)
673*12c85518Srobert
674*12c85518Srobert- Clang now diagnoses use of invalid or reserved module names in a module
675*12c85518Srobert  export declaration. Both are diagnosed as an error, but the diagnostic is
676*12c85518Srobert  suppressed for use of reserved names in a system header.
677*12c85518Srobert
678*12c85518Srobert- ``-Winteger-overflow`` will diagnose overflow in more cases.
679*12c85518Srobert  (`#58944 <https://github.com/llvm/llvm-project/issues/58944>`_)
680*12c85518Srobert
681*12c85518Srobert- Clang has an internal limit of 2GB of preprocessed source code per
682*12c85518Srobert  compilation, including source reachable through imported AST files such as
683*12c85518Srobert  PCH or modules. When Clang hits this limit, it now produces notes mentioning
684*12c85518Srobert  which header and source files are consuming large amounts of this space.
685*12c85518Srobert  ``#pragma clang __debug sloc_usage`` can also be used to request this report.
686*12c85518Srobert
687*12c85518Srobert- Clang no longer permits the keyword 'bool' in a concept declaration as a
688*12c85518Srobert  concepts-ts compatibility extension.
689*12c85518Srobert
690*12c85518Srobert- Clang now diagnoses overflow undefined behavior in a constant expression while
691*12c85518Srobert  evaluating a compound assignment with remainder as operand.
692*12c85518Srobert
693*12c85518Srobert- Add ``-Wreturn-local-addr``, a GCC alias for ``-Wreturn-stack-address``.
694*12c85518Srobert
695*12c85518Srobert- Clang now suppresses ``-Wlogical-op-parentheses`` on ``(x && a || b)`` and ``(a || b && x)``
696*12c85518Srobert  only when ``x`` is a string literal.
697*12c85518Srobert
698*12c85518Srobert- Clang will now reject the GNU extension address of label in coroutines explicitly.
699*12c85518Srobert  (`#56436 <https://github.com/llvm/llvm-project/issues/56436>`_)
700*12c85518Srobert
701*12c85518Srobert- Clang now automatically adds ``[[clang::lifetimebound]]`` to the parameters of
702*12c85518Srobert  ``std::move, std::forward`` et al, this enables Clang to diagnose more cases
703*12c85518Srobert  where the returned reference outlives the object.
704*12c85518Srobert
705*12c85518Srobert- Fix clang not properly diagnosing the failing subexpression when chained
706*12c85518Srobert  binary operators are used in a ``static_assert`` expression.
707*12c85518Srobert
708*12c85518Srobert- ``-Wtautological-compare`` missed warnings for tautological comparisons
709*12c85518Srobert  involving a negative integer literal.
710*12c85518Srobert  (`#42918 <https://github.com/llvm/llvm-project/issues/42918>`_)
711*12c85518Srobert
712*12c85518Srobert- ``-Wcomma`` is no longer emitted for void returning functions.
713*12c85518Srobert  (`#57151 <https://github.com/llvm/llvm-project/issues/57151>`_)
714*12c85518Srobert
715*12c85518SrobertBug Fixes in This Version
716*12c85518Srobert-------------------------
717*12c85518Srobert
718*12c85518Srobert- Fix crash when attempting to perform parenthesized initialization of an
719*12c85518Srobert  aggregate with a base class with only non-public constructors.
720*12c85518Srobert  (`#62296 <https://github.com/llvm/llvm-project/issues/62296>`_)
721*12c85518Srobert- Fix crash when handling nested immediate invocations in initializers of global
722*12c85518Srobert  variables.
723*12c85518Srobert  (`#58207 <https://github.com/llvm/llvm-project/issues/58207>`_)
724*12c85518Srobert- Fix crash when passing a braced initializer list to a parentehsized aggregate
725*12c85518Srobert  initialization expression.
726*12c85518Srobert  (`#63008 <https://github.com/llvm/llvm-project/issues/63008>`_).
727*12c85518Srobert
728*12c85518SrobertBug Fixes to Compiler Builtins
729*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
730*12c85518Srobert
731*12c85518Srobert- ``stdatomic.h`` will use the internal declarations when targeting pre-C++-23
732*12c85518Srobert  on Windows platforms as the MSVC support requires newer C++ standard.
733*12c85518Srobert
734*12c85518Srobert- Correct ``_Static_assert`` to accept the same set of extended integer
735*12c85518Srobert  constant expressions as is accpted in other contexts that accept them.
736*12c85518Srobert  (`#57687 <https://github.com/llvm/llvm-project/issues/57687>`_)
737*12c85518Srobert
738*12c85518Srobert- Fix crashes caused when builtin C++ language extension type traits were
739*12c85518Srobert  instantiated by templates with an unexpected number of arguments.
740*12c85518Srobert  (`#57008 <https://github.com/llvm/llvm-project/issues/57008>`_)
741*12c85518Srobert
742*12c85518Srobert- Fix ``__builtin_assume_aligned`` crash when the 1st arg is array type.
743*12c85518Srobert  (`#57169 <https://github.com/llvm/llvm-project/issues/57169>`_)
744*12c85518Srobert
745*12c85518Srobert- Fixes to builtin template emulation of regular templates.
746*12c85518Srobert  (`#42102 <https://github.com/llvm/llvm-project/issues/42102>`_,
747*12c85518Srobert  `#51928 <https://github.com/llvm/llvm-project/issues/51928>`_)
748*12c85518Srobert
749*12c85518Srobert- Fix incorrect handling of inline builtins with asm labels.
750*12c85518Srobert
751*12c85518Srobert- The builtin type trait ``__is_aggregate`` now returns ``true`` for arrays of incomplete
752*12c85518Srobert  types in accordance with the suggested fix for `LWG3823 <https://cplusplus.github.io/LWG/issue3823>`_
753*12c85518Srobert
754*12c85518SrobertBug Fixes to Attribute Support
755*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
756*12c85518Srobert- Fixes an accepts-invalid bug in C when using a ``_Noreturn`` function
757*12c85518Srobert  specifier on something other than a function declaration.
758*12c85518Srobert  (`#56800 <https://github.com/llvm/llvm-project/issues/56800>`_)
759*12c85518Srobert
760*12c85518Srobert- No longer assert/miscompile when trying to make a vectorized ``_BitInt`` type
761*12c85518Srobert  using the ``ext_vector_type`` attribute (the ``vector_size`` attribute was
762*12c85518Srobert  already properly diagnosing this case).
763*12c85518Srobert
764*12c85518Srobert- Invalid destructor names are no longer accepted on template classes.
765*12c85518Srobert  (`#56772 <https://github.com/llvm/llvm-project/issues/56772>`_)
766*12c85518Srobert
767*12c85518Srobert- Improve compile-times with large dynamic array allocations with trivial
768*12c85518Srobert  constructors.
769*12c85518Srobert  (`#56774 <https://github.com/llvm/llvm-project/issues/56774>`_)
770*12c85518Srobert
771*12c85518Srobert- Fix a crash when a ``btf_type_tag`` attribute is applied to the pointee of
772*12c85518Srobert  a function pointer.
773*12c85518Srobert
774*12c85518Srobert- In C mode, when ``e1`` has ``__attribute__((noreturn))`` but ``e2`` doesn't,
775*12c85518Srobert  ``(c ? e1 : e2)`` is no longer considered noreturn, fixing a miscompilation.
776*12c85518Srobert  (`#59792 <https://github.com/llvm/llvm-project/issues/59792>`_)
777*12c85518Srobert
778*12c85518Srobert- GNU attributes being applied prior to standard attributes would be handled
779*12c85518Srobert  improperly, which was corrected to match the behaviour exhibited by GCC.
780*12c85518Srobert  (`#58229 <https://github.com/llvm/llvm-project/issues/58229>`_)
781*12c85518Srobert
782*12c85518Srobert- Fix issue using __attribute__((format)) on non-variadic functions that expect
783*12c85518Srobert  more than one formatted argument.
784*12c85518Srobert
785*12c85518Srobert- Clang will now no longer treat a C 'overloadable' function without a prototype as
786*12c85518Srobert  a variadic function with the attribute.  This should make further diagnostics more
787*12c85518Srobert  clear.
788*12c85518Srobert
789*12c85518SrobertBug Fixes to C++ Support
790*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^^
791*12c85518Srobert- No longer issue a pre-C++2b compatibility warning in ``-pedantic`` mode
792*12c85518Srobert  regading overloaded `operator[]` with more than one parmeter or for static
793*12c85518Srobert  lambdas. (`#61582 <https://github.com/llvm/llvm-project/issues/61582>`_)
794*12c85518Srobert
795*12c85518Srobert- Address the thread identification problems in coroutines.
796*12c85518Srobert  (`#47177 <https://github.com/llvm/llvm-project/issues/47177>`_,
797*12c85518Srobert  `#47179 <https://github.com/llvm/llvm-project/issues/47179>`_)
798*12c85518Srobert
799*12c85518Srobert- Reject non-type template arguments formed by casting a non-zero integer
800*12c85518Srobert  to a pointer in pre-C++17 modes, instead of treating them as null
801*12c85518Srobert  pointers.
802*12c85518Srobert
803*12c85518Srobert- Fix template arguments of pointer and reference not taking the type as
804*12c85518Srobert  part of their identity.
805*12c85518Srobert  (`#47136 <https://github.com/llvm/llvm-project/issues/47136>`_)
806*12c85518Srobert
807*12c85518Srobert- Fix handling of unexpanded packs in template argument expressions.
808*12c85518Srobert  (`#58679 <https://github.com/llvm/llvm-project/issues/58679>`_)
809*12c85518Srobert
810*12c85518Srobert- Fix bug with ``using enum`` that could lead to enumerators being treated as if
811*12c85518Srobert  they were part of an overload set.
812*12c85518Srobert  (`#58067 <https://github.com/llvm/llvm-project/issues/58057>`_,
813*12c85518Srobert  `#59014 <https://github.com/llvm/llvm-project/issues/59014>`_,
814*12c85518Srobert  `#54746 <https://github.com/llvm/llvm-project/issues/54746>`_)
815*12c85518Srobert
816*12c85518Srobert- Fix bug where constant evaluation treated a pointer to member that points to
817*12c85518Srobert  a weak member as never being null. Such comparisons are now treated as
818*12c85518Srobert  non-constant.
819*12c85518Srobert
820*12c85518Srobert- Fix issue that the standard C++ modules importer will call global
821*12c85518Srobert  constructor/destructor for the global variables in the importing modules.
822*12c85518Srobert  (`#59765 <https://github.com/llvm/llvm-project/issues/59765>`_)
823*12c85518Srobert
824*12c85518Srobert- Reject in-class defaulting of previously declared comparison operators.
825*12c85518Srobert  (`#51227 <https://github.com/llvm/llvm-project/issues/51227>`_)
826*12c85518Srobert
827*12c85518Srobert- Do not hide templated base members introduced via using-decl in derived class
828*12c85518Srobert  (useful specially for constrained members). (`#50886 <https://github.com/llvm/llvm-project/issues/50886>`_)
829*12c85518Srobert
830*12c85518Srobert- Fix default member initializers sometimes being ignored when performing
831*12c85518Srobert  parenthesized aggregate initialization of templated types.
832*12c85518Srobert  (`#62266 <https://github.com/llvm/llvm-project/issues/62266>`_)
833*12c85518Srobert- Fix overly aggressive lifetime checks for parenthesized aggregate
834*12c85518Srobert  initialization.
835*12c85518Srobert  (`#61567 <https://github.com/llvm/llvm-project/issues/61567>`_)
836*12c85518Srobert
837*12c85518SrobertConcepts Specific Fixes:
838*12c85518Srobert
839*12c85518Srobert- Class member variables are now in scope when parsing a ``requires`` clause.
840*12c85518Srobert  (`#55216 <https://github.com/llvm/llvm-project/issues/55216>`_)
841*12c85518Srobert
842*12c85518Srobert- Required parameter pack to be provided at the end of the concept parameter list.
843*12c85518Srobert  (`#48182 <https://github.com/llvm/llvm-project/issues/48182>`_)
844*12c85518Srobert
845*12c85518Srobert- Correctly handle access-checks in requires expression. (`#53364 <https://github.com/llvm/llvm-project/issues/53364>`_,
846*12c85518Srobert  `#53334 <https://github.com/llvm/llvm-project/issues/53334>`_)
847*12c85518Srobert
848*12c85518Srobert- Fixed an issue with concept requirement evaluation, where we incorrectly allowed implicit
849*12c85518Srobert  conversions to bool for a requirement.  (`#54524 <https://github.com/llvm/llvm-project/issues/54524>`_)
850*12c85518Srobert
851*12c85518Srobert- Fix a crash when emitting a concept-related diagnostic.
852*12c85518Srobert  (`#57415 <https://github.com/llvm/llvm-project/issues/57415>`_)
853*12c85518Srobert
854*12c85518Srobert- Fix a crash when trying to form a recovery expression on a call inside a
855*12c85518Srobert  constraint, which re-evaluated the same constraint.
856*12c85518Srobert  (`#53213 <https://github.com/llvm/llvm-project/issues/53213>`_,
857*12c85518Srobert  `#45736 <https://github.com/llvm/llvm-project/issues/45736>`_)
858*12c85518Srobert
859*12c85518Srobert- Fix an issue when performing constraints partial ordering on non-template
860*12c85518Srobert  functions. (`#56154 <https://github.com/llvm/llvm-project/issues/56154>`_)
861*12c85518Srobert
862*12c85518Srobert- Fix a number of recursively-instantiated constraint issues, which would possibly
863*12c85518Srobert  result in a stack overflow.
864*12c85518Srobert  (`#44304 <https://github.com/llvm/llvm-project/issues/44304>`_,
865*12c85518Srobert  `#50891 <https://github.com/llvm/llvm-project/issues/50891>`_)
866*12c85518Srobert
867*12c85518Srobert- Finished implementing C++ DR2565, which results in a requirement becoming
868*12c85518Srobert  not satisfied in the event of an instantiation failures in a requires expression's
869*12c85518Srobert  parameter list. We previously handled this correctly in a constraint evaluation
870*12c85518Srobert  context, but not in a requires clause evaluated as a boolean.
871*12c85518Srobert
872*12c85518SrobertConsteval Specific Fixes:
873*12c85518Srobert
874*12c85518Srobert- Fix a crash when generating code coverage information for an
875*12c85518Srobert  ``if consteval`` statement.
876*12c85518Srobert  (`#57377 <https://github.com/llvm/llvm-project/issues/57377>`_)
877*12c85518Srobert
878*12c85518Srobert- Fixed a crash-on-valid with consteval evaluation of a list-initialized
879*12c85518Srobert  constructor for a temporary object.
880*12c85518Srobert  (`#55871 <https://github.com/llvm/llvm-project/issues/55871>`_)
881*12c85518Srobert
882*12c85518Srobert- Fixes an assert crash caused by looking up missing vtable information on ``consteval``
883*12c85518Srobert  virtual functions. (`#55065 <https://github.com/llvm/llvm-project/issues/55065>`_)
884*12c85518Srobert
885*12c85518SrobertBug Fixes to AST Handling
886*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^^^
887*12c85518Srobert- A SubstTemplateTypeParmType can now represent the pack index for a
888*12c85518Srobert  substitution from an expanded pack.
889*12c85518Srobert  (`#56099 <https://github.com/llvm/llvm-project/issues/56099>`_)
890*12c85518Srobert
891*12c85518Srobert- The template arguments of a variable template being accessed as a
892*12c85518Srobert  member will now be represented in the AST.
893*12c85518Srobert
894*12c85518SrobertMiscellaneous Bug Fixes
895*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^
896*12c85518Srobert- Clang configuration files are now read through the virtual file system
897*12c85518Srobert  rather than the physical one, if these are different.
898*12c85518Srobert
899*12c85518Srobert- Fix an issue where -frewrite-includes generated line control directives with
900*12c85518Srobert  incorrect line numbers in some cases when a header file used an end of line
901*12c85518Srobert  character sequence that differed from the primary source file.
902*12c85518Srobert  (`#59736 <https://github.com/llvm/llvm-project/issues/59736>`_)
903*12c85518Srobert
904*12c85518Srobert- Clang 14 predeclared some builtin POSIX library functions in ``gnu2x`` mode,
905*12c85518Srobert  and Clang 15 accidentally stopped predeclaring those functions in that
906*12c85518Srobert  language mode. Clang 16 now predeclares those functions again.
907*12c85518Srobert  (`#56607 <https://github.com/llvm/llvm-project/issues/56607>`_)
908*12c85518Srobert
909*12c85518Srobert- Fix the bug of inserting the ``ZeroInitializationFixit`` before the template
910*12c85518Srobert  argument list of ``VarTemplateSpecializationDecl``.
911*12c85518Srobert- Fix the bug where Clang emits constrained float intrinsics when specifying
912*12c85518Srobert  ``-ffp-model=strict -ffp-model=fast``.
913*12c85518Srobert
914*12c85518SrobertMiscellaneous Clang Crashes Fixed
915*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
916*12c85518Srobert- Fix a crash when evaluating a multi-dimensional array's array filler
917*12c85518Srobert  expression is element-dependent.
918*12c85518Srobert  (`#50601 <https://github.com/llvm/llvm-project/issues/56016>`_)
919*12c85518Srobert
920*12c85518Srobert- Fix an assert that triggers a crash during template name lookup when a type is
921*12c85518Srobert  incomplete but was not also a TagType.
922*12c85518Srobert  (`#57387 <https://github.com/llvm/llvm-project/issues/57387>`_)
923*12c85518Srobert
924*12c85518Srobert- Fix a crash when attempting to default a virtual constexpr non-special member
925*12c85518Srobert  function in a derived class.
926*12c85518Srobert  (`#57431 <https://github.com/llvm/llvm-project/issues/57431>`_)
927*12c85518Srobert
928*12c85518Srobert- Fix ``-Wpre-c++17-compat`` crashing Clang when compiling C++20 code which
929*12c85518Srobert  contains deduced template specializations.
930*12c85518Srobert  (`#57369 <https://github.com/llvm/llvm-project/issues/57369>`_,
931*12c85518Srobert  `#57643 <https://github.com/llvm/llvm-project/issues/57643>`_,
932*12c85518Srobert  `#57793 <https://github.com/llvm/llvm-project/issues/57793>`_)
933*12c85518Srobert
934*12c85518Srobert- Fix a crash upon stray coloncolon token in C2x mode.
935*12c85518Srobert
936*12c85518Srobert- Fix assert that triggers a crash during some types of list initialization that
937*12c85518Srobert  generate a CXXTemporaryObjectExpr instead of a InitListExpr.
938*12c85518Srobert  (`#58302 <https://github.com/llvm/llvm-project/issues/58302>`_,
939*12c85518Srobert  `#58753 <https://github.com/llvm/llvm-project/issues/58753>`_,
940*12c85518Srobert  `#59100 <https://github.com/llvm/llvm-project/issues/59100>`_)
941*12c85518Srobert
942*12c85518Srobert- Fix a crash where we attempt to define a deleted destructor.
943*12c85518Srobert  (`#57516 <https://github.com/llvm/llvm-project/issues/57516>`_)
944*12c85518Srobert
945*12c85518Srobert- Fix an issue that triggers a crash if we instantiate a hidden friend functions.
946*12c85518Srobert  (`#54457 <https://github.com/llvm/llvm-project/issues/54457>`_)
947*12c85518Srobert
948*12c85518Srobert- Fix an issue that makes Clang crash on lambda template parameters.
949*12c85518Srobert  (`#57960 <https://github.com/llvm/llvm-project/issues/57960>`_)
950*12c85518Srobert
951*12c85518Srobert- Fixed a crash in C++20 mode in Clang and Clangd when compile source
952*12c85518Srobert  with compilation errors.
953*12c85518Srobert  (`#53628 <https://github.com/llvm/llvm-project/issues/53628>`_)
954*12c85518Srobert
955*12c85518Srobert- Fix sanity check when value initializing an empty union so that it takes into
956*12c85518Srobert  account anonymous structs which is a GNU extension.
957*12c85518Srobert  (`#58800 <https://github.com/llvm/llvm-project/issues/58800>`_)
958e5dd7070Spatrick
959e5dd7070Spatrick
960*12c85518SrobertTarget Specific Changes
961e5dd7070Spatrick-----------------------
962e5dd7070Spatrick
963*12c85518SrobertX86 Support
964*12c85518Srobert^^^^^^^^^^^
965*12c85518Srobert- Support ``-mindirect-branch-cs-prefix`` for call and jmp to indirect thunk.
966*12c85518Srobert- Fix 32-bit ``__fastcall`` and ``__vectorcall`` ABI mismatch with MSVC.
967*12c85518Srobert- Add ISA of ``AMX-FP16`` which support ``_tile_dpfp16ps``.
968*12c85518Srobert- Switch ``AVX512-BF16`` intrinsics types from ``short`` to ``__bf16``.
969*12c85518Srobert- Add support for ``PREFETCHI`` instructions.
970*12c85518Srobert- Support ISA of ``CMPCCXADD``.
971*12c85518Srobert  * Support intrinsic of ``_cmpccxadd_epi32``.
972*12c85518Srobert  * Support intrinsic of ``_cmpccxadd_epi64``.
973*12c85518Srobert- Add support for ``RAO-INT`` instructions.
974*12c85518Srobert  * Support intrinsic of ``_aadd_i32/64``
975*12c85518Srobert  * Support intrinsic of ``_aand_i32/64``
976*12c85518Srobert  * Support intrinsic of ``_aor_i32/64``
977*12c85518Srobert  * Support intrinsic of ``_axor_i32/64``
978*12c85518Srobert- Support ISA of ``AVX-IFMA``.
979*12c85518Srobert  * Support intrinsic of ``_mm(256)_madd52hi_avx_epu64``.
980*12c85518Srobert  * Support intrinsic of ``_mm(256)_madd52lo_avx_epu64``.
981*12c85518Srobert- Support ISA of ``AVX-VNNI-INT8``.
982*12c85518Srobert  * Support intrinsic of ``_mm(256)_dpbssd(s)_epi32``.
983*12c85518Srobert  * Support intrinsic of ``_mm(256)_dpbsud(s)_epi32``.
984*12c85518Srobert  * Support intrinsic of ``_mm(256)_dpbuud(s)_epi32``.
985*12c85518Srobert- Support ISA of ``AVX-NE-CONVERT``.
986*12c85518Srobert  * Support intrinsic of ``_mm(256)_bcstnebf16_ps``.
987*12c85518Srobert  * Support intrinsic of ``_mm(256)_bcstnesh_ps``.
988*12c85518Srobert  * Support intrinsic of ``_mm(256)_cvtneebf16_ps``.
989*12c85518Srobert  * Support intrinsic of ``_mm(256)_cvtneeph_ps``.
990*12c85518Srobert  * Support intrinsic of ``_mm(256)_cvtneobf16_ps``.
991*12c85518Srobert  * Support intrinsic of ``_mm(256)_cvtneoph_ps``.
992*12c85518Srobert  * Support intrinsic of ``_mm(256)_cvtneps_avx_pbh``.
993*12c85518Srobert- ``-march=raptorlake``, ``-march=meteorlake`` and ``-march=emeraldrapids`` are now supported.
994*12c85518Srobert- ``-march=sierraforest``, ``-march=graniterapids`` and ``-march=grandridge`` are now supported.
995*12c85518Srobert- Lift _BitInt() supported max width from 128 to 8388608.
996*12c85518Srobert- Support intrinsics of ``_mm(256)_reduce_(add|mul|or|and)_epi8/16``.
997*12c85518Srobert- Support intrinsics of ``_mm(256)_reduce_(max|min)_ep[i|u]8/16``.
998e5dd7070Spatrick
999*12c85518SrobertArm and AArch64 Support
1000*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^
1001*12c85518Srobert- The target(..) function attributes for AArch64 now accept:
1002*12c85518Srobert  * ``"arch=<arch>"`` strings, that specify the architecture for a function as per the ``-march`` option.
1003*12c85518Srobert  * ``"cpu=<cpu>"`` strings, that specify the cpu for a function as per the ``-mcpu`` option.
1004*12c85518Srobert  * ``"tune=<cpu>"`` strings, that specify the tune cpu for a function as per ``-mtune``.
1005*12c85518Srobert  * ``"+<feature>"``, ``"+no<feature>"`` enables/disables the specific feature, for compatibility with GCC target attributes.
1006*12c85518Srobert  * ``"<feature>"``, ``"no-<feature>"`` enabled/disables the specific feature, for backward compatibility with previous releases.
1007*12c85518Srobert- ``-march`` values for targeting armv2, armv2A, armv3 and armv3M have been removed.
1008*12c85518Srobert  Their presence gave the impression that Clang can correctly generate code for
1009*12c85518Srobert  them, which it cannot.
1010*12c85518Srobert- Support has been added for the following processors (-mcpu identifiers in parenthesis):
1011*12c85518Srobert  * Arm Cortex-A715 (cortex-a715).
1012*12c85518Srobert  * Arm Cortex-X3 (cortex-x3).
1013*12c85518Srobert  * Arm Neoverse V2 (neoverse-v2)
1014*12c85518Srobert- Strict floating point has been enabled for AArch64, which means that
1015*12c85518Srobert  ``-ftrapping-math``, ``-frounding-math``, ``-ffp-model=strict``, and
1016*12c85518Srobert  ``-ffp-exception-behaviour=<arg>`` are now accepted.
1017e5dd7070Spatrick
1018*12c85518SrobertWindows Support
1019*12c85518Srobert^^^^^^^^^^^^^^^
1020*12c85518Srobert- For the MinGW driver, added the options ``-mguard=none``, ``-mguard=cf`` and
1021*12c85518Srobert  ``-mguard=cf-nochecks`` (equivalent to ``/guard:cf-``, ``/guard:cf`` and
1022*12c85518Srobert  ``/guard:cf,nochecks`` in clang-cl) for enabling Control Flow Guard checks
1023*12c85518Srobert  and generation of address-taken function table.
1024*12c85518Srobert- Switched from SHA1 to BLAKE3 for PDB type hashing / ``-gcodeview-ghash``
1025*12c85518Srobert- Fixed code generation with emulated TLS, when the emulated TLS is enabled
1026*12c85518Srobert  by default (with downstream patches; no upstream configurations default
1027*12c85518Srobert  to this configuration, but some mingw downstreams change the default
1028*12c85518Srobert  in this way).
1029*12c85518Srobert- Improved detection of MinGW cross sysroots for finding sysroots provided
1030*12c85518Srobert  by Linux distributions such as Fedora. Also improved such setups by
1031*12c85518Srobert  avoiding to include ``/usr/include`` among the include paths when cross
1032*12c85518Srobert  compiling with a cross sysroot based in ``/usr``.
1033*12c85518Srobert- Fix incorrect alignment attribute on the this parameter of certain
1034*12c85518Srobert  non-complete destructors when using the Microsoft ABI.
1035*12c85518Srobert  `Issue 60465 <https://github.com/llvm/llvm-project/issues/60465>`_.
1036e5dd7070Spatrick
1037*12c85518SrobertLoongArch Support
1038*12c85518Srobert^^^^^^^^^^^^^^^^^
1039*12c85518Srobert- Clang now supports LoongArch. Along with the backend, clang is able to build a
1040*12c85518Srobert  large corpus of Linux applications. Test-suite 100% pass.
1041*12c85518Srobert- Support basic option ``-march=`` which is used to select the target
1042*12c85518Srobert  architecture, i.e. the basic set of ISA modules to be enabled. Possible values
1043*12c85518Srobert  are ``loongarch64`` and ``la464``.
1044*12c85518Srobert- Support basic option ``-mabi=`` which is used to select the base ABI type.
1045*12c85518Srobert  Possible values are ``lp64d``, ``lp64f``, ``lp64s``, ``ilp32d``, ``ilp32f``
1046*12c85518Srobert  and ``ilp32s``.
1047*12c85518Srobert- Support extended options: ``-msoft-float``, ``-msingle-float``, ``-mdouble-float`` and ``mfpu=``.
1048*12c85518Srobert  See `LoongArch toolchain conventions <https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html>`_.
1049ec727ea7Spatrick
1050*12c85518SrobertRISC-V Support
1051*12c85518Srobert^^^^^^^^^^^^^^
1052*12c85518Srobert- ``sifive-7-rv32`` and ``sifive-7-rv64`` are no longer supported for ``-mcpu``.
1053*12c85518Srobert  Use ``sifive-e76``, ``sifive-s76``, or ``sifive-u74`` instead.
1054*12c85518Srobert- Native detections via ``-mcpu=native`` and ``-mtune=native`` are supported.
1055*12c85518Srobert- Fix interaction of ``-mcpu`` and ``-march``, RISC-V backend will take the
1056*12c85518Srobert  architecture extension union of ``-mcpu`` and ``-march`` before, and now will
1057*12c85518Srobert  take architecture extensions from ``-march`` if both are given.
1058*12c85518Srobert- An ABI mismatch between GCC and Clang that related to the
1059*12c85518Srobert  sign/zero-extension of integer scalars was fixed.
1060*12c85518Srobert- An overall simplification of the RISC-V Vector intrinsics are done. The
1061*12c85518Srobert  simplification is based on
1062*12c85518Srobert  `riscv-non-isa/rvv-intrinsic-doc#186 <https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/186>`_.
1063*12c85518Srobert- Intrinsics of `vcompress` and `vmerge` have been adjusted to have interfaces
1064*12c85518Srobert  be aligned among `vvm`, `vxm` intrinsics. The adjustment is base on
1065*12c85518Srobert  `riscv-non-isa/rvv-intrinsic-doc#185 <https://github.com/riscv- non-isa/rvv-intrinsic-doc/pull/185>`_.
1066*12c85518Srobert- All RISC-V Vector intrinsics now share a `__riscv_` prefix, based on the
1067*12c85518Srobert  naming convention defined by
1068*12c85518Srobert  `riscv-non-isa/riscv-c-api-doc#31 <https://github.com/riscv-non-isa/riscv-c-api-doc/pull/31>`_.
1069*12c85518Srobert- Note that the RISC-V Vector C intrinsics are still under development. The RVV
1070*12c85518Srobert  C Intrinsic Task Group is working towards a ratified v1.0.
1071*12c85518Srobert- The rvv-intrinsic-doc provides `compatible headers <https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/master/auto-generated/rvv-v0p10-compatible-headers>`_ for transition from the previous implemented version to the current (v0.11) version.
1072*12c85518Srobert- Clang now supports `v0.11 RVV intrinsics <https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/v0.11.x>`_.
1073ec727ea7Spatrick
1074*12c85518SrobertCUDA/HIP Language Changes in Clang
1075*12c85518Srobert^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1076*12c85518Srobert- Allow the use of ``__noinline__`` as a keyword (instead of ``__attribute__((noinline))``)
1077*12c85518Srobert  in lambda declarations.
1078ec727ea7Spatrick
1079*12c85518SrobertCUDA Support
1080*12c85518Srobert^^^^^^^^^^^^
1081*12c85518Srobert- Clang now supports CUDA SDK up to 11.8
1082*12c85518Srobert- Added support for targeting sm_{87,89,90} GPUs.
1083ec727ea7Spatrick
1084*12c85518SrobertAIX Support
1085*12c85518Srobert^^^^^^^^^^^
1086*12c85518Srobert* When using ``-shared``, the clang driver now invokes llvm-nm to create an
1087*12c85518Srobert  export list if the user doesn't specify one via linker flag or pass an
1088*12c85518Srobert  alternative export control option.
1089*12c85518Srobert* Driver work done for ``-pg`` to link with the right paths and files.
1090ec727ea7Spatrick
1091*12c85518Srobert- Improved support for `-bcdtors:mbr` and `-bcdtors:csect` linker flags
1092*12c85518Srobert  when linking with -fprofile-generate.
1093ec727ea7Spatrick
1094*12c85518Srobert- Enabled LTO support. Requires AIX 7.2 TL5 SP3 or newer, or AIX 7.3. LTO
1095*12c85518Srobert  support is implemented with the `libLTO.so` plugin. To specify a
1096*12c85518Srobert  different plugin, use the linker option `-bplugin:<path to plugin>`.
1097*12c85518Srobert  To pass options to the plugin, use the linker option `-bplugin_opt:<option>`.
1098ec727ea7Spatrick
1099*12c85518Srobert- ``-mcpu`` option's values are checked against a list of known CPUs. An error
1100*12c85518Srobert  is reported if the specified CPU model is not found.
1101e5dd7070Spatrick
1102*12c85518SrobertWebAssembly Support
1103*12c85518Srobert^^^^^^^^^^^^^^^^^^^
1104*12c85518Srobert- The -mcpu=generic configuration now enables sign-ext and mutable-globals. These
1105*12c85518Srobert  proposals are standardized and available in all major engines.
1106e5dd7070Spatrick
1107*12c85518SrobertDWARF Support in Clang
1108*12c85518Srobert----------------------
1109*12c85518SrobertPreviously when emitting DWARFv4 and tuning for GDB, Clang would use DWARF v2's
1110*12c85518Srobert``DW_AT_bit_offset`` and ``DW_AT_data_member_location``. Clang now uses DWARF v4's
1111*12c85518Srobert``DW_AT_data_bit_offset`` regardless of tuning.
1112e5dd7070Spatrick
1113*12c85518SrobertSupport for ``DW_AT_data_bit_offset`` was added in GDB 8.0. For earlier versions,
1114*12c85518Srobertyou can use the ``-gdwarf-3`` option to emit compatible DWARF.
1115e5dd7070Spatrick
1116*12c85518SrobertFloating Point Support in Clang
1117*12c85518Srobert-------------------------------
1118*12c85518Srobert- The driver option ``-menable-unsafe-fp-math`` has been removed. To enable
1119*12c85518Srobert  unsafe floating-point optimizations use ``-funsafe-math-optimizations`` or
1120*12c85518Srobert  ``-ffast-math`` instead.
1121*12c85518Srobert- Add ``__builtin_elementwise_sin`` and ``__builtin_elementwise_cos`` builtins for floating point types only.
1122a9ac8606Spatrick
1123a9ac8606SpatrickAST Matchers
1124a9ac8606Spatrick------------
1125*12c85518Srobert- Add ``isInAnoymousNamespace`` matcher to match declarations in an anonymous namespace.
1126e5dd7070Spatrick
1127e5dd7070Spatrickclang-format
1128e5dd7070Spatrick------------
1129*12c85518Srobert- Add ``RemoveSemicolon`` option for removing ``;`` after a non-empty function definition.
1130*12c85518Srobert- Add ``RequiresExpressionIndentation`` option for configuring the alignment of requires-expressions.
1131*12c85518Srobert  The default value of this option is ``OuterScope``, which differs in behavior from clang-format 15.
1132*12c85518Srobert  To match the default behavior of clang-format 15, use the ``Keyword`` value.
1133*12c85518Srobert- Add ``IntegerLiteralSeparator`` option for fixing integer literal separators
1134*12c85518Srobert  in C++, C#, Java, and JavaScript.
1135*12c85518Srobert- Add ``BreakAfterAttributes`` option for breaking after a group of C++11
1136*12c85518Srobert  attributes before a function declaration/definition name.
1137*12c85518Srobert- Add ``InsertNewlineAtEOF`` option for inserting a newline at EOF if missing.
1138*12c85518Srobert- Add ``LineEnding`` option to deprecate ``DeriveLineEnding`` and ``UseCRLF``.
1139ec727ea7Spatrick
1140a9ac8606Spatricklibclang
1141a9ac8606Spatrick--------
1142*12c85518Srobert- Introduced the new function ``clang_getUnqualifiedType``, which mimics
1143*12c85518Srobert  the behavior of ``QualType::getUnqualifiedType`` for ``CXType``.
1144*12c85518Srobert- Introduced the new function ``clang_getNonReferenceType``, which mimics
1145*12c85518Srobert  the behavior of ``QualType::getNonReferenceType`` for ``CXType``.
1146*12c85518Srobert- Introduced the new function ``clang_CXXMethod_isDeleted``, which queries
1147*12c85518Srobert  whether the method is declared ``= delete``.
1148*12c85518Srobert- Introduced the new function ``clang_CXXMethod_isCopyAssignmentOperator``,
1149*12c85518Srobert  which identifies whether a method cursor is a copy-assignment
1150*12c85518Srobert  operator.
1151*12c85518Srobert- Introduced the new function ``clang_CXXMethod_isMoveAssignmentOperator``,
1152*12c85518Srobert  which identifies whether a method cursor is a move-assignment
1153*12c85518Srobert  operator.
1154*12c85518Srobert- ``clang_Cursor_getNumTemplateArguments``, ``clang_Cursor_getTemplateArgumentKind``,
1155*12c85518Srobert  ``clang_Cursor_getTemplateArgumentType``, ``clang_Cursor_getTemplateArgumentValue`` and
1156*12c85518Srobert  ``clang_Cursor_getTemplateArgumentUnsignedValue`` now work on struct, class,
1157*12c85518Srobert  and partial template specialization cursors in addition to function cursors.
1158e5dd7070Spatrick
1159e5dd7070SpatrickStatic Analyzer
1160e5dd7070Spatrick---------------
1161*12c85518Srobert- Removed the deprecated ``-analyzer-store`` and
1162*12c85518Srobert  ``-analyzer-opt-analyze-nested-blocks`` analyzer flags.
1163*12c85518Srobert  ``scanbuild`` was also updated accordingly.
1164*12c85518Srobert  Passing these flags will result in a hard error.
1165e5dd7070Spatrick
1166*12c85518Srobert- Deprecate the ``consider-single-element-arrays-as-flexible-array-members``
1167*12c85518Srobert  analyzer-config option.
1168*12c85518Srobert  This option will be still accepted, but a warning will be displayed.
1169*12c85518Srobert  This option will be rejected, thus turned into a hard error starting with
1170*12c85518Srobert  ``clang-17``. Use ``-fstrict-flex-array=<N>`` instead if necessary.
1171e5dd7070Spatrick
1172*12c85518Srobert- Trailing array objects of structs with single elements will be considered
1173*12c85518Srobert  as flexible-array-members. Use ``-fstrict-flex-array=<N>`` to define
1174*12c85518Srobert  what should be considered as flexible-array-member if needed.
1175e5dd7070Spatrick
1176*12c85518Srobert.. _release-notes-sanitizers:
1177e5dd7070Spatrick
1178*12c85518SrobertSanitizers
1179*12c85518Srobert----------
1180*12c85518Srobert- ``-fsanitize-memory-param-retval`` is turned on by default. With
1181*12c85518Srobert  ``-fsanitize=memory``, passing uninitialized variables to functions and
1182*12c85518Srobert  returning uninitialized variables from functions is more aggressively
1183*12c85518Srobert  reported. ``-fno-sanitize-memory-param-retval`` restores the previous
1184*12c85518Srobert  behavior.
1185e5dd7070Spatrick
1186e5dd7070SpatrickAdditional Information
1187e5dd7070Spatrick======================
1188e5dd7070Spatrick
1189e5dd7070SpatrickA wide variety of additional information is available on the `Clang web
1190e5dd7070Spatrickpage <https://clang.llvm.org/>`_. The web page contains versions of the
1191e5dd7070SpatrickAPI documentation which are up-to-date with the Git version of
1192e5dd7070Spatrickthe source code. You can access versions of these documents specific to
1193e5dd7070Spatrickthis release by going into the "``clang/docs/``" directory in the Clang
1194e5dd7070Spatricktree.
1195e5dd7070Spatrick
1196e5dd7070SpatrickIf you have any questions or comments about Clang, please feel free to
1197*12c85518Srobertcontact us on the `Discourse forums (Clang Frontend category)
1198*12c85518Srobert<https://discourse.llvm.org/c/clang/6>`_.
1199