1===========================================
2Clang |release| |ReleaseNotesTitle|
3===========================================
4
5.. contents::
6   :local:
7   :depth: 2
8
9Written 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 Download Page <https://releases.llvm.org/download.html>`_.
17
18Introduction
19============
20
21This document contains the release notes for the Clang C/C++/Objective-C
22frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
23describe the status of Clang in some detail, including major
24improvements from the previous release and new feature work. For the
25general LLVM release notes, see `the LLVM
26documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM
27releases may be downloaded from the `LLVM releases web
28site <https://llvm.org/releases/>`_.
29
30For more information about Clang or LLVM, including information about the
31latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
32`LLVM Web Site <https://llvm.org>`_.
33
34Note that if you are reading this file from a Git checkout or the
35main Clang web page, this document applies to the *next* release, not
36the current one. To see the release notes for a specific release, please
37see the `releases page <https://llvm.org/releases/>`_.
38
39What's New in Clang |release|?
40==============================
41
42Some of the major new features and improvements to Clang are listed
43here. Generic improvements to Clang as a whole or to its underlying
44infrastructure are described first, followed by language-specific
45sections with improvements to Clang's support for those languages.
46
47Major New Features
48------------------
49
50- Clang now supports the ``-fzero-call-used-regs`` feature for x86. The purpose
51  of this feature is to limit Return-Oriented Programming (ROP) exploits and
52  information leakage. It works by zeroing out a selected class of registers
53  before function return --- e.g., all GPRs that are used within the function.
54  There is an analogous ``zero_call_used_regs`` attribute to allow for finer
55  control of this feature.
56
57- Clang now supports randomizing structure layout in C. This feature is a
58  compile-time hardening technique, making it more difficult for an attacker to
59  retrieve data from structures. Specify randomization with the
60  ``randomize_layout`` attribute. The corresponding ``no_randomize_layout``
61  attribute can be used to turn the feature off.
62
63  A seed value is required to enable randomization, and is deterministic based
64  on a seed value. Use the ``-frandomize-layout-seed=`` or
65  ``-frandomize-layout-seed-file=`` flags.
66
67  .. note::
68
69      Randomizing structure layout is a C-only feature.
70
71- Experimental support for HLSL has been added. The implementation is
72  incomplete and highly experimental. For more information about the ongoing
73  work to support HLSL see the `documentation
74  <https://clang.llvm.org/docs/HLSLSupport.html>`_, or the `GitHub project
75  <https://github.com/orgs/llvm/projects/4>`_.
76
77Bug Fixes
78---------
79- ``CXXNewExpr::getArraySize()`` previously returned a ``llvm::Optional``
80  wrapping a ``nullptr`` when the ``CXXNewExpr`` did not have an array
81  size expression. This was fixed and ``::getArraySize()`` will now always
82  either return ``None`` or a ``llvm::Optional`` wrapping a valid ``Expr*``.
83  This fixes `Issue 53742 <https://github.com/llvm/llvm-project/issues/53742>`_.
84- We now ignore full expressions when traversing cast subexpressions. This
85  fixes `Issue 53044 <https://github.com/llvm/llvm-project/issues/53044>`_.
86- Allow ``-Wno-gnu`` to silence GNU extension diagnostics for pointer
87  arithmetic diagnostics. Fixes `Issue 54444
88  <https://github.com/llvm/llvm-project/issues/54444>`_.
89- Placeholder constraints, as in ``Concept auto x = f();``, were not checked
90  when modifiers like ``auto&`` or ``auto**`` were added. These constraints are
91  now checked.
92  This fixes  `Issue 53911 <https://github.com/llvm/llvm-project/issues/53911>`_
93  and  `Issue 54443 <https://github.com/llvm/llvm-project/issues/54443>`_.
94- Previously invalid member variables with template parameters would crash clang.
95  Now fixed by setting identifiers for them.
96  This fixes `Issue 28475 (PR28101) <https://github.com/llvm/llvm-project/issues/28475>`_.
97- Now allow the ``restrict`` and ``_Atomic`` qualifiers to be used in
98  conjunction with ``__auto_type`` to match the behavior in GCC. This fixes
99  `Issue 53652 <https://github.com/llvm/llvm-project/issues/53652>`_.
100- No longer crash when specifying a variably-modified parameter type in a
101  function with the ``naked`` attribute. This fixes
102  `Issue 50541 <https://github.com/llvm/llvm-project/issues/50541>`_.
103- Allow multiple ``#pragma weak`` directives to name the same undeclared (if an
104  alias, target) identifier instead of only processing one such ``#pragma weak``
105  per identifier.
106  Fixes `Issue 28985 <https://github.com/llvm/llvm-project/issues/28985>`_.
107- Assignment expressions in C11 and later mode now properly strip the _Atomic
108  qualifier when determining the type of the assignment expression. Fixes
109  `Issue 48742 <https://github.com/llvm/llvm-project/issues/48742>`_.
110- Improved the diagnostic when accessing a member of an atomic structure or
111  union object in C; was previously an unhelpful error, but now issues a
112  ``-Watomic-access`` warning which defaults to an error. Fixes
113  `Issue 54563 <https://github.com/llvm/llvm-project/issues/54563>`_.
114- Unevaluated lambdas in dependant contexts no longer result in clang crashing.
115  This fixes Issues `50376 <https://github.com/llvm/llvm-project/issues/50376>`_,
116  `51414 <https://github.com/llvm/llvm-project/issues/51414>`_,
117  `51416 <https://github.com/llvm/llvm-project/issues/51416>`_,
118  and `51641 <https://github.com/llvm/llvm-project/issues/51641>`_.
119- The builtin function __builtin_dump_struct would crash clang when the target
120  struct contains a bitfield. It now correctly handles bitfields.
121  This fixes Issue `Issue 54462 <https://github.com/llvm/llvm-project/issues/54462>`_.
122- Statement expressions are now disabled in default arguments in general.
123  This fixes Issue `Issue 53488 <https://github.com/llvm/llvm-project/issues/53488>`_.
124- According to `CWG 1394 <https://wg21.link/cwg1394>`_ and
125  `C++20 [dcl.fct.def.general]p2 <https://timsong-cpp.github.io/cppwp/n4868/dcl.fct.def#general-2.sentence-3>`_,
126  Clang should not diagnose incomplete types in function definitions if the function body is "= delete;".
127  This fixes Issue `Issue 52802 <https://github.com/llvm/llvm-project/issues/52802>`_.
128- Unknown type attributes with a ``[[]]`` spelling are no longer diagnosed twice.
129  This fixes Issue `Issue 54817 <https://github.com/llvm/llvm-project/issues/54817>`_.
130- Clang should no longer incorrectly diagnose a variable declaration inside of
131  a lambda expression that shares the name of a variable in a containing
132  if/while/for/switch init statement as a redeclaration.
133  This fixes `Issue 54913 <https://github.com/llvm/llvm-project/issues/54913>`_.
134- Overload resolution for constrained function templates could use the partial
135  order of constraints to select an overload, even if the parameter types of
136  the functions were different. It now diagnoses this case correctly as an
137  ambiguous call and an error. Fixes
138  `Issue 53640 <https://github.com/llvm/llvm-project/issues/53640>`_.
139- No longer crash when trying to determine whether the controlling expression
140  argument to a generic selection expression has side effects in the case where
141  the expression is result dependent. This fixes
142  `Issue 50227 <https://github.com/llvm/llvm-project/issues/50227>`_.
143- Fixed an assertion when constant evaluating an initializer for a GCC/Clang
144  floating-point vector type when the width of the initialization is exactly
145  the same as the elements of the vector being initialized.
146  Fixes `Issue 50216 <https://github.com/llvm/llvm-project/issues/50216>`_.
147- Fixed a crash when the ``__bf16`` type is used such that its size or
148  alignment is calculated on a target which does not support that type. This
149  fixes `Issue 50171 <https://github.com/llvm/llvm-project/issues/50171>`_.
150- Fixed a false positive diagnostic about an unevaluated expression having no
151  side effects when the expression is of VLA type and is an operand of the
152  ``sizeof`` operator. Fixes `Issue 48010 <https://github.com/llvm/llvm-project/issues/48010>`_.
153- Fixed a false positive diagnostic about scoped enumerations being a C++11
154  extension in C mode. A scoped enumeration's enumerators cannot be named in C
155  because there is no way to fully qualify the enumerator name, so this
156  "extension" was unintentional and useless. This fixes
157  `Issue 42372 <https://github.com/llvm/llvm-project/issues/42372>`_.
158- Clang will now find and emit a call to an allocation function in a
159  promise_type body for coroutines if there is any allocation function
160  declaration in the scope of promise_type. Additionally, to implement CWG2585,
161  a coroutine will no longer generate a call to a global allocation function
162  with the signature (std::size_t, p0, ..., pn).
163  This fixes Issue `Issue 54881 <https://github.com/llvm/llvm-project/issues/54881>`_.
164- Implement `CWG 2394 <https://wg21.link/cwg2394>`_: Const class members
165  may be initialized with a defaulted default constructor under the same
166  conditions it would be allowed for a const object elsewhere.
167- ``__has_unique_object_representations`` no longer reports that ``_BitInt`` types
168  have unique object representations if they have padding bits.
169- Unscoped and scoped enumeration types can no longer be initialized from a
170  brace-init-list containing a single element of a different scoped enumeration
171  type.
172- Allow use of an elaborated type specifier as a ``_Generic`` selection
173  association in C++ mode. This fixes
174  `Issue 55562 <https://github.com/llvm/llvm-project/issues/55562>`_.
175- Clang will allow calling a ``consteval`` function in a default argument. This
176  fixes `Issue 48230 <https://github.com/llvm/llvm-project/issues/48230>`_.
177- Fixed memory leak due to ``VarTemplateSpecializationDecl`` using
178  ``TemplateArgumentListInfo`` instead of ``ASTTemplateArgumentListInfo``.
179- An initializer for a static variable declaration, which is nested
180  inside a statement expression in an aggregate initializer, is now
181  emitted as a dynamic initializer. Previously the variable would
182  incorrectly be zero-initialized. In contexts where a dynamic
183  initializer is not allowed this is now diagnosed as an error.
184
185Improvements to Clang's diagnostics
186^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
187- ``-Wliteral-range`` will warn on floating-point equality comparisons with
188  constants that are not representable in a casted value. For example,
189  ``(float) f == 0.1`` is always false.
190- ``-Winline-namespace-reopened-noninline`` now takes into account that the
191  ``inline`` keyword must appear on the original but not necessarily all
192  extension definitions of an inline namespace and therefore points its note
193  at the original definition. This fixes `Issue 50794 (PR51452)
194  <https://github.com/llvm/llvm-project/issues/50794>`_.
195- ``-Wunused-but-set-variable`` now also warns if the variable is only used
196  by unary operators.
197- ``-Wunused-variable`` no longer warn for references extending the lifetime
198  of temporaries with side effects. This fixes `Issue 54489
199  <https://github.com/llvm/llvm-project/issues/54489>`_.
200- Modified the behavior of ``-Wstrict-prototypes`` and added a new, related
201  diagnostic ``-Wdeprecated-non-prototype``. The strict prototypes warning will
202  now only diagnose deprecated declarations and definitions of functions
203  without a prototype where the behavior in C2x will remain correct. This
204  diagnostic remains off by default but is now enabled via ``-pedantic`` due to
205  it being a deprecation warning. ``-Wstrict-prototypes`` has no effect in C2x
206  or when ``-fno-knr-functions`` is enabled. ``-Wdeprecated-non-prototype``
207  will diagnose cases where the deprecated declarations or definitions of a
208  function without a prototype will change behavior in C2x. Additionally, it
209  will diagnose calls which pass arguments to a function without a prototype.
210  This warning is enabled only when the ``-Wdeprecated-non-prototype`` option
211  is enabled at the function declaration site, which allows a developer to
212  disable the diagnostic for all callers at the point of declaration. This
213  diagnostic is grouped under the ``-Wstrict-prototypes`` warning group, but is
214  enabled by default. ``-Wdeprecated-non-prototype`` has no effect in C2x or
215  when ``-fno-knr-functions`` is enabled.
216- Clang now appropriately issues an error in C when a definition of a function
217  without a prototype and with no arguments is an invalid redeclaration of a
218  function with a prototype. e.g., ``void f(int); void f() {}`` is now properly
219  diagnosed.
220- The ``-Wimplicit-function-declaration`` warning diagnostic now defaults to
221  an error in C99 and later. Prior to C2x, it may be downgraded to a warning
222  with ``-Wno-error=implicit-function-declaration``, or disabled entirely with
223  ``-Wno-implicit-function-declaration``. As of C2x, support for implicit
224  function declarations has been removed, and the warning options will have no
225  effect.
226- The ``-Wimplicit-int`` warning diagnostic now defaults to an error in C99 and
227  later. Prior to C2x, it may be downgraded to a warning with
228  ``-Wno-error=implicit-int``, or disabled entirely with ``-Wno-implicit-int``.
229  As of C2x, support for implicit int has been removed, and the warning options
230  will have no effect. Specifying ``-Wimplicit-int`` in C89 mode will now issue
231  warnings instead of being a noop.
232- No longer issue a "declaration specifiers missing, defaulting to int"
233  diagnostic in C89 mode because it is not an extension in C89, it was valid
234  code. The diagnostic has been removed entirely as it did not have a
235  diagnostic group to disable it, but it can be covered wholly by
236  ``-Wimplicit-int``.
237- ``-Wmisexpect`` warns when the branch weights collected during profiling
238  conflict with those added by ``llvm.expect``.
239- ``-Wthread-safety-analysis`` now considers overloaded compound assignment and
240  increment/decrement operators as writing to their first argument, thus
241  requiring an exclusive lock if the argument is guarded.
242- ``-Wenum-conversion`` now warns on converting a signed enum of one type to an
243  unsigned enum of a different type (or vice versa) rather than
244  ``-Wsign-conversion``.
245- Added the ``-Wunreachable-code-generic-assoc`` diagnostic flag (grouped under
246  the ``-Wunreachable-code`` flag) which is enabled by default and warns the
247  user about ``_Generic`` selection associations which are unreachable because
248  the type specified is an array type or a qualified type.
249- Added the ``-Wgnu-line-marker`` diagnostic flag (grouped under the ``-Wgnu``
250  flag) which is a portability warning about use of GNU linemarker preprocessor
251  directives. Fixes `Issue 55067 <https://github.com/llvm/llvm-project/issues/55067>`_.
252- Using ``#elifdef`` and ``#elifndef`` that are incompatible with C/C++
253  standards before C2x/C++2b are now warned via ``-pedantic``. Additionally,
254  on such language mode, ``-Wpre-c2x-compat`` and ``-Wpre-c++2b-compat``
255  diagnostic flags report a compatibility issue.
256  Fixes `Issue 55306 <https://github.com/llvm/llvm-project/issues/55306>`_.
257- Clang now checks for stack resource exhaustion when recursively parsing
258  declarators in order to give a diagnostic before we run out of stack space.
259  This fixes `Issue 51642 <https://github.com/llvm/llvm-project/issues/51642>`_.
260- Unknown preprocessor directives in a skipped conditional block are now given
261  a typo correction suggestion if the given directive is sufficiently similar
262  to another preprocessor conditional directive. For example, if ``#esle``
263  appears in a skipped block, we will warn about the unknown directive and
264  suggest ``#else`` as an alternative. ``#elifdef`` and ``#elifndef`` are only
265  suggested when in C2x or C++2b mode. Fixes
266  `Issue 51598 <https://github.com/llvm/llvm-project/issues/51598>`_.
267- The ``-Wdeprecated`` diagnostic will now warn on out-of-line ``constexpr``
268  declarations downgraded to definitions in C++1z, in addition to the
269  existing warning on out-of-line ``const`` declarations.
270- ``-Wshift-overflow`` will not warn for signed left shifts in C++20 mode
271  (and newer), as it will always wrap and never overflow. This fixes
272  `Issue 52873 <https://github.com/llvm/llvm-project/issues/52873>`_.
273- When using class templates without arguments, clang now tells developers
274  that template arguments are missing in certain contexts.
275  This fixes `Issue 55962 <https://github.com/llvm/llvm-project/issues/55962>`_.
276- Printable Unicode characters within `static_assert` messages are no longer
277  escaped.
278- The ``-Winfinite-recursion`` diagnostic no longer warns about
279  unevaluated operands of a ``typeid`` expression, as they are now
280  modeled correctly in the CFG. This fixes
281  `Issue 21668 <https://github.com/llvm/llvm-project/issues/21668>`_.
282
283Non-comprehensive list of changes in this release
284-------------------------------------------------
285
286- Improve __builtin_dump_struct:
287
288  - Support bitfields in struct and union.
289  - Improve the dump format, dump both bitwidth(if its a bitfield) and field
290    value.
291  - Remove anonymous tag locations and flatten anonymous struct members.
292  - Beautify dump format, add indent for struct members.
293  - Support passing additional arguments to the formatting function, allowing
294    use with ``fprintf`` and similar formatting functions.
295  - Support use within constant evaluation in C++, if a ``constexpr``
296    formatting function is provided.
297  - Support formatting of base classes in C++.
298  - Support calling a formatting function template in C++, which can provide
299    custom formatting for non-aggregate types.
300
301- Previously disabled sanitizer options now enabled by default:
302  - ASAN_OPTIONS=detect_stack_use_after_return=1 (only on Linux).
303  - MSAN_OPTIONS=poison_in_dtor=1.
304
305New Compiler Flags
306------------------
307- Added the ``-fno-knr-functions`` flag to allow users to opt into the C2x
308  behavior where a function with an empty parameter list is treated as though
309  the parameter list were ``void``. There is no ``-fknr-functions`` or
310  ``-fno-no-knr-functions`` flag; this feature cannot be disabled in language
311  modes where it is required, such as C++ or C2x.
312- A new ARM pass to workaround Cortex-A57 Erratum 1742098 and Cortex-A72 Erratum
313  1655431 can be enabled using ``-mfix-cortex-a57-aes-1742098`` or
314  ``-mfix-cortex-a72-aes-1655431``. The pass is enabled when using either of
315  these cpus with ``-mcpu=`` and can be disabled using
316  ``-mno-fix-cortex-a57-aes-1742098`` or ``-mno-fix-cortex-a72-aes-1655431``.
317- Added the ``-fexperimental-max-bitint-width=`` option to increase the maximum
318  allowed bit width of ``_BitInt`` types beyond the default of 128 bits. Some
319  operations, such as division or float-to-integer conversion, on ``_BitInt``
320  types with more than 128 bits currently crash clang. This option will be
321  removed in the future once clang supports all such operations.
322- Added the ``-print-diagnostic-options`` option, which prints a list of
323  warnings the compiler supports.
324
325Deprecated Compiler Flags
326-------------------------
327
328Modified Compiler Flags
329-----------------------
330
331Removed Compiler Flags
332-------------------------
333- Removed the ``-fno-concept-satisfaction-caching`` flag. The flag was added
334  at the time when the draft of C++20 standard did not permit caching of
335  atomic constraints. The final standard permits such caching, see
336  `WG21 P2104R0 <http://wg21.link/p2104r0>`_.
337
338New Pragmas in Clang
339--------------------
340- Added support for MSVC's ``#pragma function``, which tells the compiler to
341  generate calls to functions listed in the pragma instead of using the
342  builtins.
343- Added support for MSVC's ``#pragma alloc_text``. The pragma names the code
344  section functions are placed in. The pragma only applies to functions with
345  C linkage.
346- Added support for an empty optimization list for MSVC's ``#pragma optimize``.
347  The pragma takes a list of optimizations to turn on or off which applies to
348  all functions following the pragma. At the moment, only an empty list is
349  supported.
350
351- ...
352
353Attribute Changes in Clang
354--------------------------
355
356- Added support for parameter pack expansion in ``clang::annotate``.
357
358- The ``overloadable`` attribute can now be written in all of the syntactic
359  locations a declaration attribute may appear.
360  This fixes `Issue 53805 <https://github.com/llvm/llvm-project/issues/53805>`_.
361
362- Improved namespace attributes handling:
363
364  - Handle GNU attributes before a namespace identifier and subsequent
365    attributes of different kinds.
366  - Emit error on GNU attributes for a nested namespace definition.
367
368- Statement attributes ``[[clang::noinline]]`` and  ``[[clang::always_inline]]``
369  can be used to control inlining decisions at callsites.
370
371- ``#pragma clang attribute push`` now supports multiple attributes within a single directive.
372
373- The ``__declspec(naked)`` attribute can no longer be written on a member
374  function in Microsoft compatibility mode, matching the behavior of cl.exe.
375
376- Attribute ``no_builtin`` should now affect the generated code. It now disables
377  builtins (corresponding to the specific names listed in the attribute) in the
378  body of the function the attribute is on.
379
380- When the ``weak`` attribute is applied to a const qualified variable clang no longer
381  tells the backend it is allowed to optimize based on initializer value.
382
383- Added the ``clang::annotate_type`` attribute, which can be used to add
384  annotations to types (see documentation for details).
385
386- Added half float to types that can be represented by ``__attribute__((mode(XX)))``.
387
388Windows Support
389---------------
390
391- Add support for MSVC-compatible ``/JMC``/``/JMC-`` flag in clang-cl (supports
392  X86/X64/ARM/ARM64). ``/JMC`` could only be used when ``/Zi`` or ``/Z7`` is
393  turned on. With this addition, clang-cl can be used in Visual Studio for the
394  JustMyCode feature. Note, you may need to manually add ``/JMC`` as additional
395  compile options in the Visual Studio since it currently assumes clang-cl does not support ``/JMC``.
396
397- Implemented generation of SEH unwind information on ARM. (C++ exception
398  handling in MSVC mode is still unimplemented though.)
399
400- Switched MinGW mode on ARM to use SEH instead of DWARF for unwind information.
401
402AIX Support
403-----------
404
405- The driver no longer adds ``-mignore-xcoff-visibility`` by default for AIX
406  targets when no other visibility command-line options are in effect, as
407  ignoring hidden visibility can silently have undesirable side effects (e.g
408  when libraries depend on visibility to hide non-ABI facing entities). The
409  ``-mignore-xcoff-visibility`` option can be manually specified on the
410  command-line to recover the previous behavior if desired.
411
412C Language Changes in Clang
413---------------------------
414
415C2x Feature Support
416-------------------
417
418- Implemented `WG14 N2674 The noreturn attribute <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf>`_.
419- Implemented `WG14 N2935 Make false and true first-class language features <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2935.pdf>`_.
420- Implemented `WG14 N2763 Adding a fundamental type for N-bit integers <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2763.pdf>`_.
421- Implemented `WG14 N2775 Literal suffixes for bit-precise integers <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2775.pdf>`_.
422- Implemented the ``*_WIDTH`` macros to complete support for
423  `WG14 N2412 Two's complement sign representation for C2x <https://www9.open-std.org/jtc1/sc22/wg14/www/docs/n2412.pdf>`_.
424- Implemented `WG14 N2418 Adding the u8 character prefix <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2418.pdf>`_.
425- Removed support for implicit function declarations. This was a C89 feature
426  that was removed in C99, but cannot be supported in C2x because it requires
427  support for functions without prototypes, which no longer exist in C2x.
428- Implemented `WG14 N2841 No function declarators without prototypes <https://www9.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm>`_
429  and `WG14 N2432 Remove support for function definitions with identifier lists <https://www9.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf>`_.
430
431C++ Language Changes in Clang
432-----------------------------
433
434- Improved ``-O0`` code generation for calls to ``std::move``, ``std::forward``,
435  ``std::move_if_noexcept``, ``std::addressof``, and ``std::as_const``. These
436  are now treated as compiler builtins and implemented directly, rather than
437  instantiating the definition from the standard library.
438- Fixed mangling of nested dependent names such as ``T::a::b``, where ``T`` is a
439  template parameter, to conform to the Itanium C++ ABI and be compatible with
440  GCC. This breaks binary compatibility with code compiled with earlier versions
441  of clang; use the ``-fclang-abi-compat=14`` option to get the old mangling.
442- Preprocessor character literals with a ``u8`` prefix are now correctly treated as
443  unsigned character literals. This fixes `Issue 54886 <https://github.com/llvm/llvm-project/issues/54886>`_.
444- Stopped allowing constraints on non-template functions to be compliant with
445  dcl.decl.general p4.
446
447C++20 Feature Support
448^^^^^^^^^^^^^^^^^^^^^
449- Diagnose consteval and constexpr issues that happen at namespace scope. This
450  partially addresses `Issue 51593 <https://github.com/llvm/llvm-project/issues/51593>`_.
451- No longer attempt to evaluate a consteval UDL function call at runtime when
452  it is called through a template instantiation. This fixes
453  `Issue 54578 <https://github.com/llvm/llvm-project/issues/54578>`_.
454- Implemented `__builtin_source_location()` which enables library support for std::source_location.
455- Clang now correctly delays the instantiation of function constraints until
456  the time of checking, which should now allow the libstdc++ ranges implementation
457  to work for at least trivial examples.  This fixes
458  `Issue 44178 <https://github.com/llvm/llvm-project/issues/44178>`_.
459- The mangling scheme for C++20 modules has incompatibly changed. The
460  initial mangling was discovered not to be reversible, and the weak
461  ownership design decision did not give the backwards compatibility
462  that was hoped for. C++20 since added ``extern "C++"`` semantics
463  that can be used for such compatibility. The demangler now demangles
464  symbols with named module attachment.
465
466- As per "Conditionally Trivial Special Member Functions" (P0848), it is
467  now possible to overload destructors using concepts. Note that the rest
468  of the paper about other special member functions is not yet implemented.
469
470C++2b Feature Support
471^^^^^^^^^^^^^^^^^^^^^
472
473- Implemented `P2128R6: Multidimensional subscript operator <https://wg21.link/P2128R6>`_.
474- Implemented `P0849R8: auto(x): decay-copy in the language <https://wg21.link/P0849R8>`_.
475- Implemented `P2242R3: Non-literal variables (and labels and gotos) in constexpr functions	<https://wg21.link/P2242R3>`_.
476
477CUDA/HIP Language Changes in Clang
478----------------------------------
479
480- Added `__noinline__` as a keyword to avoid diagnostics due to usage of
481  `__attribute__((__noinline__))` in CUDA/HIP programs.
482
483Objective-C Language Changes in Clang
484-------------------------------------
485
486OpenCL C Language Changes in Clang
487----------------------------------
488
489...
490
491ABI Changes in Clang
492--------------------
493
494- GCC doesn't pack non-POD members in packed structs unless the packed
495  attribute is also specified on the member. Clang historically did perform
496  such packing. Clang now matches the gcc behavior (except on Darwin and PS4).
497  You can switch back to the old ABI behavior with the flag:
498  ``-fclang-abi-compat=14.0``.
499- When compiling C for ARM or AArch64, a zero-length bitfield in a ``struct``
500  (e.g. ``int : 0``) no longer prevents the structure from being considered a
501  homogeneous floating-point or vector aggregate. The new behavior agrees with
502  the AAPCS specification, and matches the similar bug fix in GCC 12.1.
503- All copy constructors can now be trivial if they are not user-provided,
504  regardless of the type qualifiers of the argument of the defaulted constructor,
505  fixing dr2171.
506  You can switch back to the old ABI behavior with the flag:
507  ``-fclang-abi-compat=14.0``.
508
509OpenMP Support in Clang
510-----------------------
511
512...
513
514CUDA Support in Clang
515---------------------
516
517- ...
518
519X86 Support in Clang
520--------------------
521
522- Support ``-mharden-sls=[none|all|return|indirect-jmp]`` for straight-line
523  speculation hardening.
524- Support for the ``_Float16`` type has been added for all targets with SSE2.
525  When AVX512-FP16 is not available, arithmetic on ``_Float16`` is emulated
526  using ``float``.
527
528DWARF Support in Clang
529----------------------
530
531- clang now adds DWARF information for inline strings in C/C++ programs,
532  allowing ``line:column`` symbolization of strings. Some debugging programs may
533  require updating, as this takes advantage of DWARF ``DW_TAG_variable``
534  structures *without* a ``DW_AT_name`` field, which is valid DWARF, but may be
535  handled incorrectly by some software (e.g. new failures with incorrect
536  assertions).
537
538Arm and AArch64 Support in Clang
539--------------------------------
540
541Floating Point Support in Clang
542-------------------------------
543
544Internal API Changes
545--------------------
546
547- Added a new attribute flag ``AcceptsExprPack`` that when set allows
548  expression pack expansions in the parsed arguments of the corresponding
549  attribute. Additionally it introduces delaying of attribute arguments, adding
550  common handling for creating attributes that cannot be fully initialized
551  prior to template instantiation.
552
553Build System Changes
554--------------------
555
556* CMake ``-DCLANG_DEFAULT_PIE_ON_LINUX=ON`` is now the default. This is used by
557  linux-gnu systems to decide whether ``-fPIE -pie`` is the default (instead of
558  ``-fno-pic -no-pie``). This matches GCC installations on many Linux distros.
559  Note: linux-android and linux-musl always default to ``-fPIE -pie``, ignoring
560  this variable. ``-DCLANG_DEFAULT_PIE_ON_LINUX`` may be removed in the future.
561
562AST Matchers
563------------
564
565- Expanded ``isInline`` narrowing matcher to support C++17 inline variables.
566
567- Added ``forEachTemplateArgument`` matcher which creates a match every
568  time a ``templateArgument`` matches the matcher supplied to it.
569
570- Added ``objcStringLiteral`` matcher which matches ObjectiveC String
571  literal expressions.
572
573clang-format
574------------
575
576- **Important change**: Renamed ``IndentRequires`` to ``IndentRequiresClause``
577  and changed the default for all styles from ``false`` to ``true``.
578
579- Reworked and improved handling of concepts and requires. Added the
580  ``RequiresClausePosition`` option as part of that.
581
582- Changed ``BreakBeforeConceptDeclarations`` from ``Boolean`` to an enum.
583
584- Option ``InsertBraces`` has been added to insert optional braces after control
585  statements.
586
587libclang
588--------
589
590- ...
591
592Static Analyzer
593---------------
594- `New CTU implementation
595  <https://discourse.llvm.org/t/rfc-much-faster-cross-translation-unit-ctu-analysis-implementation/61728>`_
596  that keeps the slow-down around 2x compared to the single-TU analysis, even
597  in case of complex C++ projects. Still, it finds the majority of the "old"
598  CTU findings. Besides, not more than ~3% of the bug reports are lost compared
599  to single-TU analysis, the lost reports are highly likely to be false
600  positives.
601
602- Added a new checker ``alpha.unix.cstring.UninitializedRead`` this will check for uninitialized reads
603  from common memory copy/manipulation functions such as ``memcpy``, ``mempcpy``, ``memmove``, ``memcmp``, `
604  `strcmp``, ``strncmp``, ``strcpy``, ``strlen``, ``strsep`` and many more. Although
605  this checker currently is in list of alpha checkers due to a false positive.
606
607- Added a new checker ``alpha.unix.Errno``. This can find the first read
608  of ``errno`` after successful standard function calls, such use of ``errno``
609  could be unsafe.
610
611- Deprecate the ``-analyzer-store region`` and
612  ``-analyzer-opt-analyze-nested-blocks`` analyzer flags.
613  These flags are still accepted, but a warning will be displayed.
614  These flags will be rejected, thus turned into a hard error starting with
615  ``clang-16``.
616
617.. _release-notes-ubsan:
618
619Undefined Behavior Sanitizer (UBSan)
620------------------------------------
621
622Core Analysis Improvements
623==========================
624
625- ...
626
627New Issues Found
628================
629
630- ...
631
632Python Binding Changes
633----------------------
634
635The following methods have been added:
636
637-  ...
638
639Significant Known Problems
640==========================
641
642Additional Information
643======================
644
645A wide variety of additional information is available on the `Clang web
646page <https://clang.llvm.org/>`_. The web page contains versions of the
647API documentation which are up-to-date with the Git version of
648the source code. You can access versions of these documents specific to
649this release by going into the "``clang/docs/``" directory in the Clang
650tree.
651
652If you have any questions or comments about Clang, please feel free to
653contact us via the `mailing
654list <https://lists.llvm.org/mailman/listinfo/cfe-dev>`_.
655