88844ad9b4c55663f2196b0f40c1f9e2f046ba71
[platform/upstream/llvm.git] / clang / docs / ReleaseNotes.rst
1 ===========================================
2 Clang |release| |ReleaseNotesTitle|
3 ===========================================
4
5 .. contents::
6    :local:
7    :depth: 2
8
9 Written by the `LLVM Team <https://llvm.org/>`_
10
11 .. only:: PreRelease
12
13   .. warning::
14      These are in-progress notes for the upcoming Clang |version| release.
15      Release notes for previous releases can be found on
16      `the Releases Page <https://llvm.org/releases/>`_.
17
18 Introduction
19 ============
20
21 This document contains the release notes for the Clang C/C++/Objective-C
22 frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
23 describe the status of Clang in some detail, including major
24 improvements from the previous release and new feature work. For the
25 general LLVM release notes, see `the LLVM
26 documentation <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ release notes,
27 see `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases
28 may be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
29
30 For more information about Clang or LLVM, including information about the
31 latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
32 `LLVM Web Site <https://llvm.org>`_.
33
34 Potentially Breaking Changes
35 ============================
36 These changes are ones which we think may surprise users when upgrading to
37 Clang |release| because of the opportunity they pose for disruption to existing
38 code bases.
39
40
41 C/C++ Language Potentially Breaking Changes
42 -------------------------------------------
43 - Indirect edges of asm goto statements under certain circumstances may now be
44   split. In previous releases of clang, that means for the following code the
45   two inputs may have compared equal in the inline assembly.  This is no longer
46   guaranteed (and necessary to support outputs along indirect edges, which is
47   now supported as of this release). This change is more consistent with the
48   behavior of GCC.
49
50   .. code-block:: c
51
52     foo: asm goto ("# %0 %1"::"i"(&&foo)::foo);
53
54 - ``__builtin_object_size`` and ``__builtin_dynamic_object_size`` now add the
55   ``sizeof`` the elements specified in designated initializers of flexible
56   array members for structs that contain them. This change is more consistent
57   with the behavior of GCC.
58
59 C++ Specific Potentially Breaking Changes
60 -----------------------------------------
61 - Clang won't search for coroutine_traits in std::experimental namespace any more.
62   Clang will only search for std::coroutine_traits for coroutines then.
63 - Clang no longer allows dereferencing of a ``void *`` as an extension. Clang 16
64   converted this to a default-error as ``-Wvoid-ptr-dereference``, as well as a
65   SFINAE error. This flag is still valid however, as it disables the equivalent
66   warning in C.
67
68 ABI Changes in This Version
69 ---------------------------
70 - A bug in evaluating the ineligibility of some special member functions has been fixed. This can
71   make some classes trivially copyable that were not trivially copyable before. (`#62555 <https://github.com/llvm/llvm-project/issues/62555>`_)
72
73 What's New in Clang |release|?
74 ==============================
75 Some of the major new features and improvements to Clang are listed
76 here. Generic improvements to Clang as a whole or to its underlying
77 infrastructure are described first, followed by language-specific
78 sections with improvements to Clang's support for those languages.
79
80 C++ Language Changes
81 --------------------
82 - Improved ``-O0`` code generation for calls to ``std::forward_like``. Similarly to
83   ``std::move, std::forward`` et al. it is now treated as a compiler builtin and implemented
84   directly rather than instantiating the definition from the standard library.
85 - Implemented `CWG2518 <https://wg21.link/CWG2518>`_ which allows ``static_assert(false)``
86   to not be ill-formed when its condition is evaluated in the context of a template definition.
87 - Declaring namespace std to be an inline namespace is now prohibited, `[namespace.std]p7`.
88 - Improved code generation for ``dynamic_cast`` to a ``final`` type. Instead of
89   dispatching to the runtime library to compare the RTTI data, Clang now
90   generates a direct comparison of the vtable pointer in cases where the ABI
91   requires the vtable for a class to be unique. This optimization can be
92   disabled with ``-fno-assume-unique-vtables``. This optimization is not yet
93   implemented for the MS C++ ABI.
94
95 C++20 Feature Support
96 ^^^^^^^^^^^^^^^^^^^^^
97 - Implemented the rule introduced by `CA104 <https://wg21.link/P2103R0>`_  for comparison of
98   constraint-expressions. Improved support for out-of-line definitions of constrained templates.
99   This fixes:
100   `#49620 <https://github.com/llvm/llvm-project/issues/49620>`_,
101   `#60231 <https://github.com/llvm/llvm-project/issues/60231>`_,
102   `#61414 <https://github.com/llvm/llvm-project/issues/61414>`_,
103   `#61809 <https://github.com/llvm/llvm-project/issues/61809>`_.
104 - Lambda templates with a requires clause directly after the template parameters now parse
105   correctly if the requires clause consists of a variable with a dependent type.
106   (`#61278 <https://github.com/llvm/llvm-project/issues/61278>`_)
107 - Announced C++20 Coroutines is fully supported on all targets except Windows, which
108   still has some stability and ABI issues.
109 - Downgraded use of a reserved identifier in a module export declaration from
110   an error to a warning under the ``-Wreserved-module-identifier`` warning
111   group. This warning is enabled by default. This addresses `#61446
112   <https://github.com/llvm/llvm-project/issues/61446>`_ and allows easier
113   building of standard modules. This diagnostic may be strengthened into an
114   error again in the future once there is a less fragile way to mark a module
115   as being part of the implementation rather than a user module.
116 - Clang now implements `[temp.deduct]p9`. Substitution failures inside lambdas from
117   unevaluated contexts will be surfaced as errors. They were previously handled as
118   SFINAE.
119 - Clang now supports `requires cplusplus20` for module maps.
120 - Implemented missing parts of `P2002R1: Consistent comparison operators <https://wg21.link/P2002R1>`_
121 - Clang now defines `__cpp_consteval` macro.
122 - Implemented `P1816R0: <https://wg21.link/p1816r0>`_ and `P2082R1: <https://wg21.link/p2082r1>`_,
123   which allows CTAD for aggregates.
124
125 C++23 Feature Support
126 ^^^^^^^^^^^^^^^^^^^^^
127
128 - Implemented `P2036R3: Change scope of lambda trailing-return-type <https://wg21.link/P2036R3>`_
129   and `P2579R0 Mitigation strategies for P2036 <https://wg21.link/P2579R0>`_.
130   These proposals modify how variables captured in lambdas can appear in trailing return type
131   expressions and how their types are deduced therein, in all C++ language versions.
132 - Implemented partial support for `P2448R2: Relaxing some constexpr restrictions <https://wg21.link/p2448r2>`_
133   Explicitly defaulted functions no longer have to be constexpr-compatible but merely constexpr suitable.
134   We do not support outside of defaulted special memeber functions the change that constexpr functions no
135   longer have to be constexpr compatible but rather support a less restricted requirements for constexpr
136   functions. Which include allowing non-literal types as return values and parameters, allow calling of
137   non-constexpr functions and constructors.
138 - Clang now supports `requires cplusplus23` for module maps.
139 - Implemented `P2564R3: consteval needs to propagate up <https://wg21.link/P2564R3>`_.
140
141 C++2c Feature Support
142 ^^^^^^^^^^^^^^^^^^^^^
143 - Compiler flags ``-std=c++2c`` and ``-std=gnu++2c`` have been added for experimental C++2c implementation work.
144 - Implemented `P2738R1: constexpr cast from void* <https://wg21.link/P2738R1>`_.
145 - Partially implemented `P2361R6: Unevaluated strings <https://wg21.link/P2361R6>`_.
146   The changes to attributes declarations are not part of this release.
147 - Implemented `P2741R3: user-generated static_assert messages  <https://wg21.link/P2741R3>`_.
148
149 Resolutions to C++ Defect Reports
150 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151 - Implemented `DR2397 <https://wg21.link/CWG2397>`_ which allows ``auto`` specifier for pointers
152   and reference to arrays.
153 - Implemented `CWG2521 <https://wg21.link/CWG2521>`_ which reserves using ``__`` in user-defined
154   literal suffixes and deprecates literal operator function declarations using an identifier.
155   Taught ``-Wuser-defined-literals`` for the former, on by default, and added
156   ``-Wdeprecated-literal-operator`` for the latter, off by default for now.
157
158   .. code-block:: c++
159
160     // What follows is warned by -Wuser-defined-literals
161     // albeit "ill-formed, no diagnostic required".
162     // Its behavior is undefined, [reserved.names.general]p2.
163     string operator ""__i18n(const char*, std::size_t);
164
165     // Assume this declaration is not in the global namespace.
166     // -Wdeprecated-literal-operator diagnoses the extra space.
167     string operator "" _i18n(const char*, std::size_t);
168     //                ^ an extra space
169
170 C Language Changes
171 ------------------
172 - Support for outputs from asm goto statements along indirect edges has been
173   added. (`#53562 <https://github.com/llvm/llvm-project/issues/53562>`_)
174 - Fixed a bug that prevented initialization of an ``_Atomic``-qualified pointer
175   from a null pointer constant.
176 - Fixed a bug that prevented casting to an ``_Atomic``-qualified type.
177   (`#39596 <https://github.com/llvm/llvm-project/issues/39596>`_)
178 - Added an extension to ``_Generic`` which allows the first operand to be a
179   type rather than an expression. The type does not undergo any conversions,
180   which makes this feature suitable for matching qualified types, incomplete
181   types, and function or array types.
182
183   .. code-block:: c
184
185     const int i = 12;
186     _Generic(i, int : 0, const int : 1); // Warns about unreachable code, the
187                                          // result is 0, not 1.
188     _Generic(typeof(i), int : 0, const int : 1); // Result is 1, not 0.
189 - ``structs``, ``unions``, and ``arrays`` that are const may now be used as
190   constant expressions.  This change is more consistent with the behavior of
191   GCC.
192
193 C2x Feature Support
194 ^^^^^^^^^^^^^^^^^^^
195 - Implemented the ``unreachable`` macro in freestanding ``<stddef.h>`` for
196   `WG14 N2826 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2826.pdf>`_
197
198 - Removed the ``ATOMIC_VAR_INIT`` macro in C2x and later standards modes, which
199   implements `WG14 N2886 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2886.htm>`_
200
201 - Implemented `WG14 N2934 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2934.pdf>`_
202   which introduces the ``bool``, ``static_assert``, ``alignas``, ``alignof``,
203   and ``thread_local`` keywords in C2x.
204
205 - Implemented `WG14 N2900 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2900.htm>`_
206   and `WG14 N3011 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3011.htm>`_
207   which allows for empty braced initialization in C.
208
209   .. code-block:: c
210
211     struct S { int x, y } s = {}; // Initializes s.x and s.y to 0
212
213   As part of this change, the ``-Wgnu-empty-initializer`` warning group was
214   removed, as this is no longer a GNU extension but a C2x extension. You can
215   use ``-Wno-c2x-extensions`` to silence the extension warning instead.
216
217 - Updated the implementation of
218   `WG14 N3042 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3042.htm>`_
219   based on decisions reached during the WG14 CD Ballot Resolution meetings held
220   in Jan and Feb 2023. This should complete the implementation of ``nullptr``
221   and ``nullptr_t`` in C. The specific changes are:
222
223   .. code-block:: c
224
225     void func(nullptr_t);
226     func(0); // Previously required to be rejected, is now accepted.
227     func((void *)0); // Previously required to be rejected, is now accepted.
228
229     nullptr_t val;
230     val = 0; // Previously required to be rejected, is now accepted.
231     val = (void *)0; // Previously required to be rejected, is now accepted.
232
233     bool b = nullptr; // Was incorrectly rejected by Clang, is now accepted.
234
235 - Implemented `WG14 N3124 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3124.pdf>_`,
236   which allows any universal character name to appear in character and string literals.
237
238
239 Non-comprehensive list of changes in this release
240 -------------------------------------------------
241 - Clang now saves the address of ABI-indirect function parameters on the stack,
242   improving the debug information available in programs compiled without
243   optimizations.
244 - Clang now supports ``__builtin_nondeterministic_value`` that returns a
245   nondeterministic value of the same type as the provided argument.
246 - Clang now supports ``__builtin_FILE_NAME()`` which returns the same
247   information as the ``__FILE_NAME__`` macro (the presumed file name
248   from the invocation point, with no path components included).
249 - Clang now supports ``__builtin_assume_separate_storage`` that indicates that
250   its arguments point to objects in separate storage allocations.
251 - Clang now supports expressions in ``#pragma clang __debug dump``.
252 - Clang now supports declaration of multi-dimensional arrays with
253   ``__declspec(property)``.
254 - A new builtin type trait ``__is_trivially_equality_comparable`` has been added,
255   which checks whether comparing two instances of a type is equivalent to
256   ``memcmp(&lhs, &rhs, sizeof(T)) == 0``.
257 - Clang now ignores null directives outside of the include guard when deciding
258   whether a file can be enabled for the multiple-include optimization.
259 - Clang now support ``__builtin_FUNCSIG()`` which returns the same information
260   as the ``__FUNCSIG__`` macro (available only with ``-fms-extensions`` flag).
261   This fixes (`#58951 <https://github.com/llvm/llvm-project/issues/58951>`_).
262 - Clang now supports the `NO_COLOR <https://no-color.org/>`_ environment
263   variable as a way to disable color diagnostics.
264 - Clang now supports ``__builtin_isfpclass``, which checks if the specified
265   floating-point value falls into any of the specified data classes.
266 - Added ``__builtin_elementwise_round`` for  builtin for floating
267   point types. This allows access to ``llvm.round`` for
268   arbitrary floating-point and vector of floating-point types.
269 - Added ``__builtin_elementwise_rint`` for floating point types. This
270   allows access to ``llvm.rint`` for arbitrary floating-point and
271   vector of floating-point types.
272 - Added ``__builtin_elementwise_nearbyint`` for floating point
273   types. This allows access to ``llvm.nearbyint`` for arbitrary
274   floating-point and vector of floating-point types.
275 - Clang AST matcher now matches concept declarations with `conceptDecl`.
276 - Clang now supports more GCC stdio builtins: ``__builtin_vprintf``, ``__builtin_vfprintf``,
277   ``__builtin_fscanf``, ``__builtin_scanf``, ``__builtin_sscanf``, ``__builtin_vfscanf``,
278   ``__builtin_vscanf``, ``__builtin_vsscanf``.
279
280
281 New Compiler Flags
282 ------------------
283 - The flag ``-std=c++23`` has been added. This behaves the same as the existing
284   flag ``-std=c++2b``.
285 - ``-dumpdir`` has been implemented to specify auxiliary and dump output
286   filenames for features like ``-gsplit-dwarf``.
287 - ``-fcaret-diagnostics-max-lines=`` has been added as a driver options, which
288   lets users control the maximum number of source lines printed for a
289   caret diagnostic.
290 - ``-fkeep-persistent-storage-variables`` has been implemented to keep all
291   variables that have a persistent storage duration—including global, static
292   and thread-local variables—to guarantee that they can be directly addressed.
293   Since this inhibits the merging of the affected variables, the number of
294   individual relocations in the program will generally increase.
295 - ``-f[no-]assume-unique-vtables`` controls whether Clang assumes that each
296   class has a unique vtable address, when that is required by the ABI.
297 - ``-print-multi-flags-experimental`` prints the flags used for multilib
298   selection. See `the multilib docs <https://clang.llvm.org/docs/Multilib.html>`_
299   for more details.
300 - ``-maix32`` and ``-maix64`` are new GCC compatibility flags that select the
301   bitmode to target on AIX.
302 - ``-p`` is a new GCC compatibility flag for AIX and Linux which works
303   similarly to ``-pg`` by writing profile information, but targets the ``prof``
304   tool as opposed to the ``gprof`` tool.
305
306 Deprecated Compiler Flags
307 -------------------------
308
309 - ``-fdouble-square-bracket-attributes`` has been deprecated. It is ignored now
310   and will be removed in Clang 18.
311
312 Modified Compiler Flags
313 -----------------------
314
315 - ``clang -g -gsplit-dwarf a.c -o obj/x`` (compile and link) now generates the
316   ``.dwo`` file at ``obj/x-a.dwo``, instead of a file in the temporary
317   directory (``/tmp`` on \*NIX systems, if none of the environment variables
318   TMPDIR, TMP, and TEMP are specified).
319
320 Removed Compiler Flags
321 -------------------------
322 - The deprecated flag `-fmodules-ts` is removed. Please use ``-std=c++20``
323   or higher to use standard C++ modules instead.
324 - The deprecated flag `-fcoroutines-ts` is removed. Please use ``-std=c++20``
325   or higher to use standard C++ coroutines instead.
326 - The CodeGen flag `-lower-global-dtors-via-cxa-atexit` which affects how global
327   destructors are lowered for MachO is removed without replacement. The default
328   of `-lower-global-dtors-via-cxa-atexit=true` is now the only supported way.
329 - The cc1 flag ``-no-opaque-pointers`` has been removed.
330
331 Attribute Changes in Clang
332 --------------------------
333 - Introduced a new function attribute ``__attribute__((unsafe_buffer_usage))``
334   to be worn by functions containing buffer operations that could cause out of
335   bounds memory accesses. It emits warnings at call sites to such functions when
336   the flag ``-Wunsafe-buffer-usage`` is enabled.
337 - ``__declspec`` attributes can now be used together with the using keyword. Before
338   the attributes on ``__declspec`` was ignored, while now it will be forwarded to the
339   point where the alias is used. Note, some incorrect uses of ``__declspec`` on a
340   ``using`` declaration were being silently ignored and will now be appropriately
341   diagnosed as ignoring the attribute.
342 - Introduced a new ``USR`` (unified symbol resolution) clause inside of the
343   existing ``__attribute__((external_source_symbol))`` attribute. Clang's indexer
344   uses the optional USR value when indexing Clang's AST. This value is expected
345   to be generated by an external compiler when generating C++ bindings during
346   the compilation of the foreign language sources (e.g. Swift).
347 - The ``__has_attribute``, ``__has_c_attribute`` and ``__has_cpp_attribute``
348   preprocessor operators now return 1 also for attributes defined by plugins.
349 - Improve the AST fidelity of ``alignas`` and ``_Alignas`` attribute. Before, we
350   model ``alignas(type-id)`` as though the user wrote ``alignas(alignof(type-id))``,
351   now we directly use ``alignas(type-id)``.
352
353 Improvements to Clang's diagnostics
354 -----------------------------------
355 - We now generate a diagnostic for signed integer overflow due to unary minus
356   in a non-constant expression context.
357   (`#31643 <https://github.com/llvm/llvm-project/issues/31643>`_)
358 - Clang now warns by default for C++20 and later about deprecated capture of
359   ``this`` with a capture default of ``=``. This warning can be disabled with
360   ``-Wno-deprecated-this-capture``.
361 - Clang had failed to emit some ``-Wundefined-internal`` for members of a local
362   class if that class was first introduced with a forward declaration.
363 - Diagnostic notes and fix-its are now generated for ``ifunc``/``alias`` attributes
364   which point to functions whose names are mangled.
365 - Diagnostics relating to macros on the command line of a preprocessed assembly
366   file or precompiled header are now reported as coming from the file
367   ``<command line>`` instead of ``<built-in>``.
368 - Clang constexpr evaluator now provides a more concise diagnostic when calling
369   function pointer that is known to be null.
370 - Clang now avoids duplicate warnings on unreachable ``[[fallthrough]];`` statements
371   previously issued from ``-Wunreachable-code`` and ``-Wunreachable-code-fallthrough``
372   by prioritizing ``-Wunreachable-code-fallthrough``.
373 - Clang now correctly diagnoses statement attributes ``[[clang::always_inline]]`` and
374   ``[[clang::noinline]]`` when used on a statement with dependent call expressions.
375 - Clang now checks for completeness of the second and third arguments in the
376   conditional operator.
377   (`#59718 <https://github.com/llvm/llvm-project/issues/59718>`_)
378 - There were some cases in which the diagnostic for the unavailable attribute
379   might not be issued, this fixes those cases.
380   (`61815 <https://github.com/llvm/llvm-project/issues/61815>`_)
381 - Clang now avoids unnecessary diagnostic warnings for obvious expressions in
382   the case of binary operators with logical OR operations.
383   (`#57906 <https://github.com/llvm/llvm-project/issues/57906>`_)
384 - Clang's "static assertion failed" diagnostic now points to the static assertion
385   expression instead of pointing to the ``static_assert`` token.
386   (`#61951 <https://github.com/llvm/llvm-project/issues/61951>`_)
387 - ``-Wformat`` now recognizes ``%lb`` for the ``printf``/``scanf`` family of
388   functions.
389   (`#62247: <https://github.com/llvm/llvm-project/issues/62247>`_).
390 - Clang now diagnoses shadowing of lambda's template parameter by a capture.
391   (`#61105: <https://github.com/llvm/llvm-project/issues/61105>`_).
392 - Address a false positive in ``-Wpacked`` when applied to a non-pod type using
393   Clang ABI >= 15.
394   (`#62353: <https://github.com/llvm/llvm-project/issues/62353>`_,
395   fallout from the non-POD packing ABI fix in LLVM 15).
396 - Clang constexpr evaluator now prints subobject's name instead of its type in notes
397   when a constexpr variable has uninitialized subobjects after its constructor call.
398   (`#58601 <https://github.com/llvm/llvm-project/issues/58601>`_)
399 - Clang's `-Wshadow` warning now warns about shadowings by static local variables
400   (`#62850: <https://github.com/llvm/llvm-project/issues/62850>`_).
401 - Clang now warns when any predefined macro is undefined or redefined, instead
402   of only some of them.
403 - Clang now correctly diagnoses when the argument to ``alignas`` or ``_Alignas``
404   is an incomplete type.
405   (`#55175: <https://github.com/llvm/llvm-project/issues/55175>`_, and fixes an
406   incorrect mention of ``alignof`` in a diagnostic about ``alignas``).
407 - Clang will now show a margin with line numbers to the left of each line
408   of code it prints for diagnostics. This can be disabled using
409   ``-fno-diagnostics-show-line-numbers``. At the same time, the maximum
410   number of code lines it prints has been increased from 1 to 16. This
411   can be controlled using ``-fcaret-diagnostics-max-lines=``.
412 - Clang no longer emits ``-Wunused-variable`` warnings for variables declared
413   with ``__attribute__((cleanup(...)))`` to match GCC's behavior.
414 - Clang now issues expected warnings for situations of comparing with NULL pointers.
415   (`#42992: <https://github.com/llvm/llvm-project/issues/42992>`_)
416 - Clang now diagnoses unused const-qualified variable template as
417   "unused variable template" rather than "unused variable".
418 - When diagnosing a constant expression where an enum without a fixed underlying
419   type is set to a value outside the range of the enum's values, clang will now
420   print the name of the enum in question.
421 - Clang no longer diagnoses a read of an empty structure as use of an
422   uninitialized variable.
423   (`#26842: <https://github.com/llvm/llvm-project/issues/26842>`_)
424 - The Fix-It emitted for unused labels used to expand to the next line, which caused
425   visual oddities now that Clang shows more than one line of code snippet. This has
426   been fixed and the Fix-It now only spans to the end of the ``:``.
427 - Clang now underlines the parameter list of function declaration when emitting
428   a note about the mismatch in the number of arguments.
429 - Clang now diagnoses unexpected tokens after a
430   ``#pragma clang|GCC diagnostic push|pop`` directive.
431   (`#13920: <https://github.com/llvm/llvm-project/issues/13920>`_)
432 - Clang now does not try to analyze cast validity on variables with dependent alignment (`#63007: <https://github.com/llvm/llvm-project/issues/63007>`_).
433 - Clang constexpr evaluator now displays member function calls more precisely
434   by making use of the syntactical structure of function calls. This avoids display
435   of syntactically invalid codes in diagnostics.
436   (`#57081: <https://github.com/llvm/llvm-project/issues/57081>`_)
437 - Clang no longer emits inappropriate notes about the loss of ``__unaligned`` qualifier
438   on overload resolution, when the actual reason for the failure is loss of other qualifiers.
439 - The note emitted when an ``operator==`` was defaulted as deleted used to refer to
440   the lack of a data member's "three-way comparison operator". It now refers correctly
441   to the data member's ``operator==``.
442   (`#63960: <https://github.com/llvm/llvm-project/issues/63960>`_)
443 - Clang's notes about unconvertible types in overload resolution failure now covers
444   the source range of parameter declaration of the candidate function declaration.
445
446   *Example Code*:
447
448   .. code-block:: c++
449
450      void func(int aa, int bb);
451      void test() { func(1, "two"); }
452
453   *BEFORE*:
454
455   .. code-block:: text
456
457     source:2:15: error: no matching function for call to 'func'
458     void test() { func(1, "two");  }
459                   ^~~~
460     source:1:6: note: candidate function not viable: no known conversion from 'const char[4]' to 'int' for 2nd argument
461     void func(int aa, int bb);
462          ^
463
464   *AFTER*:
465
466   .. code-block:: text
467
468     source:2:15: error: no matching function for call to 'func'
469     void test() { func(1, "two");  }
470                   ^~~~
471     source:1:6: note: candidate function not viable: no known conversion from 'const char[4]' to 'int' for 2nd argument
472     void func(int aa, int bb);
473          ^            ~~~~~~
474
475 - ``-Wformat`` cast fix-its will now suggest ``static_cast`` instead of C-style casts
476   for C++ code.
477 - ``-Wformat`` will no longer suggest a no-op fix-it for fixing scoped enum format
478   warnings. Instead, it will suggest casting the enum object based on its
479   underlying type.
480
481 Bug Fixes in This Version
482 -------------------------
483 - Fixed an issue where a class template specialization whose declaration is
484   instantiated in one module and whose definition is instantiated in another
485   module may end up with members associated with the wrong declaration of the
486   class, which can result in miscompiles in some cases.
487 - Added a new diagnostic warning group
488   ``-Wdeprecated-redundant-constexpr-static-def``, under the existing
489   ``-Wdeprecated`` group. This controls warnings about out-of-line definitions
490   of 'static constexpr' data members that are unnecessary from C++17 onwards.
491 - Fix segfault while running clang-rename on a non existing file.
492   (`#36471 <https://github.com/llvm/llvm-project/issues/36471>`_)
493 - Fix crash when diagnosing incorrect usage of ``_Nullable`` involving alias
494   templates.
495   (`#60344 <https://github.com/llvm/llvm-project/issues/60344>`_)
496 - Fix confusing warning message when ``/clang:-x`` is passed in ``clang-cl``
497   driver mode and emit an error which suggests using ``/TC`` or ``/TP``
498   ``clang-cl`` options instead.
499   (`#59307 <https://github.com/llvm/llvm-project/issues/59307>`_)
500 - Fix assert that fails when the expression causing the this pointer to be
501   captured by a block is part of a constexpr if statement's branch and
502   instantiation of the enclosing method causes the branch to be discarded.
503 - Fix __VA_OPT__ implementation so that it treats the concatenation of a
504   non-placemaker token and placemaker token as a non-placemaker token.
505   (`#60268 <https://github.com/llvm/llvm-project/issues/60268>`_)
506 - Fix crash when taking the address of a consteval lambda call operator.
507   (`#57682 <https://github.com/llvm/llvm-project/issues/57682>`_)
508 - Clang now support export declarations in the language linkage.
509   (`#60405 <https://github.com/llvm/llvm-project/issues/60405>`_)
510 - Fix aggregate initialization inside lambda constexpr.
511   (`#60936 <https://github.com/llvm/llvm-project/issues/60936>`_)
512 - No longer issue a false positive diagnostic about a catch handler that cannot
513   be reached despite being reachable. This fixes
514   `#61177 <https://github.com/llvm/llvm-project/issues/61177>`_ in anticipation
515   of `CWG2699 <https://wg21.link/CWG2699>_` being accepted by WG21.
516 - Fix crash when parsing fold expression containing a delayed typo correction.
517   (`#61326 <https://github.com/llvm/llvm-project/issues/61326>`_)
518 - Fix crash when dealing with some member accesses outside of class or member
519   function context.
520   (`#37792 <https://github.com/llvm/llvm-project/issues/37792>`_) and
521   (`#48405 <https://github.com/llvm/llvm-project/issues/48405>`_)
522 - Fix crash when using ``[[clang::always_inline]]`` or ``[[clang::noinline]]``
523   statement attributes on a call to a template function in the body of a
524   template function.
525 - Fix coroutines issue where ``get_return_object()`` result was always eagerly
526   converted to the return type. Eager initialization (allowing RVO) is now only
527   performed when these types match, otherwise deferred initialization is used,
528   enabling short-circuiting coroutines use cases. This fixes
529   (`#56532 <https://github.com/llvm/llvm-project/issues/56532>`_) in
530   anticipation of `CWG2563 <https://cplusplus.github.io/CWG/issues/2563.html>_`.
531 - Fix highlighting issue with ``_Complex`` and initialization list with more than
532   2 items. (`#61518 <https://github.com/llvm/llvm-project/issues/61518>`_)
533 - Fix  ``getSourceRange`` on  ``VarTemplateSpecializationDecl`` and
534   ``VarTemplatePartialSpecializationDecl``, which represents variable with
535   the initializer, so it behaves consistently with other ``VarDecls`` and ends
536   on the last token of initializer, instead of right angle bracket of
537   the template argument list.
538 - Fix false-positive diagnostic issued for consteval initializers of temporary
539   objects.
540   (`#60286 <https://github.com/llvm/llvm-project/issues/60286>`_)
541 - Correct restriction of trailing requirements clauses on a templated function.
542   Previously we only rejected non-'templated' things, but the restrictions ALSO need
543   to limit non-defined/non-member functions as well. Additionally, we now diagnose
544   requires on lambdas when not allowed, which we previously missed.
545   (`#61748 <https://github.com/llvm/llvm-project/issues/61748>`_)
546 - Fix confusing diagnostic for incorrect use of qualified concepts names.
547 - Fix handling of comments in function like macros so they are ignored in -CC
548   mode.
549   (`#60887 <https://github.com/llvm/llvm-project/issues/60887>`_)
550 - Fix incorrect merging of lambdas across modules.
551   (`#60985 <https://github.com/llvm/llvm-project/issues/60985>`_)
552 - Fix crash when handling nested immediate invocations in initializers of global
553   variables.
554   (`#58207 <https://github.com/llvm/llvm-project/issues/58207>`_)
555 - Fix crash when generating code coverage information for `PseudoObjectExpr` in
556   Clang AST.
557   (`#45481 <https://github.com/llvm/llvm-project/issues/45481>`_)
558 - Fix the assertion hit when a template consteval function appears in a nested
559   consteval/constexpr call chain.
560   (`#61142 <https://github.com/llvm/llvm-project/issues/61142>`_)
561 - Clang now better diagnose placeholder types constrained with a concept that is
562   not a type concept.
563 - Fix crash when a doc comment contains a line splicing.
564   (`#62054 <https://github.com/llvm/llvm-project/issues/62054>`_)
565 - Work around with a clang coverage crash which happens when visiting
566   expressions/statements with invalid source locations in non-assert builds.
567   Assert builds may still see assertions triggered from this.
568 - Fix a failed assertion due to an invalid source location when trying to form
569   a coverage report for an unresolved constructor expression.
570   (`#62105 <https://github.com/llvm/llvm-project/issues/62105>`_)
571 - Fix defaulted equality operator so that it does not attempt to compare unnamed
572   bit-fields. This fixes:
573   (`#61355 <https://github.com/llvm/llvm-project/issues/61335>`_) and
574   (`#61417 <https://github.com/llvm/llvm-project/issues/61417>`_)
575 - Fix crash after suggesting typo correction to constexpr if condition.
576   (`#61885 <https://github.com/llvm/llvm-project/issues/61885>`_)
577 - Clang constexpr evaluator now treats comparison of [[gnu::weak]]-attributed
578   member pointer as an invalid expression.
579 - Fix crash when member function contains invalid default argument.
580   (`#62122 <https://github.com/llvm/llvm-project/issues/62122>`_)
581 - Fix crash when handling undefined template partial specialization
582   (`#61356 <https://github.com/llvm/llvm-project/issues/61356>`_)
583 - Fix premature substitution into the constraints of an inherited constructor.
584 - Fix crash when attempting to perform parenthesized initialization of an
585   aggregate with a base class with only non-public constructors.
586   (`#62296 <https://github.com/llvm/llvm-project/issues/62296>`_)
587 - Fix crash when handling initialization candidates for invalid deduction guide.
588   (`#62408 <https://github.com/llvm/llvm-project/issues/62408>`_)
589 - Fix crash when redefining a variable with an invalid type again with an
590   invalid type. (`#62447 <https://github.com/llvm/llvm-project/issues/62447>`_)
591 - Fix a stack overflow issue when evaluating ``consteval`` default arguments.
592   (`#60082 <https://github.com/llvm/llvm-project/issues/60082>`_)
593 - Fix the assertion hit when generating code for global variable initializer of
594   _BitInt(1) type.
595   (`#62207 <https://github.com/llvm/llvm-project/issues/62207>`_)
596 - Fix lambdas and other anonymous function names not respecting ``-fdebug-prefix-map``
597   (`#62192 <https://github.com/llvm/llvm-project/issues/62192>`_)
598 - Fix crash when attempting to pass a non-pointer type as first argument of
599   ``__builtin_assume_aligned``.
600   (`#62305 <https://github.com/llvm/llvm-project/issues/62305>`_)
601 - A default argument for a non-type template parameter is evaluated and checked
602   at the point where it is required. This fixes:
603   (`#62224 <https://github.com/llvm/llvm-project/issues/62224>`_) and
604   (`#62596 <https://github.com/llvm/llvm-project/issues/62596>`_)
605 - Fix an assertion when instantiating the body of a Class Template Specialization
606   when it had been instantiated from a partial template specialization with different
607   template arguments on the containing class. This fixes:
608   (`#60778 <https://github.com/llvm/llvm-project/issues/60778>`_).
609 - Fix a crash when an enum constant has a dependent-type recovery expression for
610   C.
611   (`#62446 <https://github.com/llvm/llvm-project/issues/62446>`_).
612 - Propagate the value-dependent bit for VAArgExpr. Fixes a crash where a
613   __builtin_va_arg call has invalid arguments.
614   (`#62711 <https://github.com/llvm/llvm-project/issues/62711>`_).
615 - Fix crash on attempt to initialize union with flexible array member.
616   (`#61746 <https://github.com/llvm/llvm-project/issues/61746>`_).
617 - Clang `TextNodeDumper` enabled through `-ast-dump` flag no longer evaluates the
618   initializer of constexpr `VarDecl` if the declaration has a dependent type.
619 - Match GCC's behavior for ``__builtin_object_size`` and
620   ``__builtin_dynamic_object_size`` on structs containing flexible array
621   members.
622   (`#62789 <https://github.com/llvm/llvm-project/issues/62789>`_).
623 - Fix a crash when instantiating a non-type template argument in a dependent scope.
624   (`#62533 <https://github.com/llvm/llvm-project/issues/62533>`_).
625 - Fix crash when diagnosing default comparison method.
626   (`#62791 <https://github.com/llvm/llvm-project/issues/62791>`_) and
627   (`#62102 <https://github.com/llvm/llvm-project/issues/62102>`_).
628 - Fix crash when passing a braced initializer list to a parentehsized aggregate
629   initialization expression.
630   (`#63008 <https://github.com/llvm/llvm-project/issues/63008>`_).
631 - Reject increment of bool value in unevaluated contexts after C++17.
632   (`#47517 <https://github.com/llvm/llvm-project/issues/47517>`_).
633 - Fix assertion and quality of diagnostic messages in a for loop
634   containing multiple declarations and a range specifier
635   (`#63010 <https://github.com/llvm/llvm-project/issues/63010>`_).
636 - Fix rejects-valid when consteval operator appears inside of a template.
637   (`#62886 <https://github.com/llvm/llvm-project/issues/62886>`_).
638 - Fix crash for code using ``_Atomic`` types in C++
639   (`See patch <https://reviews.llvm.org/D152303>`_).
640 - Fix crash when passing a value larger then 64 bits to the aligned attribute.
641   (`#50534 <https://github.com/llvm/llvm-project/issues/50534>`_).
642 - CallExpr built for C error-recovery now is always type-dependent. Fixes a
643   crash when we encounter a unresolved TypoExpr during diagnostic emission.
644   (`#50244 <https://github.com/llvm/llvm-project/issues/50244>`_).
645 - Apply ``-fmacro-prefix-map`` to anonymous tags in template arguments
646   (`#63219 <https://github.com/llvm/llvm-project/issues/63219>`_).
647 - Clang now properly diagnoses format string mismatches involving scoped
648   enumeration types. A scoped enumeration type is not promoted to an integer
649   type by the default argument promotions, and thus this is UB. Clang's
650   behavior now matches GCC's behavior in C++.
651   (`#38717 <https://github.com/llvm/llvm-project/issues/38717>`_).
652 - Fixed a failing assertion when implicitly defining a function within a GNU
653   statement expression that appears outside of a function block scope. The
654   assertion was benign outside of asserts builds and would only fire in C.
655   (`#48579 <https://github.com/llvm/llvm-project/issues/48579>`_).
656 - Fixed a failing assertion when applying an attribute to an anonymous union.
657   The assertion was benign outside of asserts builds and would only fire in C++.
658   (`#48512 <https://github.com/llvm/llvm-project/issues/48512>`_).
659 - Fixed a failing assertion when parsing incomplete destructor.
660   (`#63503 <https://github.com/llvm/llvm-project/issues/63503>`_)
661 - Fix C++17 mode assert when parsing malformed code and the compiler is
662   attempting to see if it could be type template for class template argument
663   deduction. This fixes
664   (`Issue 57495 <https://github.com/llvm/llvm-project/issues/57495>`_)
665 - Fix missing destructor calls and therefore memory leaks in generated code
666   when an immediate invocation appears as a part of an expression that produces
667   temporaries.
668   (`#60709 <https://github.com/llvm/llvm-project/issues/60709>`_).
669 - Fixed a missed integer overflow warning with temporary values.
670   (`#63629 <https://github.com/llvm/llvm-project/issues/63629>`_)
671 - Fixed parsing of elaborated type specifier inside of a new expression.
672   (`#34341 <https://github.com/llvm/llvm-project/issues/34341>`_)
673 - Clang now correctly evaluates ``__has_extension (cxx_defaulted_functions)``
674   and ``__has_extension (cxx_default_function_template_args)`` to 1.
675   (`#61758 <https://github.com/llvm/llvm-project/issues/61758>`_)
676 - Stop evaluating a constant expression if the condition expression which in
677   switch statement contains errors.
678   (`#63453 <https://github.com/llvm/llvm-project/issues/63453>_`)
679 - Fixed false positive error diagnostic when pack expansion appears in template
680   parameters of a member expression.
681   (`#48731 <https://github.com/llvm/llvm-project/issues/48731>`_)
682 - Fix the contains-errors bit not being set for DeclRefExpr that refers to a
683   VarDecl with invalid initializer. This fixes:
684   (`#50236 <https://github.com/llvm/llvm-project/issues/50236>`_),
685   (`#50243 <https://github.com/llvm/llvm-project/issues/50243>`_),
686   (`#48636 <https://github.com/llvm/llvm-project/issues/48636>`_),
687   (`#50320 <https://github.com/llvm/llvm-project/issues/50320>`_).
688 - Fix an assertion when using ``\u0024`` (``$``) as an identifier, by disallowing
689   that construct (`#62133 <https://github.com/llvm/llvm-project/issues/38717>_`).
690 - Fix crash caused by PseudoObjectExprBitfields: NumSubExprs overflow.
691   (`#63169 <https://github.com/llvm/llvm-project/issues/63169>_`)
692 - Fix crash when casting an object to an array type.
693   (`#63758 <https://github.com/llvm/llvm-project/issues/63758>_`)
694 - Fixed false positive error diagnostic observed from mixing ``asm goto`` with
695   ``__attribute__((cleanup()))`` variables falsely warning that jumps to
696   non-targets would skip cleanup.
697 - Correcly diagnose jumps into statement expressions.
698   This ensures the behavior of Clang is consistent with GCC.
699   (`#63682 <https://github.com/llvm/llvm-project/issues/63682>`_)
700 - Invalidate BlockDecl with implicit return type, in case any of the return
701   value exprs is invalid. Propagating the error info up by replacing BlockExpr
702   with a RecoveryExpr. This fixes:
703   (`#63863 <https://github.com/llvm/llvm-project/issues/63863>_`)
704 - Invalidate BlockDecl with invalid ParmVarDecl. Remove redundant dump of
705   BlockDecl's ParmVarDecl
706   (`#64005 <https://github.com/llvm/llvm-project/issues/64005>_`)
707 - Fix crash on nested templated class with template function call.
708   (`#61159 <https://github.com/llvm/llvm-project/issues/61159>_`)
709 - Fix a hang on valid C code passing a function type as an argument to
710   ``typeof`` to form a function declaration.
711   (`#64713 <https://github.com/llvm/llvm-project/issues/64713>_`)
712 - Clang now correctly diagnoses ``function_needs_feature`` when always_inline
713   callee has incompatible target features with caller.
714 - Removed the linking of libraries when ``-r`` is passed to the driver on AIX.
715 - Fixed an Itanium ABI bug where we force exactly two-byte alignment on member
716   functions to reserve a bit in function pointers for identifying pointers to
717   virtual member functions even if the target required a greater function
718   alignment and/or did not have function pointers which point to function entry
719   points (i.e., uses function descriptor objects instead).
720 - Fixes a ``clang-17`` regression where ``LLVM_UNREACHABLE_OPTIMIZE=OFF``
721   cannot be used with ``Release`` mode builds. (`#68237 <https://github.com/llvm/llvm-project/issues/68237>`_).
722 - No longer use C++ ``thread_local`` semantics in C23 when using
723   ``thread_local`` instead of ``_Thread_local``.
724   Fixes (`#70068 <https://github.com/llvm/llvm-project/issues/70068>`_) and
725   (`#69167 <https://github.com/llvm/llvm-project/issues/69167>`_)
726
727 Bug Fixes to Compiler Builtins
728 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
729
730 Bug Fixes to Attribute Support
731 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
732 - Fixed a bug where attribute annotations on type specifiers (enums, classes,
733   structs, unions, and scoped enums) were not properly ignored, resulting in
734   misleading warning messages. Now, such attribute annotations are correctly
735   ignored. (`#61660 <https://github.com/llvm/llvm-project/issues/61660>`_)
736 - GNU attributes preceding C++ style attributes on templates were not properly
737   handled, resulting in compilation error. This has been corrected to match the
738   behavior exhibited by GCC, which permits mixed ordering of GNU and C++
739   attributes.
740
741 Bug Fixes to C++ Support
742 ^^^^^^^^^^^^^^^^^^^^^^^^
743
744 - Fix crash on invalid code when looking up a destructor in a templated class
745   inside a namespace.
746   (`#59446 <https://github.com/llvm/llvm-project/issues/59446>`_)
747 - Fix crash when evaluating consteval constructor of derived class whose base
748   has more than one field.
749   (`#60166 <https://github.com/llvm/llvm-project/issues/60166>`_)
750 - Fix an issue about ``decltype`` in the members of class templates derived from
751   templates with related parameters.
752   (`#58674 <https://github.com/llvm/llvm-project/issues/58674>`_)
753 - Fix incorrect deletion of the default constructor of unions in some
754   cases. (`#48416 <https://github.com/llvm/llvm-project/issues/48416>`_)
755 - No longer issue a pre-C++23 compatibility warning in ``-pedantic`` mode
756   regarding overloaded `operator[]` with more than one parameter or for static
757   lambdas. (`#61582 <https://github.com/llvm/llvm-project/issues/61582>`_)
758 - Stop stripping CV qualifiers from the type of ``this`` when capturing it by value in
759   a lambda.
760   (`#50866 <https://github.com/llvm/llvm-project/issues/50866>`_)
761 - Fix ordering of function templates by constraints when they have template
762   template parameters with different nested constraints.
763 - Fix type equivalence comparison between auto types to take constraints into
764   account.
765 - Fix bug in the computation of the ``__has_unique_object_representations``
766   builtin for types with unnamed bitfields.
767   (`#61336 <https://github.com/llvm/llvm-project/issues/61336>`_)
768 - Fix default member initializers sometimes being ignored when performing
769   parenthesized aggregate initialization of templated types.
770   (`#62266 <https://github.com/llvm/llvm-project/issues/62266>`_)
771 - Fix overly aggressive lifetime checks for parenthesized aggregate
772   initialization.
773   (`#61567 <https://github.com/llvm/llvm-project/issues/61567>`_)
774 - Fix a crash when expanding a pack as the index of a subscript expression.
775 - Fix handling of constexpr dynamic memory allocations in template
776   arguments. (`#62462 <https://github.com/llvm/llvm-project/issues/62462>`_)
777 - Some predefined expressions are now treated as string literals in MSVC
778   compatibility mode.
779   (`#114 <https://github.com/llvm/llvm-project/issues/114>`_)
780 - Fix parsing of `auto(x)`, when it is surrounded by parentheses.
781   (`#62494 <https://github.com/llvm/llvm-project/issues/62494>`_)
782 - Fix handling of generic lambda used as template arguments.
783   (`#62611 <https://github.com/llvm/llvm-project/issues/62611>`_)
784 - Allow omitting ``typename`` in the parameter declaration of a friend
785   constructor declaration.
786   (`#63119 <https://github.com/llvm/llvm-project/issues/63119>`_)
787 - Fix access of a friend class declared in a local class. Clang previously
788   emitted an error when a friend of a local class tried to access it's
789   private data members.
790 - Allow abstract parameter and return types in functions that are
791   either deleted or not defined.
792   (`#63012 <https://github.com/llvm/llvm-project/issues/63012>`_)
793 - Fix handling of using-declarations in the init statements of for
794   loop declarations.
795   (`#63627 <https://github.com/llvm/llvm-project/issues/63627>`_)
796 - Fix crash when emitting diagnostic for out of order designated initializers
797   in C++.
798   (`#63605 <https://github.com/llvm/llvm-project/issues/63605>`_)
799 - Fix crash when using standard C++ modules with OpenMP.
800   (`#62359 <https://github.com/llvm/llvm-project/issues/62359>`_)
801 - Fix crash when using consteval non static data member initialization in
802   standard C++ modules.
803   (`#60275 <https://github.com/llvm/llvm-project/issues/60275>`_)
804 - Fix handling of ADL for dependent expressions in standard C++ modules.
805   (`#60488 <https://github.com/llvm/llvm-project/issues/60488>`_)
806 - Fix crash when combining `-ftime-trace` within standard C++ modules.
807   (`#60544 <https://github.com/llvm/llvm-project/issues/60544>`_)
808 - Don't generate template specializations when importing standard C++ modules.
809   (`#60693 <https://github.com/llvm/llvm-project/issues/60693>`_)
810 - Fix the visibility of `initializer list` in the importer of standard C++
811   modules. This addresses
812   (`#60775 <https://github.com/llvm/llvm-project/issues/60775>`_)
813 - Allow the use of constrained friend in standard C++ modules.
814   (`#60890 <https://github.com/llvm/llvm-project/issues/60890>`_)
815 - Don't evaluate initializer of used variables in every importer of standard
816   C++ modules.
817   (`#61040 <https://github.com/llvm/llvm-project/issues/61040>`_)
818 - Fix the issue that the default `operator==` in standard C++ modules will
819   cause duplicate symbol linker error.
820   (`#61067 <https://github.com/llvm/llvm-project/issues/61067>`_)
821 - Fix the false positive ODR check for template names. This addresses the issue
822   that we can't include `<ranges>` in multiple module units.
823   (`#61317 <https://github.com/llvm/llvm-project/issues/61317>`_)
824 - Fix crash for inconsistent exported declarations in standard C++ modules.
825   (`#61321 <https://github.com/llvm/llvm-project/issues/61321>`_)
826 - Fix ignoring `#pragma comment` and `#pragma detect_mismatch` directives in
827   standard C++ modules.
828   (`#61733 <https://github.com/llvm/llvm-project/issues/61733>`_)
829 - Don't generate virtual tables if the class is defined in another module units
830   for Itanium ABI.
831   (`#61940 <https://github.com/llvm/llvm-project/issues/61940>`_)
832 - Fix false postive check for constrained satisfaction in standard C++ modules.
833   (`#62589 <https://github.com/llvm/llvm-project/issues/62589>`_)
834 - Serialize the evaluated constant values for variable declarations in standard
835   C++ modules.
836   (`#62796 <https://github.com/llvm/llvm-project/issues/62796>`_)
837 - Merge lambdas in require expressions in standard C++ modules.
838   (`#63544 <https://github.com/llvm/llvm-project/issues/63544>`_)
839
840 - Fix location of default member initialization in parenthesized aggregate
841   initialization.
842   (`#63903 <https://github.com/llvm/llvm-project/issues/63903>`_)
843 - Fix constraint checking of non-generic lambdas.
844   (`#63181 <https://github.com/llvm/llvm-project/issues/63181>`_)
845
846 - Update ``FunctionDeclBitfields.NumFunctionDeclBits``. This fixes:
847   (`#64171 <https://github.com/llvm/llvm-project/issues/64171>`_).
848
849 - Fix a crash caused by substitution failure in expression requirements.
850   (`#64172 <https://github.com/llvm/llvm-project/issues/64172>`_) and
851   (`#64723 <https://github.com/llvm/llvm-project/issues/64723>`_).
852
853 Bug Fixes to AST Handling
854 ^^^^^^^^^^^^^^^^^^^^^^^^^
855
856 - Preserve ``namespace`` definitions that follow malformed declarations.
857
858 Miscellaneous Bug Fixes
859 ^^^^^^^^^^^^^^^^^^^^^^^
860
861 Miscellaneous Clang Crashes Fixed
862 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
863
864 - Dumping the AST to JSON no longer causes a failed assertion when targetting
865   the Microsoft ABI and the AST to be dumped contains dependent names that
866   would not typically be mangled.
867   (`#61440 <https://github.com/llvm/llvm-project/issues/61440>`_)
868
869 Target Specific Changes
870 -----------------------
871
872 AMDGPU Support
873 ^^^^^^^^^^^^^^
874
875 - Linking for AMDGPU now uses ``--no-undefined`` by default. This causes
876   undefined symbols in the created module to be a linker error. To prevent this,
877   pass ``-Wl,--undefined`` if compiling directly, or ``-Xoffload-linker
878   --undefined`` if using an offloading language.
879 - The deprecated ``-mcode-object-v3`` and ``-mno-code-object-v3`` command-line
880   options have been removed.
881 - A new option ``-mprintf-kind`` has been introduced that controls printf lowering
882   scheme. It is currently supported only for HIP and takes following values,
883   ``hostcall`` - printing happens during kernel execution via series of hostcalls,
884   The scheme requires the system to support pcie atomics.(default)
885   ``buffered`` - Scheme uses a debug buffer to populate printf varargs, does not
886   rely on pcie atomics support.
887
888 X86 Support
889 ^^^^^^^^^^^
890
891 - Add ISA of ``AMX-COMPLEX`` which supports ``tcmmimfp16ps`` and
892   ``tcmmrlfp16ps``.
893 - Support ISA of ``SHA512``.
894   * Support intrinsic of ``_mm256_sha512msg1_epi64``.
895   * Support intrinsic of ``_mm256_sha512msg2_epi64``.
896   * Support intrinsic of ``_mm256_sha512rnds2_epi64``.
897 - Support ISA of ``SM3``.
898   * Support intrinsic of ``_mm_sm3msg1_epi32``.
899   * Support intrinsic of ``_mm_sm3msg2_epi32``.
900   * Support intrinsic of ``_mm_sm3rnds2_epi32``.
901 - Support ISA of ``SM4``.
902   * Support intrinsic of ``_mm(256)_sm4key4_epi32``.
903   * Support intrinsic of ``_mm(256)_sm4rnds4_epi32``.
904 - Support ISA of ``AVX-VNNI-INT16``.
905   * Support intrinsic of ``_mm(256)_dpwsud(s)_epi32``.
906   * Support intrinsic of ``_mm(256)_dpwusd(s)_epi32``.
907   * Support intrinsic of ``_mm(256)_dpwuud(s)_epi32``.
908 - ``-march=graniterapids-d`` is now supported.
909
910 Arm and AArch64 Support
911 ^^^^^^^^^^^^^^^^^^^^^^^
912
913 - The hard-float ABI is now available in Armv8.1-M configurations that
914   have integer MVE instructions (and therefore have FP registers) but
915   no scalar or vector floating point computation. Previously, trying
916   to select the hard-float ABI on such a target (via
917   ``-mfloat-abi=hard`` or a triple ending in ``hf``) would silently
918   use the soft-float ABI instead.
919
920 - Clang now emits ``-Wunsupported-abi`` if the hard-float ABI is specified
921   and the selected processor lacks floating point registers.
922   (`#55755 <https://github.com/llvm/llvm-project/issues/55755>`_)
923
924 - Clang builtin ``__arithmetic_fence`` and the command line option ``-fprotect-parens``
925   are now enabled for AArch64.
926
927 - Clang supports flag output operands by which conditions in the NZCV could be outputs
928   of inline assembly for AArch64. This change is more consistent with the behavior of
929   GCC.
930
931    .. code-block:: c
932
933      // int a = foo(); int* b = bar();
934      asm("ands %w[a], %w[a], #3" : [a] "+r"(a), "=@cceq"(*b));
935
936 - Fix a crash when ``preserve_all`` calling convention is used on AArch64.
937   `Issue 58145 <https://github.com/llvm/llvm-project/issues/58145>`_
938
939 - Clang now warns if invalid target triples ``--target=aarch64-*-eabi`` or
940   ``--target=arm-*-elf`` are specified.
941
942 Windows Support
943 ^^^^^^^^^^^^^^^
944
945 LoongArch Support
946 ^^^^^^^^^^^^^^^^^
947
948 - Patchable function entry (``-fpatchable-function-entry``) is now supported
949   on LoongArch.
950 - An ABI mismatch between GCC and Clang related to the handling of empty structs
951   in C++ parameter passing under ``lp64d`` ABI was fixed.
952 - Unaligned memory accesses can be toggled by ``-m[no-]unaligned-access`` or the
953   aliases ``-m[no-]strict-align``.
954 - Non ``$``-prefixed GPR names (e.g. ``r4`` and ``a0``) are allowed in inlineasm
955   like GCC does.
956 - The ``-march=native`` ``-mtune=`` options and ``__loongarch_{arch,tune}``
957   macros are now supported.
958
959 RISC-V Support
960 ^^^^^^^^^^^^^^
961 - Added ``-mrvv-vector-bits=`` option to give an upper and lower bound on vector
962   length. Valid values are powers of 2 between 64 and 65536. A value of 32
963   should eventually be supported. We also accept "zvl" to use the Zvl*b
964   extension from ``-march`` or ``-mcpu`` to the be the upper and lower bound.
965 - Fixed incorrect ABI lowering of ``_Float16`` in the case of structs
966   containing ``_Float16`` that are eligible for passing via GPR+FPR or
967   FPR+FPR.
968 - Removed support for ``__attribute__((interrupt("user")))``. User-level
969   interrupts are not in version 1.12 of the privileged specification.
970 - Added ``attribute(riscv_rvv_vector_bits(__riscv_v_fixed_vlen))`` to allow
971   the size of a RVV (RISC-V Vector) scalable type to be specified. This allows
972   RVV scalable vector types to be used in structs or in global variables.
973 - The rules for ordering of extensions in ``-march`` strings were relaxed. A
974   canonical ordering is no longer enforced on ``z*``, ``s*``, and ``x*``
975   prefixed extensions.
976 - An ABI mismatch between GCC and Clang related to the handling of empty
977   structs in C++ parameter passing under the hard floating point calling
978   conventions was fixed.
979 - Support the RVV intrinsics v0.12. Please checkout `the RVV C intrinsics
980   specification
981   <https://github.com/riscv-non-isa/rvv-intrinsic-doc/releases/tag/v0.12.0>`_.
982   It is expected there won't be any incompatibility from this v0.12 to the
983   specifications planned for v1.0.
984
985   * Added vector intrinsics that models control to the rounding mode
986     (``frm`` and ``vxrm``) for the floating-point instruction intrinsics and the 
987     fixed-point instruction intrinsics.
988   * Added intrinsics for reinterpret cast between vector boolean and vector
989     integer ``m1`` value
990   * Removed the ``vread_csr`` and ``vwrite_csr`` intrinsics
991 - Default ``-fdebug-dwarf-version=`` is downgraded to 4 to work around
992   incorrect DWARF related to ULEB128 and linker compatibility before
993   ``R_RISCV_SET_ULEB128`` becomes more widely supported.
994   (`D157663 <https://reviews.llvm.org/D157663>`_).
995
996 CUDA/HIP Language Changes
997 ^^^^^^^^^^^^^^^^^^^^^^^^^
998 - Clang has been updated to align its default language standard for CUDA/HIP with
999   that of C++. The standard has now been enhanced to gnu++17, supplanting the
1000   previously used c++14.
1001
1002 CUDA Support
1003 ^^^^^^^^^^^^
1004 - Clang now supports CUDA SDK up to 12.1
1005
1006 AIX Support
1007 ^^^^^^^^^^^
1008 - Enabled ThinLTO support. Minimum OS requirement is AIX 7.2 TL5 SP7 or
1009   the upcoming AIX 7.3 TL2.
1010
1011 - Enabled integrated assembler (``-f[no-]integrated-as``) for LTO. LTO now
1012   defaults to the integrated assembler.
1013
1014 - Enabled Clang-based instrumented profiling
1015   (``-fprofile-instr-[generate|use]``).
1016
1017 - Added an AIX-only link-time option, ``-mxcoff-build-id=0xHEXSTRING``, to allow
1018   users to embed a hex id in their binary such that it's readable by the program
1019   itself. This option is an alternative to the ``--build-id=0xHEXSTRING`` GNU
1020   linker option, which is currently not supported by the AIX linker.
1021
1022 - Introduced the ``-mxcoff-roptr`` option to place constant objects with
1023   relocatable address values in the read-only data section. This option should
1024   be used with the ``-fdata-sections`` option, and is not supported with
1025   ``-fno-data-sections``. When ``-mxcoff-roptr`` is in effect at link time,
1026   read-only data sections with relocatable address values that resolve to
1027   imported symbols are made writable.
1028
1029 - Implemented the ``-frecord-command-line`` option on AIX, which saves the
1030   command-line options used from compiling a source file to the corresponding
1031   object file or binary file.
1032
1033 - Added a new linker option, ``-K``, that is used to align the header, text,
1034   data, and loader sections of the output file so that each section begins on
1035   a page boundary.
1036
1037 WebAssembly Support
1038 ^^^^^^^^^^^^^^^^^^^
1039 - Shared library support (and PIC code generation) for WebAssembly is no longer
1040   limited to the Emscripten target OS and now works with other targets such as
1041   wasm32-wasi.  Note that the `format
1042   <https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md>`_
1043   is not yet stable and may change between LLVM versions.  Also, WASI does not
1044   yet have facilities to load dynamic libraries.
1045
1046 AVR Support
1047 ^^^^^^^^^^^
1048 - The definition of ``USHRT_MAX`` in the freestanding ``<limits.h>`` no longer
1049   overflows on AVR (where ``sizeof(int) == sizeof(unsigned short)``).  The type
1050   of ``USHRT_MAX`` is now ``unsigned int`` instead of ``int``, as required by
1051   the C standard.
1052
1053 PowerPC Support
1054 ^^^^^^^^^^^^^^^
1055 - Clang now emits errors when it detects incompatible target features for
1056   PowerPC builtins.
1057
1058 DWARF Support in Clang
1059 ----------------------
1060
1061 Floating Point Support in Clang
1062 -------------------------------
1063 - Add ``__builtin_elementwise_log`` builtin for floating point types only.
1064 - Add ``__builtin_elementwise_log10`` builtin for floating point types only.
1065 - Add ``__builtin_elementwise_log2`` builtin for floating point types only.
1066 - Add ``__builtin_elementwise_exp`` builtin for floating point types only.
1067 - Add ``__builtin_elementwise_exp2`` builtin for floating point types only.
1068 - Add ``__builtin_set_flt_rounds`` builtin for X86, x86_64, Arm and AArch64 only.
1069 - Add ``__builtin_elementwise_pow`` builtin for floating point types only.
1070
1071 AST Matchers
1072 ------------
1073
1074 - Add ``coroutineBodyStmt`` matcher.
1075
1076 - The ``hasBody`` matcher now matches coroutine body nodes in
1077   ``CoroutineBodyStmts``.
1078
1079 - Add ``arrayInitIndexExpr`` and ``arrayInitLoopExpr`` matchers.
1080
1081 clang-format
1082 ------------
1083
1084 - Add ``NextLineOnly`` style to option ``PackConstructorInitializers``.
1085   Compared to ``NextLine`` style, ``NextLineOnly`` style will not try to
1086   put the initializers on the current line first, instead, it will try to
1087   put the initializers on the next line only.
1088 - Add additional Qualifier Ordering support for special cases such
1089   as templates, requires clauses, long qualified names.
1090 - Fix all known issues associated with ``LambdaBodyIndentation: OuterScope``.
1091 - Add ``BracedInitializerIndentWidth`` which can be used to configure
1092   the indentation level of the contents of braced init lists.
1093 - Add ``KeepEmptyLinesAtEOF`` to keep empty lines at end of file.
1094 - Add ``RemoveParentheses`` to remove redundant parentheses.
1095 - Add ``TypeNames`` to treat listed non-keyword identifiers as type names.
1096 - Add ``AlignConsecutiveShortCaseStatements`` which can be used to align case
1097   labels in conjunction with ``AllowShortCaseLabelsOnASingleLine``.
1098 - Add ``SpacesInParens`` style with ``SpacesInParensOptions`` to replace
1099   ``SpacesInConditionalStatement``, ``SpacesInCStyleCastParentheses``,
1100   ``SpaceInEmptyParentheses``, and ``SpacesInParentheses``.
1101
1102 libclang
1103 --------
1104
1105 - Introduced the new function ``clang_CXXMethod_isExplicit``,
1106   which identifies whether a constructor or conversion function cursor
1107   was marked with the explicit identifier.
1108
1109 - Introduced the new ``CXIndex`` constructor function
1110   ``clang_createIndexWithOptions``, which allows storing precompiled preambles
1111   in memory or overriding the precompiled preamble storage path.
1112
1113 - Deprecated two functions ``clang_CXIndex_setGlobalOptions`` and
1114   ``clang_CXIndex_setInvocationEmissionPathOption`` in favor of the new
1115   function ``clang_createIndexWithOptions`` in order to improve thread safety.
1116
1117 - Added check in ``clang_getFieldDeclBitWidth`` for whether a bit-field
1118   has an evaluable bit width. Fixes undefined behavior when called on a
1119   bit-field whose width depends on a template parameter.
1120
1121 - Added ``CXBinaryOperatorKind`` and ``CXUnaryOperatorKind``.
1122   (`#29138 <https://github.com/llvm/llvm-project/issues/29138>`_)
1123
1124 Static Analyzer
1125 ---------------
1126
1127 - Fix incorrect alignment attribute on the this parameter of certain
1128   non-complete destructors when using the Microsoft ABI.
1129   (`#60465 <https://github.com/llvm/llvm-project/issues/60465>`_)
1130
1131 - Removed the deprecated
1132   ``consider-single-element-arrays-as-flexible-array-members`` analyzer option.
1133   Any use of this flag will result in an error.
1134   Use `-fstrict-flex-arrays=<n>
1135   <https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fstrict-flex-arrays>`_
1136
1137 - Better modeling of lifetime-extended memory regions. As a result, the
1138   ``MoveChecker`` raises more true-positive reports.
1139
1140 - Fixed some bugs (including crashes) around the handling of constant global
1141   arrays and their initializer expressions.
1142
1143 - The ``CStringChecker`` will invalidate less if the copy operation is
1144   inferable to be bounded. For example, if the arguments of ``strcpy`` are
1145   known to be of certain lengths and that are in-bounds.
1146
1147    .. code-block:: c++
1148
1149     struct {
1150       void *ptr;
1151       char arr[4];
1152     } x;
1153     x.ptr = malloc(1);
1154     // extent of 'arr' is 4, and writing "hi\n" (4 characters),
1155     // thus no buffer overflow can happen
1156     strcpy(x.arr, "hi\n");
1157     free(x.ptr); // no longer reports memory leak here
1158
1159   Similarly, functions like ``strsep`` now won't invalidate the object
1160   containing the destination buffer, because it can never overflow.
1161   Note that, ``std::copy`` is still not modeled, and as such, it will still
1162   invalidate the enclosing object on call.
1163   (`#55019 <https://github.com/llvm/llvm-project/issues/55019>`_)
1164
1165 - Implement ``BufferOverlap`` check for ``sprint``/``snprintf``
1166   The ``CStringChecker`` checks for buffer overlaps for ``sprintf`` and
1167   ``snprintf``.
1168
1169 - Objective-C support was improved around checking ``_Nonnull`` and
1170   ``_Nullable`` including block pointers and literal objects.
1171
1172 - Let the ``StreamChecker`` detect ``NULL`` streams instead of by
1173   ``StdCLibraryFunctions``.
1174   ``StreamChecker`` improved on the ``fseek`` modeling for the ``SEEK_SET``,
1175   ``SEEK_END``, ``SEEK_CUR`` arguments.
1176
1177 - ``StdCLibraryFunctionArgs`` was merged into the ``StdCLibraryFunctions``.
1178   The diagnostics of the ``StdCLibraryFunctions`` was improved.
1179
1180 - ``QTimer::singleShot`` now doesn't raise false-positives for memory leaks by
1181   the ``MallocChecker``.
1182   (`#39713 <https://github.com/llvm/llvm-project/issues/39713>`_)
1183
1184 - Fixed the infamous unsigned index false-positives in the
1185   ``ArrayBoundCheckerV2`` checker.
1186   (`#44493 <https://github.com/llvm/llvm-project/issues/44493>`_)
1187
1188 - Now, taint propagations are tracked further back until the real taint source.
1189   This improves all taint-related diagnostics.
1190
1191 - Fixed a null-pointer dereference crash inside the ``MoveChecker``.
1192
1193 .. _release-notes-sanitizers:
1194
1195 Sanitizers
1196 ----------
1197 - Several more sanitizers are now ported to LoongArch: MSan, DFsan, Profile, XRay and libFuzzer.
1198
1199 Python Binding Changes
1200 ----------------------
1201 The following methods have been added:
1202
1203 - ``clang_Location_isInSystemHeader`` exposed via the ``is_in_system_header``
1204   property of the `Location` class.
1205
1206 Configurable Multilib
1207 ---------------------
1208 The BareMetal toolchain for AArch64 & ARM now supports multilib, configurable
1209 via ``multilib.yaml``. See `the multilib docs <https://clang.llvm.org/docs/Multilib.html>`_
1210 for more details.
1211
1212 Additional Information
1213 ======================
1214
1215 A wide variety of additional information is available on the `Clang web
1216 page <https://clang.llvm.org/>`_. The web page contains versions of the
1217 API documentation which are up-to-date with the Git version of
1218 the source code. You can access versions of these documents specific to
1219 this release by going into the "``clang/docs/``" directory in the Clang
1220 tree.
1221
1222 If you have any questions or comments about Clang, please feel free to
1223 contact us on the `Discourse forums (Clang Frontend category)
1224 <https://discourse.llvm.org/c/clang/6>`_.