Debian Codegraph @

clang/docs/ReleaseNotes.rst

raw
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 - Setting the deprecated CMake variable ``GCC_INSTALL_PREFIX`` (which sets the
41 default ``--gcc-toolchain=``) now leads to a fatal error.
42
43 C/C++ Language Potentially Breaking Changes
44 -------------------------------------------
45
46 - Clang now supports raw string literals in ``-std=gnuXY`` mode as an extension in
47 C99 and later. This behaviour can also be overridden using ``-f[no-]raw-string-literals``.
48 Support of raw string literals in C++ is not affected. Fixes (#GH85703).
49
50 C++ Specific Potentially Breaking Changes
51 -----------------------------------------
52 - Clang now diagnoses function/variable templates that shadow their own template parameters, e.g. ``template<class T> void T();``.
53 This error can be disabled via `-Wno-strict-primary-template-shadow` for compatibility with previous versions of clang.
54
55 - The behavior controlled by the `-frelaxed-template-template-args` flag is now
56 on by default, and the flag is deprecated. Until the flag is finally removed,
57 it's negative spelling can be used to obtain compatibility with previous
58 versions of clang. The deprecation warning for the negative spelling can be
59 disabled with `-Wno-deprecated-no-relaxed-template-template-args`.
60
61 - Clang no longer tries to form pointer-to-members from qualified and parenthesized unevaluated expressions
62 such as ``decltype(&(foo::bar))``. (#GH40906).
63
64 - Clang now performs semantic analysis for unary operators with dependent operands
65 that are known to be of non-class non-enumeration type prior to instantiation.
66
67 This change uncovered a bug in libstdc++ 14.1.0 which may cause compile failures
68 on systems using that version of libstdc++ and Clang 19, with an error that looks
69 something like this:
70
71 .. code-block:: text
72
73 <source>:4:5: error: expression is not assignable
74 4 | ++this;
75 | ^ ~~~~
76
77 To fix this, update libstdc++ to version 14.1.1 or greater.
78
79 ABI Changes in This Version
80 ---------------------------
81 - Fixed Microsoft name mangling of implicitly defined variables used for thread
82 safe static initialization of static local variables. This change resolves
83 incompatibilities with code compiled by MSVC but might introduce
84 incompatibilities with code compiled by earlier versions of Clang when an
85 inline member function that contains a static local variable with a dynamic
86 initializer is declared with ``__declspec(dllimport)``. (#GH83616).
87
88 - Fixed Microsoft name mangling of lifetime extended temporary objects. This
89 change corrects missing back reference registrations that could result in
90 incorrect back reference indexes and suprising demangled name results. Since
91 MSVC uses a different mangling for these objects, compatibility is not affected.
92 (#GH85423).
93
94 - Fixed Microsoft calling convention for returning certain classes with a
95 templated constructor. If a class has a templated constructor, it should
96 be returned indirectly even if it meets all the other requirements for
97 returning a class in a register. This affects some uses of std::pair.
98 (#GH86384).
99
100 - Fixed Microsoft calling convention when returning classes that have a deleted
101 copy assignment operator. Such a class should be returned indirectly.
102
103 - Removed the global alias that was pointing to AArch64 Function Multiversioning
104 ifuncs. Its purpose was to preserve backwards compatibility when the ".ifunc"
105 suffix got removed from the name mangling. The alias interacts badly with
106 GlobalOpt (see the issue #96197).
107
108 - Fixed Microsoft name mangling for auto non-type template arguments of pointer
109 type for MSVC 1920+. This change resolves incompatibilities with code compiled
110 by MSVC 1920+ but will introduce incompatibilities with code compiled by
111 earlier versions of Clang unless such code is built with the compiler option
112 `-fms-compatibility-version=19.14` to imitate the MSVC 1914 mangling behavior.
113
114 - Fixed Microsoft name mangling for auto non-type template arguments of pointer
115 to member type for MSVC 1920+. This change resolves incompatibilities with code
116 compiled by MSVC 1920+ but will introduce incompatibilities with code compiled by
117 earlier versions of Clang unless such code is built with the compiler option
118 `-fms-compatibility-version=19.14` to imitate the MSVC 1914 mangling behavior.
119 (GH#70899).
120
121 AST Dumping Potentially Breaking Changes
122 ----------------------------------------
123
124 - The text ast-dumper has improved printing of TemplateArguments.
125 - The text decl-dumper prints template parameters' trailing requires expressions now.
126
127 Clang Frontend Potentially Breaking Changes
128 -------------------------------------------
129 - Removed support for constructing on-stack ``TemplateArgumentList``\ s; interfaces should instead
130 use ``ArrayRef<TemplateArgument>`` to pass template arguments. Transitioning internal uses to
131 ``ArrayRef<TemplateArgument>`` reduces AST memory usage by 0.4% when compiling clang, and is
132 expected to show similar improvements on other workloads.
133
134 - The ``-Wgnu-binary-literal`` diagnostic group no longer controls any
135 diagnostics. Binary literals are no longer a GNU extension, they're now a C23
136 extension which is controlled via ``-pedantic`` or ``-Wc23-extensions``. Use
137 of ``-Wno-gnu-binary-literal`` will no longer silence this pedantic warning,
138 which may break existing uses with ``-Werror``.
139
140 - The normalization of 3 element target triples where ``-none-`` is the middle
141 element has changed. For example, ``armv7m-none-eabi`` previously normalized
142 to ``armv7m-none-unknown-eabi``, with ``none`` for the vendor and ``unknown``
143 for the operating system. It now normalizes to ``armv7m-unknown-none-eabi``,
144 which has ``unknown`` vendor and ``none`` operating system.
145
146 The affected triples are primarily for bare metal Arm where it is intended
147 that ``none`` means that there is no operating system. As opposed to an unknown
148 type of operating system.
149
150 This change can cause clang to not find libraries, or libraries to be built at
151 different file system locations. This can be fixed by changing your builds to
152 use the new normalized triple. However, we recommend instead getting the
153 normalized triple from clang itself, as this will make your builds more
154 robust in case of future changes::
155
156 $ clang --target=<your target triple> -print-target-triple
157 <the normalized target triple>
158
159 - The ``hasTypeLoc`` AST matcher will no longer match a ``classTemplateSpecializationDecl``;
160 existing uses should switch to ``templateArgumentLoc`` or ``hasAnyTemplateArgumentLoc`` instead.
161
162 Clang Python Bindings Potentially Breaking Changes
163 --------------------------------------------------
164 - Renamed ``CursorKind`` variant 272 from ``OMP_TEAMS_DISTRIBUTE_DIRECTIVE``
165 to ``OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE``. The previous name was incorrect, it was a duplicate
166 of variant 271.
167 - Renamed ``TypeKind`` variant 162 from ``OBJCCLASS`` to ``OBJCTYPEPARAM``.
168 The previous name was incorrect, it was a duplicate of variant 28.
169 - Refactored enum implementation, switching to the standard library `Enum` type.
170
171 What's New in Clang |release|?
172 ==============================
173 Some of the major new features and improvements to Clang are listed
174 here. Generic improvements to Clang as a whole or to its underlying
175 infrastructure are described first, followed by language-specific
176 sections with improvements to Clang's support for those languages.
177
178 - Implemented improvements to BMIs for C++20 Modules that can reduce
179 the number of rebuilds during incremental recompilation. We are seeking
180 feedback from Build System authors and other interested users, especially
181 when you feel Clang changes the BMI and misses an opportunity to avoid
182 recompilations or causes correctness issues. See StandardCPlusPlusModules
183 `StandardCPlusPlusModules <StandardCPlusPlusModules.html>`_ for more details.
184
185 - The ``\par`` documentation comment command now supports an optional
186 argument, which denotes the header of the paragraph started by
187 an instance of the ``\par`` command comment. The implementation
188 of the argument handling matches its semantics
189 `in Doxygen <https://www.doxygen.nl/manual/commands.html#cmdpar>`.
190 Namely, any text on the same line as the ``\par`` command will become
191 a header for the paragaph, and if there is no text then the command
192 will start a new paragraph.
193
194 C++ Language Changes
195 --------------------
196 - C++17 support is now completed, with the enablement of the
197 relaxed temlate template argument matching rules introduced in P0522,
198 which was retroactively applied as a defect report.
199 While the implementation already existed since Clang 4, it was turned off by
200 default, and was controlled with the `-frelaxed-template-template-args` flag.
201 In this release, we implement provisional wording for a core defect on
202 P0522 (CWG2398), which avoids the most serious compatibility issues caused
203 by it, allowing us to enable it by default in this release.
204 The flag is now deprecated, and will be removed in the next release, but can
205 still be used to turn it off and regain compatibility with previous versions
206 (#GH36505).
207 - Implemented ``_BitInt`` literal suffixes ``__wb`` or ``__WB`` as a Clang extension with ``unsigned`` modifiers also allowed. (#GH85223).
208
209 C++17 Feature Support
210 ^^^^^^^^^^^^^^^^^^^^^
211 - Clang now exposes ``__GCC_DESTRUCTIVE_SIZE`` and ``__GCC_CONSTRUCTIVE_SIZE``
212 predefined macros to support standard library implementations of
213 ``std::hardware_destructive_interference_size`` and
214 ``std::hardware_constructive_interference_size``, respectively. These macros
215 are predefined in all C and C++ language modes. The values the macros
216 expand to are not stable between releases of Clang and do not need to match
217 the values produced by GCC, so these macros should not be used from header
218 files because they may not be stable across multiple TUs (the values may vary
219 based on compiler version as well as CPU tuning). #GH60174
220
221 C++14 Feature Support
222 ^^^^^^^^^^^^^^^^^^^^^
223 - Sized deallocation is enabled by default in C++14 onwards. The user may specify
224 ``-fno-sized-deallocation`` to disable it if there are some regressions.
225
226 C++20 Feature Support
227 ^^^^^^^^^^^^^^^^^^^^^
228
229 - Clang won't perform ODR checks for decls in the global module fragment any
230 more to ease the implementation and improve the user's using experience.
231 This follows the MSVC's behavior. Users interested in testing the more strict
232 behavior can use the flag '-Xclang -fno-skip-odr-check-in-gmf'.
233 (#GH79240).
234
235 - Implemented the `__is_layout_compatible` and `__is_pointer_interconvertible_base_of`
236 intrinsics to support
237 `P0466R5: Layout-compatibility and Pointer-interconvertibility Traits <https://wg21.link/P0466R5>`_.
238
239 - Clang now implements [module.import]p7 fully. Clang now will import module
240 units transitively for the module units coming from the same module of the
241 current module units. Fixes #GH84002
242
243 - Initial support for class template argument deduction (CTAD) for type alias
244 templates (`P1814R0 <https://wg21.link/p1814r0>`_).
245 (#GH54051).
246
247 - We have sufficient confidence and experience with the concepts implementation
248 to update the ``__cpp_concepts`` macro to `202002L`. This enables
249 ``<expected>`` from libstdc++ to work correctly with Clang.
250
251 - User defined constructors are allowed for copy-list-initialization with CTAD.
252 (#GH62925).
253
254 C++23 Feature Support
255 ^^^^^^^^^^^^^^^^^^^^^
256
257 - Implemented `P2718R0: Lifetime extension in range-based for loops <https://wg21.link/P2718R0>`_. Also
258 materialize temporary object which is a prvalue in discarded-value expression.
259 - Implemented `P1774R8: Portable assumptions <https://wg21.link/P1774R8>`_.
260
261 - Implemented `P2448R2: Relaxing some constexpr restrictions <https://wg21.link/P2448R2>`_.
262 Note, the ``-Winvalid-constexpr`` diagnostic is now disabled in C++23 mode,
263 but can be explicitly specified to retain the old diagnostic checking
264 behavior.
265
266 - Added a ``__reference_converts_from_temporary`` builtin, completing the necessary compiler support for
267 `P2255R2: Type trait to determine if a reference binds to a temporary <https://wg21.link/P2255R2>`_.
268
269 - Implemented `P2797R0: Static and explicit object member functions with the same parameter-type-lists <https://wg21.link/P2797R0>`_.
270 This completes the support for "deducing this".
271
272 C++2c Feature Support
273 ^^^^^^^^^^^^^^^^^^^^^
274
275 - Implemented `P2662R3 Pack Indexing <https://wg21.link/P2662R3>`_.
276
277 - Implemented `P2573R2: = delete("should have a reason"); <https://wg21.link/P2573R2>`_
278
279 - Implemented `P0609R3: Attributes for Structured Bindings <https://wg21.link/P0609R3>`_
280
281 - Implemented `P2748R5 Disallow Binding a Returned Glvalue to a Temporary <https://wg21.link/P2748R5>`_.
282
283 - Implemented `P2809R3: Trivial infinite loops are not Undefined Behavior <https://wg21.link/P2809R3>`_.
284
285 - Implemented `P3144R2 Deleting a Pointer to an Incomplete Type Should be Ill-formed <https://wg21.link/P3144R2>`_.
286
287 - Implemented `P2963R3 Ordering of constraints involving fold expressions <https://wg21.link/P2963R3>`_.
288
289
290 Resolutions to C++ Defect Reports
291 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
292 - Substitute template parameter pack, when it is not explicitly specified
293 in the template parameters, but is deduced from a previous argument. (#GH78449)
294
295 - Type qualifications are now ignored when evaluating layout compatibility
296 of two types.
297 (`CWG1719: Layout compatibility and cv-qualification revisited <https://cplusplus.github.io/CWG/issues/1719.html>`_).
298
299 - Alignment of members is now respected when evaluating layout compatibility
300 of structs.
301 (`CWG2583: Common initial sequence should consider over-alignment <https://cplusplus.github.io/CWG/issues/2583.html>`_).
302
303 - ``[[no_unique_address]]`` is now respected when evaluating layout
304 compatibility of two types.
305 (`CWG2759: [[no_unique_address] and common initial sequence <https://cplusplus.github.io/CWG/issues/2759.html>`_).
306
307 - Clang now diagnoses declarative nested-name-specifiers with pack-index-specifiers.
308 (`CWG2858: Declarative nested-name-specifiers and pack-index-specifiers <https://cplusplus.github.io/CWG/issues/2858.html>`_).
309
310 - Clang now allows attributes on concepts.
311 (`CWG2428: Deprecating a concept <https://cplusplus.github.io/CWG/issues/2428.html>`_).
312
313 - P0522 implementation is enabled by default in all language versions, and
314 provisional wording for CWG2398 is implemented.
315
316 - Clang now performs type-only lookup for the name in ``using enum`` declaration.
317 (`CWG2877: Type-only lookup for using-enum-declarator <https://cplusplus.github.io/CWG/issues/2877.html>`_).
318
319 - Clang now requires a template argument list after a template keyword.
320 (`CWG96: Syntactic disambiguation using the template keyword <https://cplusplus.github.io/CWG/issues/96.html>`_).
321
322 - Clang now considers ``noexcept(typeid(expr))`` more carefully, instead of always assuming that ``std::bad_typeid`` can be thrown.
323 (`CWG2191: Incorrect result for noexcept(typeid(v)) <https://cplusplus.github.io/CWG/issues/2191.html>`_).
324
325 C Language Changes
326 ------------------
327
328 C2y Feature Support
329 ^^^^^^^^^^^^^^^^^^^
330 - Clang now enables C2y mode with ``-std=c2y``. This sets ``__STDC_VERSION__``
331 to ``202400L`` so that it's greater than the value for C23. The value of this
332 macro is subject to change in the future.
333
334 C23 Feature Support
335 ^^^^^^^^^^^^^^^^^^^
336 - No longer diagnose use of binary literals as an extension in C23 mode. Fixes
337 #GH72017.
338
339 - Corrected parsing behavior for the ``alignas`` specifier/qualifier in C23. We
340 previously handled it as an attribute as in C++, but there are parsing
341 differences. The behavioral differences are:
342
343 .. code-block:: c
344
345 struct alignas(8) /* was accepted, now rejected */ S {
346 char alignas(8) /* was rejected, now accepted */ C;
347 };
348 int i alignas(8) /* was accepted, now rejected */ ;
349
350 Fixes (#GH81472).
351
352 - Clang now generates predefined macros of the form ``__TYPE_FMTB__`` and
353 ``__TYPE_FMTb__`` (e.g., ``__UINT_FAST64_FMTB__``) in C23 mode for use with
354 macros typically exposed from ``<inttypes.h>``, such as ``PRIb8``. (#GH81896)
355
356 - Clang now supports `N3018 The constexpr specifier for object definitions`
357 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3018.htm>`_.
358
359 - Properly promote bit-fields of bit-precise integer types to the field's type
360 rather than to ``int``. #GH87641
361
362 - Added the ``INFINITY`` and ``NAN`` macros to Clang's ``<float.h>``
363 freestanding implementation; these macros were defined in ``<math.h>`` in C99
364 but C23 added them to ``<float.h>`` in
365 `WG14 N2848 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2848.pdf>`_.
366
367 - Clang now supports `N3017 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm>`_
368 ``#embed`` - a scannable, tooling-friendly binary resource inclusion mechanism.
369
370 - Added the ``FLT_NORM_MAX``, ``DBL_NORM_MAX``, and ``LDBL_NORM_MAX`` to the
371 freestanding implementation of ``<float.h>`` that ships with Clang.
372
373 - Compiler support for `N2653 char8_t: A type for UTF-8 characters and strings`
374 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2653.htm>`_: ``u8`` string
375 literals are now of type ``char8_t[N]`` in C23 and expose
376 ``__CLANG_ATOMIC_CHAR8_T_LOCK_FREE``/``__GCC_ATOMIC_CHAR8_T_LOCK_FREE`` to
377 implement the corresponding macro in ``<stdatomic.h>``.
378
379 Non-comprehensive list of changes in this release
380 -------------------------------------------------
381
382 - Added ``__builtin_readsteadycounter`` for reading fixed frequency hardware
383 counters.
384
385 - ``__builtin_addc``, ``__builtin_subc``, and the other sizes of those
386 builtins are now constexpr and may be used in constant expressions.
387
388 - Added ``__builtin_popcountg`` as a type-generic alternative to
389 ``__builtin_popcount{,l,ll}`` with support for any unsigned integer type. Like
390 the previous builtins, this new builtin is constexpr and may be used in
391 constant expressions.
392
393 - Lambda expressions are now accepted in C++03 mode as an extension.
394
395 - Added ``__builtin_clzg`` and ``__builtin_ctzg`` as type-generic alternatives
396 to ``__builtin_clz{,s,l,ll}`` and ``__builtin_ctz{,s,l,ll}`` respectively,
397 with support for any unsigned integer type. Like the previous builtins, these
398 new builtins are constexpr and may be used in constant expressions.
399
400 - ``__typeof_unqual__`` is available in all C modes as an extension, which behaves
401 like ``typeof_unqual`` from C23, similar to ``__typeof__`` and ``typeof``.
402
403 - ``__builtin_reduce_{add|mul|xor|or|and|min|max}`` builtins now support scalable vectors.
404
405 * Shared libraries linked with either the ``-ffast-math``, ``-Ofast``, or
406 ``-funsafe-math-optimizations`` flags will no longer enable flush-to-zero
407 floating-point mode by default. This decision can be overridden with use of
408 ``-mdaz-ftz``. This behavior now matches GCC's behavior.
409 (`#57589 <https://github.com/llvm/llvm-project/issues/57589>`_)
410
411 * ``-fdenormal-fp-math=preserve-sign`` is no longer implied by ``-ffast-math``
412 on x86 systems.
413
414 - Builtins ``__builtin_shufflevector()`` and ``__builtin_convertvector()`` may
415 now be used within constant expressions.
416
417 - When compiling a constexpr function, Clang will check to see whether the
418 function can *never* be used in a constant expression context and issues a
419 diagnostic under the ``-Winvalid-constexpr`` diagostic flag (which defaults
420 to an error). This check can be expensive because the mere presence of a
421 function marked ``constexpr`` will cause us to undergo constant expression
422 evaluation, even if the function is not called within the translation unit
423 being compiled. Due to the expense, Clang no longer checks constexpr function
424 bodies when the function is defined in a system header file or when
425 ``-Winvalid-constexpr`` is not enabled for the function definition, which
426 should result in mild compile-time performance improvements.
427
428 - Added ``__is_bitwise_cloneable`` which is used to check whether a type
429 can be safely copied by memcpy/memmove.
430
431 - ``#pragma GCC diagnostic warning "-Wfoo"`` can now downgrade ``-Werror=foo``
432 errors and certain default-to-error ``-W`` diagnostics to warnings.
433
434 - Support importing C++20 modules in clang-repl.
435
436 - Added support for ``TypeLoc::dump()`` for easier debugging, and improved
437 textual and JSON dumping for various ``TypeLoc``-related nodes.
438
439 - Clang can now emit distinct type-based alias analysis tags for incompatible
440 pointers, enabling more powerful alias analysis when accessing pointer types.
441 The new behavior can be enabled using ``-fpointer-tbaa``.
442
443 - The ``__atomic_always_lock_free`` and ``__atomic_is_lock_free``
444 builtins may now return true if the pointer argument is a
445 compile-time constant (e.g. ``(void*)4``), and constant pointer is
446 sufficiently-aligned for the access requested. Previously, only the
447 type of the pointer was taken into account. This improves
448 compatibility with GCC's libstdc++.
449
450 - The type traits builtin ``__is_nullptr`` is deprecated in CLang 19 and will be
451 removed in Clang 20. ``__is_same(__remove_cv(T), decltype(nullptr))`` can be
452 used instead to check whether a type ``T`` is a ``nullptr``.
453
454 New Compiler Flags
455 ------------------
456 - ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and
457 sign change.
458 - ``-fsanitize=implicit-integer-conversion`` a group that replaces the previous
459 group ``-fsanitize=implicit-conversion``.
460
461 - ``-Wmissing-designated-field-initializers``, grouped under ``-Wmissing-field-initializers``.
462 This diagnostic can be disabled to make ``-Wmissing-field-initializers`` behave
463 like it did before Clang 18.x. Fixes #GH56628
464
465 - ``-fexperimental-modules-reduced-bmi`` enables the Reduced BMI for C++20 named modules.
466 See the document of standard C++ modules for details.
467
468 - ``-fexperimental-late-parse-attributes`` enables an experimental feature to
469 allow late parsing certain attributes in specific contexts where they would
470 not normally be late parsed. Currently this allows late parsing the
471 `counted_by` attribute in C. See `Attribute Changes in Clang`_.
472
473 - ``-fseparate-named-sections`` uses separate unique sections for global
474 symbols in named special sections (i.e. symbols annotated with
475 ``__attribute__((section(...)))``. This enables linker GC to collect unused
476 symbols without having to use a per-symbol section.
477
478 - ``-fms-define-stdc`` and its clang-cl counterpart ``/Zc:__STDC__``.
479 Matches MSVC behaviour by defining ``__STDC__`` to ``1`` when
480 MSVC compatibility mode is used. It has no effect for C++ code.
481
482 - ``-Wc++23-compat`` group was added to help migrating existing codebases
483 to C++23.
484
485 - ``-Wc++2c-compat`` group was added to help migrating existing codebases
486 to upcoming C++26.
487
488 - ``-fdisable-block-signature-string`` instructs clang not to emit the signature
489 string for blocks. Disabling the string can potentially break existing code
490 that relies on it. Users should carefully consider this possibiilty when using
491 the flag.
492
493 - For the ARM target, added ``-Warm-interrupt-vfp-clobber`` that will emit a
494 diagnostic when an interrupt handler is declared and VFP is enabled.
495
496 - ``-fpointer-tbaa`` enables emission of distinct type-based alias
497 analysis tags for incompatible pointers.
498
499 Deprecated Compiler Flags
500 -------------------------
501
502 - The ``-Ofast`` command-line option has been deprecated. This option both
503 enables the ``-O3`` optimization-level, as well as enabling non-standard
504 ``-ffast-math`` behaviors. As such, it is somewhat misleading as an
505 "optimization level". Users are advised to switch to ``-O3 -ffast-math`` if
506 the use of non-standard math behavior is intended, and ``-O3`` otherwise.
507 See `RFC <https://discourse.llvm.org/t/rfc-deprecate-ofast/78687>`_ for details.
508
509 Modified Compiler Flags
510 -----------------------
511 - Added a new diagnostic flag ``-Wreturn-mismatch`` which is grouped under
512 ``-Wreturn-type``, and moved some of the diagnostics previously controlled by
513 ``-Wreturn-type`` under this new flag. Fixes #GH72116.
514 - ``-fsanitize=implicit-conversion`` is now a group for both
515 ``-fsanitize=implicit-integer-conversion`` and
516 ``-fsanitize=implicit-bitfield-conversion``.
517
518 - Added ``-Wcast-function-type-mismatch`` under the ``-Wcast-function-type``
519 warning group. Moved the diagnostic previously controlled by
520 ``-Wcast-function-type`` to the new warning group and added
521 ``-Wcast-function-type-mismatch`` to ``-Wextra``. #GH76872
522
523 .. code-block:: c
524
525 int x(long);
526 typedef int (f2)(void*);
527 typedef int (f3)();
528
529 void func(void) {
530 // Diagnoses under -Wcast-function-type, -Wcast-function-type-mismatch,
531 // -Wcast-function-type-strict, -Wextra
532 f2 *b = (f2 *)x;
533 // Diagnoses under -Wcast-function-type, -Wcast-function-type-strict
534 f3 *c = (f3 *)x;
535 }
536
537 - Carved out ``-Wformat`` warning about scoped enums into a subwarning and
538 make it controlled by ``-Wformat-pedantic``. Fixes #GH88595.
539
540 - Trivial infinite loops (i.e loops with a constant controlling expresion
541 evaluating to ``true`` and an empty body such as ``while(1);``)
542 are considered infinite, even when the ``-ffinite-loop`` flag is set.
543
544 - Diagnostics groups about compatibility with a particular C++ Standard version
545 now include dianostics about C++26 features that are not present in older
546 versions.
547
548 - Removed the "arm interrupt calling convention" warning that was included in
549 ``-Wextra`` without its own flag. This warning suggested adding
550 ``__attribute__((interrupt))`` to functions that are called from interrupt
551 handlers to prevent clobbering VFP registers. Following this suggestion leads
552 to unpredictable behavior by causing multiple exception returns from one
553 exception. Fixes #GH34876.
554
555 Removed Compiler Flags
556 -------------------------
557
558 - The ``-freroll-loops`` flag has been removed. It had no effect since Clang 13.
559 - ``-m[no-]unaligned-access`` is removed for RISC-V and LoongArch.
560 ``-m[no-]strict-align``, also supported by GCC, should be used instead. (#GH85350)
561
562 Attribute Changes in Clang
563 --------------------------
564 - Introduced a new function attribute ``__attribute__((amdgpu_max_num_work_groups(x, y, z)))`` or
565 ``[[clang::amdgpu_max_num_work_groups(x, y, z)]]`` for the AMDGPU target. This attribute can be
566 attached to HIP or OpenCL kernel function definitions to provide an optimization hint. The parameters
567 ``x``, ``y``, and ``z`` specify the maximum number of workgroups for the respective dimensions,
568 and each must be a positive integer when provided. The parameter ``x`` is required, while ``y`` and
569 ``z`` are optional with default value of 1.
570
571 - The ``swiftasynccc`` attribute is now considered to be a Clang extension
572 rather than a language standard feature. Please use
573 ``__has_extension(swiftasynccc)`` to check the availability of this attribute
574 for the target platform instead of ``__has_feature(swiftasynccc)``. Also,
575 added a new extension query ``__has_extension(swiftcc)`` corresponding to the
576 ``__attribute__((swiftcc))`` attribute.
577
578 - The ``_Nullable`` and ``_Nonnull`` family of type attributes can now apply
579 to certain C++ class types, such as smart pointers:
580 ``void useObject(std::unique_ptr<Object> _Nonnull obj);``.
581
582 This works for standard library types including ``unique_ptr``, ``shared_ptr``,
583 and ``function``. See
584 `the attribute reference documentation <https://llvm.org/docs/AttributeReference.html#nullability-attributes>`_
585 for the full list.
586
587 - The ``_Nullable`` attribute can be applied to C++ class declarations:
588 ``template <class T> class _Nullable MySmartPointer {};``.
589
590 This allows the ``_Nullable`` and ``_Nonnull`` family of type attributes to
591 apply to this class.
592
593 - Clang now warns that the ``exclude_from_explicit_instantiation`` attribute
594 is ignored when applied to a local class or a member thereof.
595
596 - The ``clspv_libclc_builtin`` attribute has been added to allow clspv
597 (`OpenCL-C to Vulkan SPIR-V compiler <https://github.com/google/clspv>`_) to identify functions coming from libclc
598 (`OpenCL-C builtin library <https://libclc.llvm.org>`_).
599 - The ``counted_by`` attribute is now allowed on pointers that are members of a
600 struct in C.
601
602 - The ``counted_by`` attribute can now be late parsed in C when
603 ``-fexperimental-late-parse-attributes`` is passed but only when attribute is
604 used in the declaration attribute position. This allows using the
605 attribute on existing code where it previously impossible to do so without
606 re-ordering struct field declarations would break ABI as shown below.
607
608 .. code-block:: c
609
610 struct BufferTy {
611 /* Refering to `count` requires late parsing */
612 char* buffer __counted_by(count);
613 /* Swapping `buffer` and `count` to avoid late parsing would break ABI */
614 size_t count;
615 };
616
617 - The attributes ``sized_by``, ``counted_by_or_null`` and ``sized_by_or_null```
618 have been added as variants on ``counted_by``, each with slightly different semantics.
619 ``sized_by`` takes a byte size parameter instead of an element count, allowing pointees
620 with unknown size. The ``counted_by_or_null`` and ``sized_by_or_null`` variants are equivalent
621 to their base variants, except the pointer can be null regardless of count/size value.
622 If the pointer is null the size is effectively 0. ``sized_by_or_null`` is needed to properly
623 annotate allocator functions like ``malloc`` that return a buffer of a given byte size, but can
624 also return null.
625
626 - The ``guarded_by``, ``pt_guarded_by``, ``acquired_after``, ``acquired_before``
627 attributes now support referencing struct members in C. The arguments are also
628 now late parsed when ``-fexperimental-late-parse-attributes`` is passed like
629 for ``counted_by``.
630
631 - Introduced new function type attributes ``[[clang::nonblocking]]``, ``[[clang::nonallocating]]``,
632 ``[[clang::blocking]]``, and ``[[clang::allocating]]``, with GNU-style variants as well.
633 The attributes declare constraints about a function's behavior pertaining to blocking and
634 heap memory allocation.
635
636 - The ``hybrid_patchable`` attribute is now supported on ARM64EC targets. It can be used to specify
637 that a function requires an additional x86-64 thunk, which may be patched at runtime.
638
639 Improvements to Clang's diagnostics
640 -----------------------------------
641 - Clang now emits an error instead of a warning for ``-Wundefined-internal``
642 when compiling with `-pedantic-errors` to conform to the C standard
643
644 - Clang now applies syntax highlighting to the code snippets it
645 prints.
646
647 - Clang now diagnoses member template declarations with multiple declarators.
648
649 - Clang now diagnoses use of the ``template`` keyword after declarative nested
650 name specifiers.
651
652 - The ``-Wshorten-64-to-32`` diagnostic is now grouped under ``-Wimplicit-int-conversion`` instead
653 of ``-Wconversion``. Fixes #GH69444.
654
655 - Clang now uses thousand separators when printing large numbers in integer overflow diagnostics.
656 Fixes #GH80939.
657
658 - Clang now diagnoses friend declarations with an ``enum`` elaborated-type-specifier in language modes after C++98.
659
660 - Added diagnostics for C11 keywords being incompatible with language standards
661 before C11, under a new warning group: ``-Wpre-c11-compat``.
662
663 - Now diagnoses an enumeration constant whose value is larger than can be
664 represented by ``unsigned long long``, which can happen with a large constant
665 using the ``wb`` or ``uwb`` suffix. The maximal underlying type is currently
666 ``unsigned long long``, but this behavior may change in the future when Clang
667 implements
668 `WG14 N3029 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3029.htm>`_.
669 (#GH69352).
670
671 - Clang now diagnoses extraneous template parameter lists as a language extension.
672
673 - Clang now diagnoses declarative nested name specifiers that name alias templates.
674
675 - Clang now diagnoses lambda function expressions being implicitly cast to boolean values, under ``-Wpointer-bool-conversion``.
676 Fixes #GH82512.
677
678 - Clang now provides improved warnings for the ``cleanup`` attribute to detect misuse scenarios,
679 such as attempting to call ``free`` on an unallocated object. Fixes #GH79443.
680
681 - Clang no longer warns when the ``bitand`` operator is used with boolean
682 operands, distinguishing it from potential typographical errors or unintended
683 bitwise operations. Fixes #GH77601.
684
685 - Clang now correctly diagnoses no arguments to a variadic macro parameter as a C23/C++20 extension.
686 Fixes #GH84495.
687
688 - Clang no longer emits a ``-Wexit-time destructors`` warning on static variables explicitly
689 annotated with the ``clang::always_destroy`` attribute.
690 Fixes #GH68686, #GH86486
691
692 - ``-Wmicrosoft``, ``-Wgnu``, or ``-pedantic`` is now required to diagnose C99
693 flexible array members in a union or alone in a struct. Fixes GH#84565.
694
695 - Clang now no longer diagnoses type definitions in ``offsetof`` in C23 mode.
696 Fixes #GH83658.
697
698 - New ``-Wformat-signedness`` diagnostic that warn if the format string requires an
699 unsigned argument and the argument is signed and vice versa.
700
701 - Clang now emits ``unused argument`` warning when the -fmodule-output flag is used
702 with an input that is not of type c++-module.
703
704 - Clang emits a ``-Wreturn-stack-address`` warning if a function returns a pointer or
705 reference to a struct literal. Fixes #GH8678
706
707 - Clang emits a ``-Wunused-but-set-variable`` warning on C++ variables whose declaration
708 (with initializer) entirely consist the condition expression of a if/while/for construct
709 but are not actually used in the body of the if/while/for construct. Fixes #GH41447
710
711 - Clang emits a diagnostic when a tentative array definition is assumed to have
712 a single element, but that diagnostic was never given a diagnostic group.
713 Added the ``-Wtentative-definition-array`` warning group to cover this.
714 Fixes #GH87766
715
716 - Clang now uses the correct type-parameter-key (``class`` or ``typename``) when printing
717 template template parameter declarations.
718
719 - Clang now diagnoses requires expressions with explicit object parameters.
720
721 - Clang now looks up members of the current instantiation in the template definition context
722 if the current instantiation has no dependent base classes.
723
724 .. code-block:: c++
725
726 template<typename T>
727 struct A {
728 int f() {
729 return this->x; // error: no member named 'x' in 'A<T>'
730 }
731 };
732
733 - Clang emits a ``-Wparentheses`` warning for expressions with consecutive comparisons like ``x < y < z``.
734 Fixes #GH20456.
735
736 - Clang no longer emits a "declared here" note for a builtin function that has no declaration in source.
737 Fixes #GH93369.
738
739 - Clang now has an improved error message for captures that refer to a class member.
740 Fixes #GH94764.
741
742 - Clang now diagnoses unsupported class declarations for ``std::initializer_list<E>`` when they are
743 used rather than when they are needed for constant evaluation or when code is generated for them.
744 The check is now stricter to prevent crashes for some unsupported declarations (Fixes #GH95495).
745
746 - Clang now diagnoses dangling cases where a pointer is assigned to a temporary
747 that will be destroyed at the end of the full expression.
748 Fixes #GH54492.
749
750 - Clang now shows implicit deduction guides when diagnosing overload resolution failure. #GH92393.
751
752 - Clang no longer emits a "no previous prototype" warning for Win32 entry points under ``-Wmissing-prototypes``.
753 Fixes #GH94366.
754
755 - For the ARM target, calling an interrupt handler from another function is now an error. #GH95359.
756
757 - Clang now diagnoses integer constant expressions that are folded to a constant value as an extension in more circumstances. Fixes #GH59863
758
759 - Clang now diagnoses dangling assignments for pointer-like objects (annotated with `[[gsl::Pointer]]`) under `-Wdangling-assignment-gsl` (off by default)
760 Fixes #GH63310.
761
762 - Clang now diagnoses uses of alias templates with a deprecated attribute. (Fixes #GH18236).
763
764 .. code-block:: c++
765
766 template <typename T>
767 struct NoAttr {
768 };
769
770 template <typename T>
771 using UsingWithAttr __attribute__((deprecated)) = NoAttr<T>;
772
773 UsingWithAttr<int> objUsingWA; // warning: 'UsingWithAttr' is deprecated
774
775 - Clang now diagnoses undefined behavior in constant expressions more consistently. This includes invalid shifts, and signed overflow in arithmetic.
776
777 - Clang now diagnoses dangling references to fields of temporary objects. Fixes #GH81589.
778
779
780 Improvements to Clang's time-trace
781 ----------------------------------
782
783 - Clang now specifies that using ``auto`` in a lambda parameter is a C++14 extension when
784 appropriate. (`#46059: <https://github.com/llvm/llvm-project/issues/46059>`_).
785
786 - Clang now adds source file infomation for template instantiations as ``event["args"]["filename"]``. This
787 added behind an option ``-ftime-trace-verbose``. This is expected to increase the size of trace by 2-3 times.
788
789 Improvements to Coverage Mapping
790 --------------------------------
791
792 - Macros defined in system headers are not expanded in coverage
793 mapping. Conditional expressions in system header macros are no
794 longer taken into account for branch coverage. They can be included
795 with ``-mllvm -system-headers-coverage``.
796 (`#78920: <https://github.com/llvm/llvm-project/issues/78920>`_)
797 - MC/DC Coverage has been improved.
798 (`#82448: <https://github.com/llvm/llvm-project/pull/82448>`_)
799
800 - The maximum number of conditions is no longer limited to 6. See
801 `this <SourceBasedCodeCoverage.html#mc-dc-instrumentation>` for
802 more details.
803
804 Bug Fixes in This Version
805 -------------------------
806 - Clang's ``-Wundefined-func-template`` no longer warns on pure virtual
807 functions. (#GH74016)
808
809 - Fixed missing warnings when comparing mismatched enumeration constants
810 in C (#GH29217)
811
812 - Clang now accepts elaborated-type-specifiers that explicitly specialize
813 a member class template for an implicit instantiation of a class template.
814
815 - Fixed missing warnings when doing bool-like conversions in C23 (#GH79435).
816 - Clang's ``-Wshadow`` no longer warns when an init-capture is named the same as
817 a class field unless the lambda can capture this.
818 Fixes (#GH71976)
819
820 - Clang now accepts qualified partial/explicit specializations of variable templates that
821 are not nominable in the lookup context of the specialization.
822
823 - Clang now doesn't produce false-positive warning `-Wconstant-logical-operand`
824 for logical operators in C23.
825 Fixes (#GH64356).
826
827 - ``__is_trivially_relocatable`` no longer returns ``false`` for volatile-qualified types.
828 Fixes (#GH77091).
829
830 - Clang no longer produces a false-positive `-Wunused-variable` warning
831 for variables created through copy initialization having side-effects in C++17 and later.
832 Fixes (#GH64356) (#GH79518).
833
834 - Fix value of predefined macro ``__FUNCTION__`` in MSVC compatibility mode.
835 Fixes (#GH66114).
836
837 - Clang now emits errors for explicit specializations/instatiations of lambda call
838 operator.
839 Fixes (#GH83267).
840
841 - Fix crash on ill-formed partial specialization with CRTP.
842 Fixes (#GH89374).
843
844 - Clang now correctly generates overloads for bit-precise integer types for
845 builtin operators in C++. Fixes #GH82998.
846
847 - Fix crash when destructor definition is preceded with an equals sign.
848 Fixes (#GH89544).
849
850 - When performing mixed arithmetic between ``_Complex`` floating-point types and integers,
851 Clang now correctly promotes the integer to its corresponding real floating-point
852 type only rather than to the complex type (e.g. ``_Complex float / int`` is now evaluated
853 as ``_Complex float / float`` rather than ``_Complex float / _Complex float``), as mandated
854 by the C standard. This significantly improves codegen of `*` and `/` especially.
855 Fixes #GH31205.
856
857 - Fixes an assertion failure on invalid code when trying to define member
858 functions in lambdas.
859
860 - Fixed a regression in CTAD that a friend declaration that befriends itself may cause
861 incorrect constraint substitution. (#GH86769).
862
863 - Fixed an assertion failure on invalid InitListExpr in C89 mode (#GH88008).
864
865 - Fixed missing destructor calls when we branch from middle of an expression.
866 This could happen through a branch in stmt-expr or in an expression containing a coroutine
867 suspension. Fixes (#GH63818) (#GH88478).
868
869 - Clang will no longer diagnose an erroneous non-dependent ``switch`` condition
870 during instantiation, and instead will only diagnose it once, during checking
871 of the function template.
872
873 - Clang now allows the value of unroll count to be zero in ``#pragma GCC unroll`` and ``#pragma unroll``.
874 The values of 0 and 1 block any unrolling of the loop. This keeps the same behavior with GCC.
875 Fixes (`#88624 <https://github.com/llvm/llvm-project/issues/88624>`_).
876
877 - Clang will no longer emit a duplicate -Wunused-value warning for an expression
878 `(A, B)` which evaluates to glvalue `B` that can be converted to non ODR-use. (#GH45783)
879
880 - Clang now correctly disallows VLA type compound literals, e.g. ``(int[size]){}``,
881 as the C standard mandates. (#GH89835)
882
883 - ``__is_array`` and ``__is_bounded_array`` no longer return ``true`` for
884 zero-sized arrays. Fixes (#GH54705).
885
886 - Correctly reject declarations where a statement is required in C.
887 Fixes #GH92775
888
889 - Fixed `static_cast` to array of unknown bound. Fixes (#GH62863).
890
891 - Fixed Clang crashing when failing to perform some C++ Initialization Sequences. (#GH98102)
892
893 - ``__is_trivially_equality_comparable`` no longer returns true for types which
894 have a constrained defaulted comparison operator (#GH89293).
895
896 - Fixed Clang from generating dangling StringRefs when deserializing Exprs & Stmts (#GH98667)
897
898 - ``__has_unique_object_representations`` correctly handles arrays of unknown bounds of
899 types by ensuring they are complete and instantiating them if needed. Fixes (#GH95311).
900
901 - ``typeof_unqual`` now properly removes type qualifiers from arrays and their element types. (#GH92667)
902
903 - Fixed an assertion failure when a template non-type parameter contains
904 an invalid expression.
905
906 - Fixed the definition of ``ATOMIC_FLAG_INIT`` in ``<stdatomic.h>`` so it can
907 be used in C++.
908
909 Bug Fixes to Compiler Builtins
910 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
911
912 - Fix crash when atomic builtins are called with pointer to zero-size struct (#GH90330)
913
914 - Clang now allows pointee types of atomic builtin arguments to be complete template types
915 that was not instantiated elsewhere.
916
917 Bug Fixes to Attribute Support
918 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
919
920 Bug Fixes to C++ Support
921 ^^^^^^^^^^^^^^^^^^^^^^^^
922
923 - Fix crash when calling the constructor of an invalid class.
924 (#GH10518) (#GH67914) (#GH78388)
925 - Fix crash when using lifetimebound attribute in function with trailing return.
926 (#GH73619)
927 - Addressed an issue where constraints involving injected class types are perceived
928 distinct from its specialization types. (#GH56482)
929 - Fixed a bug where variables referenced by requires-clauses inside
930 nested generic lambdas were not properly injected into the constraint scope. (#GH73418)
931 - Fixed a crash where substituting into a requires-expression that refers to function
932 parameters during the equivalence determination of two constraint expressions.
933 (#GH74447)
934 - Fixed deducing auto& from const int in template parameters of partial
935 specializations. (#GH77189)
936 - Fix for crash when using a erroneous type in a return statement.
937 (#GH63244) (#GH79745)
938 - Fixed an out-of-bounds error caused by building a recovery expression for ill-formed
939 function calls while substituting into constraints. (#GH58548)
940 - Fix incorrect code generation caused by the object argument
941 of ``static operator()`` and ``static operator[]`` calls not being evaluated. (#GH67976)
942 - Fix crash and diagnostic with const qualified member operator new.
943 Fixes (#GH79748)
944 - Fixed a crash where substituting into a requires-expression that involves parameter packs
945 during the equivalence determination of two constraint expressions. (#GH72557)
946 - Fix a crash when specializing an out-of-line member function with a default
947 parameter where we did an incorrect specialization of the initialization of
948 the default parameter. (#GH68490)
949 - Fix a crash when trying to call a varargs function that also has an explicit object parameter.
950 Fixes (#GH80971)
951 - Reject explicit object parameters on `new` and `delete` operators. (#GH82249)
952 - Fix a crash when trying to call a varargs function that also has an explicit object parameter. (#GH80971)
953 - Fixed a bug where abbreviated function templates would append their invented template parameters to
954 an empty template parameter lists.
955 - Fix parsing of abominable function types inside type traits. Fixes #GH77585
956 - Clang now classifies aggregate initialization in C++17 and newer as constant
957 or non-constant more accurately. Previously, only a subset of the initializer
958 elements were considered, misclassifying some initializers as constant. Partially fixes
959 #GH80510.
960 - Clang now ignores top-level cv-qualifiers on function parameters in template partial orderings. (#GH75404)
961 - No longer reject valid use of the ``_Alignas`` specifier when declaring a
962 local variable, which is supported as a C11 extension in C++. Previously, it
963 was only accepted at namespace scope but not at local function scope.
964 - Clang no longer tries to call consteval constructors at runtime when they appear in a member initializer. (#GH82154)
965 - Fix crash when using an immediate-escalated function at global scope. (#GH82258)
966 - Correctly immediate-escalate lambda conversion functions. (#GH82258)
967 - Fixed an issue where template parameters of a nested abbreviated generic lambda within
968 a requires-clause lie at the same depth as those of the surrounding lambda. This,
969 in turn, results in the wrong template argument substitution during constraint checking.
970 (#GH78524)
971 - Clang no longer instantiates the exception specification of discarded candidate function
972 templates when determining the primary template of an explicit specialization.
973 - Fixed a crash in Microsoft compatibility mode where unqualified dependent base class
974 lookup searches the bases of an incomplete class.
975 - Fix a crash when an unresolved overload set is encountered on the RHS of a ``.*`` operator.
976 (#GH53815)
977 - In ``__restrict``-qualified member functions, attach ``__restrict`` to the pointer type of
978 ``this`` rather than the pointee type.
979 Fixes (#GH82941), (#GH42411) and (#GH18121).
980 - Clang now properly reports supported C++11 attributes when using
981 ``__has_cpp_attribute`` and parses attributes with arguments in C++03 (#GH82995)
982 - Clang now properly diagnoses missing 'default' template arguments on a variety
983 of templates. Previously we were diagnosing on any non-function template
984 instead of only on class, alias, and variable templates, as last updated by
985 CWG2032. Fixes (#GH83461)
986 - Fixed an issue where an attribute on a declarator would cause the attribute to
987 be destructed prematurely. This fixes a pair of Chromium that were brought to
988 our attention by an attempt to fix in (#GH77703). Fixes (#GH83385).
989 - Fix evaluation of some immediate calls in default arguments.
990 Fixes (#GH80630)
991 - Fixed an issue where the ``RequiresExprBody`` was involved in the lambda dependency
992 calculation. (#GH56556), (#GH82849).
993 - Fix a bug where overload resolution falsely reported an ambiguity when it was comparing
994 a member-function against a non member function or a member-function with an
995 explicit object parameter against a member function with no explicit object parameter
996 when one of the function had more specialized templates. Fixes #GH82509 and #GH74494
997 - Clang now supports direct lambda calls inside of a type alias template declarations.
998 This addresses (#GH70601), (#GH76674), (#GH79555), (#GH81145) and (#GH82104).
999 - Allow access to a public template alias declaration that refers to friend's
1000 private nested type. (#GH25708).
1001 - Fixed a crash in constant evaluation when trying to access a
1002 captured ``this`` pointer in a lambda with an explicit object parameter.
1003 Fixes (#GH80997)
1004 - Fix an issue where missing set friend declaration in template class instantiation.
1005 Fixes (#GH84368).
1006 - Fixed a crash while checking constraints of a trailing requires-expression of a lambda, that the
1007 expression references to an entity declared outside of the lambda. (#GH64808)
1008 - Clang's __builtin_bit_cast will now produce a constant value for records with empty bases. See:
1009 (#GH82383)
1010 - Fix a crash when instantiating a lambda that captures ``this`` outside of its context. Fixes (#GH85343).
1011 - Fix an issue where a namespace alias could be defined using a qualified name (all name components
1012 following the first `::` were ignored).
1013 - Fix an out-of-bounds crash when checking the validity of template partial specializations. (part of #GH86757).
1014 - Fix an issue caused by not handling invalid cases when substituting into the parameter mapping of a constraint. Fixes (#GH86757).
1015 - Fixed a bug that prevented member function templates of class templates declared with a deduced return type
1016 from being explicitly specialized for a given implicit instantiation of the class template.
1017 - Fixed a crash when ``this`` is used in a dependent class scope function template specialization
1018 that instantiates to a static member function.
1019 - Fix crash when inheriting from a cv-qualified type. Fixes #GH35603
1020 - Fix a crash when the using enum declaration uses an anonymous enumeration. Fixes (#GH86790).
1021 - Handled an edge case in ``getFullyPackExpandedSize`` so that we now avoid a false-positive diagnostic. (#GH84220)
1022 - Clang now correctly tracks type dependence of by-value captures in lambdas with an explicit
1023 object parameter.
1024 Fixes (#GH70604), (#GH79754), (#GH84163), (#GH84425), (#GH86054), (#GH86398), and (#GH86399).
1025 - Fix a crash when deducing ``auto`` from an invalid dereference (#GH88329).
1026 - Fix a crash in requires expression with templated base class member function. Fixes (#GH84020).
1027 - Fix a crash caused by defined struct in a type alias template when the structure
1028 has fields with dependent type. Fixes (#GH75221).
1029 - Fix the Itanium mangling of lambdas defined in a member of a local class (#GH88906)
1030 - Fixed a crash when trying to evaluate a user-defined ``static_assert`` message whose ``size()``
1031 function returns a large or negative value. Fixes (#GH89407).
1032 - Fixed a use-after-free bug in parsing of type constraints with default arguments that involve lambdas. (#GH67235)
1033 - Fixed bug in which the body of a consteval lambda within a template was not parsed as within an
1034 immediate function context.
1035 - Fix CTAD for ``std::initializer_list``. This allows ``std::initializer_list{1, 2, 3}`` to be deduced as
1036 ``std::initializer_list<int>`` as intended.
1037 - Fix a bug on template partial specialization whose template parameter is `decltype(auto)`.
1038 - Fix a bug on template partial specialization with issue on deduction of nontype template parameter
1039 whose type is `decltype(auto)`. Fixes (#GH68885).
1040 - Clang now correctly treats the noexcept-specifier of a friend function to be a complete-class context.
1041 - Fix an assertion failure when parsing an invalid members of an anonymous class. (#GH85447)
1042 - Fixed a misuse of ``UnresolvedLookupExpr`` for ill-formed templated expressions. Fixes (#GH48673), (#GH63243)
1043 and (#GH88832).
1044 - Clang now defers all substitution into the exception specification of a function template specialization
1045 until the noexcept-specifier is instantiated.
1046 - Fix a crash when an implicitly declared ``operator==`` function with a trailing requires-clause has its
1047 constraints compared to that of another declaration.
1048 - Fix a bug where explicit specializations of member functions/function templates would have substitution
1049 performed incorrectly when checking constraints. Fixes (#GH90349).
1050 - Clang now allows constrained member functions to be explicitly specialized for an implicit instantiation
1051 of a class template.
1052 - Fix a C++23 bug in implementation of P2564R3 which evaluates immediate invocations in place
1053 within initializers for variables that are usable in constant expressions or are constant
1054 initialized, rather than evaluating them as a part of the larger manifestly constant evaluated
1055 expression.
1056 - Fix a bug in access control checking due to dealyed checking of friend declaration. Fixes (#GH12361).
1057 - Correctly treat the compound statement of an ``if consteval`` as an immediate context. Fixes (#GH91509).
1058 - When partial ordering alias templates against template template parameters,
1059 allow pack expansions when the alias has a fixed-size parameter list. Fixes (#GH62529).
1060 - Clang now ignores template parameters only used within the exception specification of candidate function
1061 templates during partial ordering when deducing template arguments from a function declaration or when
1062 taking the address of a function template.
1063 - Fix a bug with checking constrained non-type template parameters for equivalence. Fixes (#GH77377).
1064 - Fix a bug where the last argument was not considered when considering the most viable function for
1065 explicit object argument member functions. Fixes (#GH92188).
1066 - Fix a C++11 crash when a non-const non-static member function is defined out-of-line with
1067 the ``constexpr`` specifier. Fixes (#GH61004).
1068 - Clang no longer transforms dependent qualified names into implicit class member access expressions
1069 until it can be determined whether the name is that of a non-static member.
1070 - Clang now correctly diagnoses when the current instantiation is used as an incomplete base class.
1071 - Clang no longer treats ``constexpr`` class scope function template specializations of non-static members
1072 as implicitly ``const`` in language modes after C++11.
1073 - Fixed a crash when trying to emit captures in a lambda call operator with an explicit object
1074 parameter that is called on a derived type of the lambda.
1075 Fixes (#GH87210), (GH89541).
1076 - Clang no longer tries to check if an expression is immediate-escalating in an unevaluated context.
1077 Fixes (#GH91308).
1078 - Fix a crash caused by a regression in the handling of ``source_location``
1079 in dependent contexts. Fixes (#GH92680).
1080 - Fixed a crash when diagnosing failed conversions involving template parameter
1081 packs. (#GH93076)
1082 - Fixed a regression introduced in Clang 18 causing a static function overloading a non-static function
1083 with the same parameters not to be diagnosed. (Fixes #GH93456).
1084 - Clang now diagnoses unexpanded parameter packs in attributes. (Fixes #GH93269).
1085 - Clang now allows ``@$``` in raw string literals. Fixes (#GH93130).
1086 - Fix an assertion failure when checking invalid ``this`` usage in the wrong context. (Fixes #GH91536).
1087 - Clang no longer models dependent NTTP arguments as ``TemplateParamObjectDecl`` s. Fixes (#GH84052).
1088 - Fix incorrect merging of modules which contain using declarations which shadow
1089 other declarations. This could manifest as ODR checker false positives.
1090 Fixes (`#80252 <https://github.com/llvm/llvm-project/issues/80252>`_)
1091 - Fix a regression introduced in Clang 18 causing incorrect overload resolution in the presence of functions only
1092 differering by their constraints when only one of these function was variadic.
1093 - Fix a crash when a variable is captured by a block nested inside a lambda. (Fixes #GH93625).
1094 - Fixed a type constraint substitution issue involving a generic lambda expression. (#GH93821)
1095 - Fix a crash caused by improper use of ``__array_extent``. (#GH80474)
1096 - Fixed several bugs in capturing variables within unevaluated contexts. (#GH63845), (#GH67260), (#GH69307),
1097 (#GH88081), (#GH89496), (#GH90669), (#GH91633) and (#GH97453).
1098 - Fixed a crash in constraint instantiation under nested lambdas with dependent parameters.
1099 - Fixed handling of brace ellison when building deduction guides. (#GH64625), (#GH83368).
1100 - Fixed a failed assertion when attempting to convert an integer representing the difference
1101 between the addresses of two labels (a GNU extension) to a pointer within a constant expression. (#GH95366).
1102 - Fix immediate escalation bugs in the presence of dependent call arguments. (#GH94935)
1103 - Clang now diagnoses explicit specializations with storage class specifiers in all contexts.
1104 - Fix an assertion failure caused by parsing a lambda used as a default argument for the value of a
1105 forward-declared class. (#GH93512).
1106 - Fixed a bug in access checking inside return-type-requirement of compound requirements. (#GH93788).
1107 - Fixed an assertion failure about invalid conversion when calling lambda. (#GH96205).
1108 - Fixed a bug where the first operand of binary ``operator&`` would be transformed as if it was the operand
1109 of the address of operator. (#GH97483).
1110 - Fixed an assertion failure about a constant expression which is a known integer but is not
1111 evaluated to an integer. (#GH96670).
1112 - Fixed a bug where references to lambda capture inside a ``noexcept`` specifier were not correctly
1113 instantiated. (#GH95735).
1114 - Fixed a CTAD substitution bug involving type aliases that reference outer template parameters. (#GH94614).
1115 - Clang now correctly handles unexpanded packs in the template parameter list of a generic lambda expression
1116 (#GH48937)
1117 - Fix a crash when parsing an invalid type-requirement in a requires expression. (#GH51868)
1118 - Fix parsing of built-in type-traits such as ``__is_pointer`` in libstdc++ headers. (#GH95598)
1119 - Fixed failed assertion when resolving context of defaulted comparison method outside of struct. (#GH96043).
1120 - Clang now diagnoses explicit object parameters in member pointers and other contexts where they should not appear.
1121 Fixes (#GH85992).
1122 - Fixed a crash-on-invalid bug involving extraneous template parameter with concept substitution. (#GH73885)
1123 - Fixed assertion failure by skipping the analysis of an invalid field declaration. (#GH99868)
1124 - Fix an issue with dependent source location expressions (#GH106428), (#GH81155), (#GH80210), (#GH85373)
1125 - Fix handling of ``_`` as the name of a lambda's init capture variable. (#GH107024)
1126 - Fixed recognition of ``std::initializer_list`` when it's surrounded with ``extern "C++"`` and exported
1127 out of a module (which is the case e.g. in MSVC's implementation of ``std`` module). (#GH118218)
1128
1129 Bug Fixes to AST Handling
1130 ^^^^^^^^^^^^^^^^^^^^^^^^^
1131 - Clang now properly preserves ``FoundDecls`` within a ``ConceptReference``. (#GH82628)
1132 - The presence of the ``typename`` keyword is now stored in ``TemplateTemplateParmDecl``.
1133 - Fixed malformed AST generated for anonymous union access in templates. (#GH90842)
1134 - Improved preservation of qualifiers and sugar in `TemplateNames`, including
1135 template keyword.
1136
1137 Miscellaneous Bug Fixes
1138 ^^^^^^^^^^^^^^^^^^^^^^^
1139
1140 - Fixed an infinite recursion in ASTImporter, on return type declared inside
1141 body of C++11 lambda without trailing return (#GH68775).
1142 - Fixed declaration name source location of instantiated function definitions (GH71161).
1143 - Improve diagnostic output to print an expression instead of 'no argument` when comparing Values as template arguments.
1144
1145 Miscellaneous Clang Crashes Fixed
1146 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1147
1148 - Do not attempt to dump the layout of dependent types or invalid declarations
1149 when ``-fdump-record-layouts-complete`` is passed. Fixes #GH83684.
1150 - Unhandled StructuralValues in the template differ (#GH93068).
1151
1152 OpenACC Specific Changes
1153 ------------------------
1154
1155 Target Specific Changes
1156 -----------------------
1157
1158 AMDGPU Support
1159 ^^^^^^^^^^^^^^
1160
1161 X86 Support
1162 ^^^^^^^^^^^
1163
1164 - Remove knl/knm specific ISA supports: AVX512PF, AVX512ER, PREFETCHWT1
1165 - Support has been removed for the AMD "3DNow!" instruction-set.
1166 Neither modern AMD CPUs, nor any Intel CPUs implement these
1167 instructions, and they were never widely used.
1168
1169 * The options ``-m3dnow`` and ``-m3dnowa`` are no longer honored, and will emit a warning if used.
1170 * The macros ``__3dNOW__`` and ``__3dNOW_A__`` are no longer ever set by the compiler.
1171 * The header ``<mm3dnow.h>`` is deprecated, and emits a warning if included.
1172 * The 3dNow intrinsic functions have been removed: ``_m_femms``,
1173 ``_m_pavgusb``, ``_m_pf2id``, ``_m_pfacc``, ``_m_pfadd``,
1174 ``_m_pfcmpeq``, ``_m_pfcmpge``, ``_m_pfcmpgt``, ``_m_pfmax``,
1175 ``_m_pfmin``, ``_m_pfmul``, ``_m_pfrcp``, ``_m_pfrcpit1``,
1176 ``_m_pfrcpit2``, ``_m_pfrsqrt``, ``_m_pfrsqrtit1``, ``_m_pfsub``,
1177 ``_m_pfsubr``, ``_m_pi2fd``, ``_m_pmulhrw``, ``_m_pf2iw``,
1178 ``_m_pfnacc``, ``_m_pfpnacc``, ``_m_pi2fw``, ``_m_pswapdsf``,
1179 ``_m_pswapdsi``.
1180 * The compiler builtins corresponding to each of the above
1181 intrinsics have also been removed (``__builtin_ia32_femms``, and so on).
1182 * "3DNow!" instructions remain supported in assembly code, including
1183 inside inline-assembly.
1184
1185 Arm and AArch64 Support
1186 ^^^^^^^^^^^^^^^^^^^^^^^
1187
1188 - ARMv7+ targets now default to allowing unaligned access, except Armv6-M, and
1189 Armv8-M without the Main Extension. Baremetal targets should check that the
1190 new default will work with their system configurations, since it requires
1191 that SCTLR.A is 0, SCTLR.U is 1, and that the memory in question is
1192 configured as "normal" memory. This brings Clang in-line with the default
1193 settings for GCC and Arm Compiler. Aside from making Clang align with other
1194 compilers, changing the default brings major performance and code size
1195 improvements for most targets. We have not changed the default behavior for
1196 ARMv6, but may revisit that decision in the future. Users can restore the old
1197 behavior with -m[no-]unaligned-access.
1198
1199 - An alias identifier (rdma) has been added for targeting the AArch64
1200 Architecture Extension which uses Rounding Doubling Multiply Accumulate
1201 instructions (rdm). The identifier is available on the command line as
1202 a feature modifier for -march and -mcpu as well as via target attributes
1203 like ``target_version`` or ``target_clones``.
1204
1205 - Support has been added for the following processors (-mcpu identifiers in parenthesis):
1206 * Arm Cortex-R52+ (cortex-r52plus).
1207 * Arm Cortex-R82AE (cortex-r82ae).
1208 * Arm Cortex-A78AE (cortex-a78ae).
1209 * Arm Cortex-A520AE (cortex-a520ae).
1210 * Arm Cortex-A720AE (cortex-a720ae).
1211 * Arm Cortex-A725 (cortex-a725).
1212 * Arm Cortex-X925 (cortex-x925).
1213 * Arm Neoverse-N3 (neoverse-n3).
1214 * Arm Neoverse-V3 (neoverse-v3).
1215 * Arm Neoverse-V3AE (neoverse-v3ae).
1216 - ``-mbranch-protection=gcs`` has been added which enables support for the
1217 Guarded Control Stack extension, and ``-mbranch-protection=standard`` also
1218 enables this. Enabling GCS causes the GCS GNU property bit to be set on output
1219 objects. It doesn't cause any code generation changes, as the code generated
1220 by clang is already compatible with GCS.
1221
1222 - Experimental support has been added for pointer authentication ABI for ะก/C++.
1223
1224 - Pointer authentication ABI could be enabled for AArch64 Linux via
1225 ``-mabi=pauthtest`` option or via specifying ``pauthtest`` environment part of
1226 target triple.
1227
1228 - The C23 ``_BitInt`` implementation has been brought into compliance
1229 with AAPCS32 and AAPCS64.
1230
1231 Android Support
1232 ^^^^^^^^^^^^^^^
1233
1234 Windows Support
1235 ^^^^^^^^^^^^^^^
1236
1237 - The clang-cl ``/Ot`` compiler option ("optimize for speed", also implied by
1238 ``/O2``) now maps to clang's ``-O3`` optimizataztion level instead of ``-O2``.
1239 Users who prefer the old behavior can use ``clang-cl /Ot /clang:-O2 ...``.
1240
1241 - Clang-cl now supports function targets with intrinsic headers. This allows
1242 for runtime feature detection of intrinsics. Previously under clang-cl
1243 ``immintrin.h`` and similar intrinsic headers would only include the intrinsics
1244 if building with that feature enabled at compile time, e.g. ``avxintrin.h``
1245 would only be included if AVX was enabled at compile time. This was done to work
1246 around include times from MSVC STL including ``intrin.h`` under clang-cl.
1247 Clang-cl now provides ``intrin0.h`` for MSVC STL and therefore all intrinsic
1248 features without requiring enablement at compile time. Fixes #GH53520
1249
1250 - Improved compile times with MSVC STL. MSVC provides ``intrin0.h`` which is a
1251 header that only includes intrinsics that are used by MSVC STL to avoid the
1252 use of ``intrin.h``. MSVC STL when compiled under clang uses ``intrin.h``
1253 instead. Clang-cl now provides ``intrin0.h`` for the same compiler throughput
1254 purposes as MSVC. Clang-cl also provides ``yvals_core.h`` to redefine
1255 ``_STL_INTRIN_HEADER`` to expand to ``intrin0.h`` instead of ``intrin.h``.
1256 This also means that if all intrinsic features are enabled at compile time
1257 including STL headers will no longer slow down compile times since ``intrin.h``
1258 is not included from MSVC STL.
1259
1260 - When the target triple is `*-windows-msvc` strict aliasing is now disabled by default
1261 to ensure compatibility with msvc. Previously strict aliasing was only disabled if the
1262 driver mode was cl.
1263
1264 LoongArch Support
1265 ^^^^^^^^^^^^^^^^^
1266
1267 - ``-march=la64v1.0`` and ``-march=la64v1.1`` have been added to select the
1268 ``la64v1.0`` and ``la64v1.1`` architecture respectively. And ``-march=la664``
1269 is added to support the ``la664`` micro-architecture.
1270 - The 128-bits SIMD extension (``LSX``) is enabled by default.
1271 - ``-msimd=`` has beend added to select the SIMD extension(s) to be enabled.
1272 - Predefined macros ``__loongarch_simd_width`` and ``__loongarch_frecipe`` are
1273 added.
1274
1275 RISC-V Support
1276 ^^^^^^^^^^^^^^
1277
1278 - ``__attribute__((rvv_vector_bits(N)))`` is now supported for RVV vbool*_t types.
1279 - Profile names in ``-march`` option are now supported.
1280 - Passing empty structs/unions as arguments in C++ is now handled correctly. The behavior is similar to GCC's.
1281 - ``-m[no-]scalar-strict-align`` and ``-m[no-]vector-strict-align`` options have
1282 been added to give separate control of whether scalar or vector misaligned
1283 accesses may be created. ``-m[no-]strict-align`` applies to both scalar and
1284 vector.
1285
1286 PowerPC Support
1287 ^^^^^^^^^^^^^^^
1288
1289 - Clang now emits errors for impossible ``__attribute__((musttail))``.
1290 - Added support for ``-mcpu=[pwr11 | power11]`` and ``-mtune=[pwr11 | power11]``.
1291 - Added support for ``builtin_cpu_supports`` on AIX, along with a subset of
1292 features that can be queried.
1293
1294 CUDA/HIP Language Changes
1295 ^^^^^^^^^^^^^^^^^^^^^^^^^
1296
1297 - PTX is no longer included by default when compiling for CUDA. Using
1298 ``--cuda-include-ptx=all`` will return the old behavior.
1299
1300 CUDA Support
1301 ^^^^^^^^^^^^
1302 - Clang now supports CUDA SDK up to 12.5
1303
1304 AIX Support
1305 ^^^^^^^^^^^
1306
1307 - Introduced the ``-maix-small-local-dynamic-tls`` option to produce a faster
1308 access sequence for local-dynamic TLS variables where the offset from the TLS
1309 base is encoded as an immediate operand.
1310 This access sequence is not used for TLS variables larger than 32KB, and is
1311 currently only supported on 64-bit mode.
1312 - Introduced the options ``-mtocdata/-mno-tocdata`` to enable/disable TOC data
1313 transformations for the listed suitable variables.
1314 - Introduced the ``-maix-shared-lib-tls-model-opt`` option to enable the tuning
1315 of changing local-dynamic mode access(es) to initial-exec access(es) at the
1316 function level on 64-bit mode.
1317 - Clang now emits errors for ``-gdwarf-5``.
1318 - Added the support of the OpenMP runtime libomp on AIX. OpenMP applications can be
1319 compiled with ``-fopenmp`` and execute on AIX.
1320
1321 NetBSD Support
1322 ^^^^^^^^^^^^^^
1323
1324 - Removed support for building NetBSD/i386 6.x or older binaries.
1325
1326 WebAssembly Support
1327 ^^^^^^^^^^^^^^^^^^^
1328
1329 The -mcpu=generic configuration now enables multivalue and reference-types.
1330 These proposals are standardized and available in all major engines. Enabling
1331 multivalue here only enables the language feature but does not turn on the
1332 multivalue ABI (this enables non-ABI uses of multivalue, like exnref).
1333
1334 AVR Support
1335 ^^^^^^^^^^^
1336
1337 DWARF Support in Clang
1338 ----------------------
1339
1340 Floating Point Support in Clang
1341 -------------------------------
1342
1343 - Add ``__builtin__fmaf16`` builtin for floating point types.
1344
1345 Fixed Point Support in Clang
1346 ----------------------------
1347
1348 - Support fixed point precision macros according to ``7.18a.3`` of
1349 `ISO/IEC TR 18037:2008 <https://standards.iso.org/ittf/PubliclyAvailableStandards/c051126_ISO_IEC_TR_18037_2008.zip>`_.
1350
1351 AST Matchers
1352 ------------
1353
1354 - Fixes a long-standing performance issue in parent map generation for
1355 ancestry-based matchers such as ``hasParent`` and ``hasAncestor``, making
1356 them significantly faster.
1357 - ``isInStdNamespace`` now supports Decl declared with ``extern "C++"``.
1358 - Add ``isExplicitObjectMemberFunction``.
1359 - Fixed ``forEachArgumentWithParam`` and ``forEachArgumentWithParamType`` to
1360 not skip the explicit object parameter for operator calls.
1361 - Fixed captureVars assertion failure if not capturesVariables. (#GH76425)
1362 - ``forCallable`` now properly preserves binding on successful match. (#GH89657)
1363
1364 clang-format
1365 ------------
1366
1367 - ``AlwaysBreakTemplateDeclarations`` is deprecated and renamed to
1368 ``BreakTemplateDeclarations``.
1369 - ``AlwaysBreakAfterReturnType`` is deprecated and renamed to
1370 ``BreakAfterReturnType``.
1371 - Handles Java switch expressions.
1372 - Adds ``AllowShortCaseExpressionOnASingleLine`` option.
1373 - Adds ``AlignCaseArrows`` suboption to ``AlignConsecutiveShortCaseStatements``.
1374 - Adds ``LeftWithLastLine`` suboption to ``AlignEscapedNewlines``.
1375 - Adds ``KeepEmptyLines`` option to deprecate ``KeepEmptyLinesAtEOF``
1376 and ``KeepEmptyLinesAtTheStartOfBlocks``.
1377 - Add ``ExceptDoubleParentheses`` sub-option for ``SpacesInParensOptions``
1378 to override addition of spaces between multiple, non-redundant parentheses
1379 similar to the rules used for ``RemoveParentheses``.
1380
1381 libclang
1382 --------
1383
1384 - ``clang_getSpellingLocation`` now correctly resolves macro expansions; that
1385 is, it returns the spelling location instead of the expansion location.
1386
1387 Static Analyzer
1388 ---------------
1389
1390 New features
1391 ^^^^^^^^^^^^
1392
1393 - The attribute ``[[clang::suppress]]`` can now be applied to declarations.
1394 (#GH80371)
1395
1396 - Support C++23 static operator calls. (#GH84972)
1397
1398 Crash and bug fixes
1399 ^^^^^^^^^^^^^^^^^^^
1400
1401 - Fixed crashing on loops if the loop variable was declared in switch blocks
1402 but not under any case blocks if ``unroll-loops=true`` analyzer config is
1403 set. (#GH68819)
1404
1405 - Fixed a crash in ``security.cert.env.InvalidPtr`` checker when accidentally
1406 matched user-defined ``strerror`` and similar library functions. (#GH88181)
1407
1408 - Fixed a crash when storing through an address that refers to the address of
1409 a label. (#GH89185)
1410
1411 - Fixed a crash when using ``__builtin_bitcast(type, array)`` as an array
1412 subscript. (#GH94496)
1413
1414 - Z3 crosschecking (aka. Z3 refutation) is now bounded, and can't consume
1415 more total time than the eymbolic execution itself. (#GH97298)
1416
1417 - In clang-18, we regressed in terms of analysis time for projects having many
1418 nested loops with buffer indexing or shifting or other binary operations.
1419 For example, functions computing different hash values. Some of this slowdown
1420 was attributed to taint analysis, which is fixed now. (#GH105493)
1421
1422 - ``std::addressof``, ``std::as_const``, ``std::forward``,
1423 ``std::forward_like``, ``std::move``, ``std::move_if_noexcept``, are now
1424 modeled just like their builtin counterpart. (#GH94193)
1425
1426 Improvements
1427 ^^^^^^^^^^^^
1428
1429 Moved checkers
1430 ^^^^^^^^^^^^^^
1431
1432 - Moved ``alpha.cplusplus.ArrayDelete`` out of the ``alpha`` package
1433 to ``cplusplus.ArrayDelete``. (#GH83985)
1434 `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-arraydelete-c>`__.
1435
1436 - Moved ``alpha.unix.Stream`` out of the ``alpha`` package to
1437 ``unix.Stream``. (#GH89247)
1438 `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-stream-c>`__.
1439
1440 - Moved ``alpha.unix.BlockInCriticalSection`` out of the ``alpha`` package to
1441 ``unix.BlockInCriticalSection``. (#GH93815)
1442 `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#unix-blockincriticalsection-c-c>`__.
1443
1444 - Moved ``alpha.security.cert.pos.34c`` out of the ``alpha`` package to
1445 ``security.PutenvStackArray``. (#GH92424, #GH93815)
1446 `Documentation <https://clang.llvm.org/docs/analyzer/checkers.html#security-putenvstackarray-c>`__.
1447
1448 - Moved ``alpha.core.SizeofPtr`` into ``clang-tidy``
1449 ``bugprone-sizeof-expression``. (#GH95118, #GH94356)
1450 `Documentation <https://clang.llvm.org/extra/clang-tidy/checks/bugprone/sizeof-expression.html>`__.
1451
1452 .. _release-notes-sanitizers:
1453
1454 Sanitizers
1455 ----------
1456
1457 - ``-fsanitize=signed-integer-overflow`` now instruments signed arithmetic even
1458 when ``-fwrapv`` is enabled. Previously, only division checks were enabled.
1459
1460 Users with ``-fwrapv`` as well as a sanitizer group like
1461 ``-fsanitize=undefined`` or ``-fsanitize=integer`` enabled may want to
1462 manually disable potentially noisy signed integer overflow checks with
1463 ``-fno-sanitize=signed-integer-overflow``
1464
1465 - ``-fsanitize=cfi -fsanitize-cfi-cross-dso`` (cross-DSO CFI instrumentation)
1466 now generates the ``__cfi_check`` function with proper target-specific
1467 attributes, for example allowing unwind table generation.
1468
1469 Python Binding Changes
1470 ----------------------
1471
1472 - Exposed `CXRewriter` API as `class Rewriter`.
1473 - Add some missing kinds from Index.h (CursorKind: 149-156, 272-320, 420-437.
1474 TemplateArgumentKind: 5-9. TypeKind: 161-175 and 178).
1475 - Add support for retrieving binary operator information through
1476 Cursor.binary_operator().
1477
1478 OpenMP Support
1479 --------------
1480
1481 - Added support for the `[[omp::assume]]` attribute.
1482 - AIX added an include directory for ``omp.h`` at ``/opt/IBM/openxlCSDK/include/openmp``.
1483
1484 Additional Information
1485 ======================
1486
1487 A wide variety of additional information is available on the `Clang web
1488 page <https://clang.llvm.org/>`_. The web page contains versions of the
1489 API documentation which are up-to-date with the Git version of
1490 the source code. You can access versions of these documents specific to
1491 this release by going into the "``clang/docs/``" directory in the Clang
1492 tree.
1493
1494 If you have any questions or comments about Clang, please feel free to
1495 contact us on the `Discourse forums (Clang Frontend category)
1496 <https://discourse.llvm.org/c/clang/6>`_.