| 1 |
.. If you want to modify sections/contents permanently, you should modify both |
| 2 |
ReleaseNotes.rst and ReleaseNotesTemplate.txt. |
| 3 |
|
| 4 |
=========================================== |
| 5 |
Clang |release| |ReleaseNotesTitle| |
| 6 |
=========================================== |
| 7 |
|
| 8 |
.. contents:: |
| 9 |
:local: |
| 10 |
:depth: 2 |
| 11 |
|
| 12 |
Written by the `LLVM Team <https://llvm.org/>`_ |
| 13 |
|
| 14 |
.. only:: PreRelease |
| 15 |
|
| 16 |
.. warning:: |
| 17 |
These are in-progress notes for the upcoming Clang |version| release. |
| 18 |
Release notes for previous releases can be found on |
| 19 |
`the Releases Page <https://llvm.org/releases/>`_. |
| 20 |
|
| 21 |
Introduction |
| 22 |
============ |
| 23 |
|
| 24 |
This document contains the release notes for the Clang C/C++/Objective-C |
| 25 |
frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we |
| 26 |
describe the status of Clang in some detail, including major |
| 27 |
improvements from the previous release and new feature work. For the |
| 28 |
general LLVM release notes, see `the LLVM |
| 29 |
documentation <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ release notes, |
| 30 |
see `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases |
| 31 |
may be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_. |
| 32 |
|
| 33 |
For more information about Clang or LLVM, including information about the |
| 34 |
latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the |
| 35 |
`LLVM Web Site <https://llvm.org>`_. |
| 36 |
|
| 37 |
Potentially Breaking Changes |
| 38 |
============================ |
| 39 |
|
| 40 |
- Clang will now emit a warning if the auto-detected GCC installation |
| 41 |
directory (i.e. the one with the largest version number) does not |
| 42 |
contain libstdc++ include directories although a "complete" GCC |
| 43 |
installation directory containing the include directories is |
| 44 |
available. It is planned to change the auto-detection to prefer the |
| 45 |
"complete" directory in the future. The warning will disappear if |
| 46 |
the libstdc++ include directories are either installed or removed |
| 47 |
for all GCC installation directories considered by the |
| 48 |
auto-detection; see the output of ``clang -v`` for a list of those |
| 49 |
directories. If the GCC installations cannot be modified and |
| 50 |
maintaining the current choice of the auto-detection is desired, the |
| 51 |
GCC installation directory can be selected explicitly using the |
| 52 |
``--gcc-install-dir`` command line argument. This will silence the |
| 53 |
warning. It can also be disabled using the |
| 54 |
``-Wno-gcc-install-dir-libstdcxx`` command line flag. |
| 55 |
- Scalar deleting destructor support has been aligned with MSVC when |
| 56 |
targeting the MSVC ABI. Clang previously implemented support for |
| 57 |
``::delete`` by calling the complete object destructor and then the |
| 58 |
appropriate global delete operator (as is done for the Itanium ABI). |
| 59 |
The scalar deleting destructor is now called to destroy the object |
| 60 |
and deallocate its storage. This is an ABI change that can result in |
| 61 |
memory corruption when a program built for the MSVC ABI has |
| 62 |
portions compiled with clang 21 or earlier and portions compiled |
| 63 |
with a version of clang 22 (or MSVC). Consider a class ``X`` that |
| 64 |
declares a virtual destructor and an ``operator delete`` member |
| 65 |
with the destructor defined in library ``A`` and a call to `::delete`` in |
| 66 |
library ``B``. If library ``A`` is compiled with clang 21 and library ``B`` |
| 67 |
is compiled with clang 22, the ``::delete`` call might dispatch to the |
| 68 |
scalar deleting destructor emitted in library ``A`` which will erroneously |
| 69 |
call the member ``operator delete`` instead of the expected global |
| 70 |
delete operator. The old behavior is retained under ``-fclang-abi-compat=21`` |
| 71 |
flag. |
| 72 |
- Clang warning suppressions file, ``--warning-suppression-mappings=``, now will |
| 73 |
use the last matching entry instead of the longest one. |
| 74 |
- Trailing null statements in GNU statement expressions are no longer |
| 75 |
ignored by Clang; they now result in a void type. Clang previously |
| 76 |
matched GCC's behavior, which was recently clarified to be incorrect. |
| 77 |
|
| 78 |
.. code-block:: c++ |
| 79 |
|
| 80 |
// The resulting type is 'void', not 'int' |
| 81 |
void foo(void) { |
| 82 |
return ({ 1;; }); |
| 83 |
} |
| 84 |
- Downstream projects that previously linked only against ``clangDriver`` may |
| 85 |
now (also) need to link against the new ``clangOptions`` library, since |
| 86 |
options-related code has been moved out of the Driver into a separate library. |
| 87 |
- The ``clangFrontend`` library no longer depends on ``clangDriver``, which may |
| 88 |
break downstream projects that relied on this transitive dependency. |
| 89 |
- Clang now supports MSVC vector deleting destructors when targeting Windows. |
| 90 |
This means that vtables of classes with virtual destructors will contain a |
| 91 |
pointer to vector deleting destructor (instead of scalar deleting destructor) |
| 92 |
which in fact is a different symbol with different name and linkage. This |
| 93 |
may cause runtime failures if two binaries using the same class defining a |
| 94 |
virtual destructor are compiled with different versions of clang. |
| 95 |
|
| 96 |
C/C++ Language Potentially Breaking Changes |
| 97 |
------------------------------------------- |
| 98 |
|
| 99 |
- The ``__has_builtin`` function now only considers the currently active target when being used with target offloading. |
| 100 |
|
| 101 |
- The ``-Wincompatible-pointer-types`` diagnostic now defaults to an error; |
| 102 |
it can still be downgraded to a warning by passing ``-Wno-error=incompatible-pointer-types``. (#GH74605) |
| 103 |
|
| 104 |
C++ Specific Potentially Breaking Changes |
| 105 |
----------------------------------------- |
| 106 |
- For C++20 modules, the Reduced BMI mode will be the default option. This may introduce |
| 107 |
regressions if your build system supports two-phase compilation model but haven't support |
| 108 |
reduced BMI or it is a compiler bug or a bug in users code. |
| 109 |
|
| 110 |
- Clang now correctly diagnoses during constant expression evaluation undefined behavior due to member |
| 111 |
pointer access to a member which is not a direct or indirect member of the most-derived object |
| 112 |
of the accessed object but is instead located directly in a sibling class to one of the classes |
| 113 |
along the inheritance hierarchy of the most-derived object as ill-formed. |
| 114 |
Other scenarios in which the member is not member of the most derived object were already |
| 115 |
diagnosed previously. (#GH150709) |
| 116 |
|
| 117 |
.. code-block:: c++ |
| 118 |
|
| 119 |
struct A {}; |
| 120 |
struct B : A {}; |
| 121 |
struct C : A { constexpr int foo() const { return 1; } }; |
| 122 |
constexpr A a; |
| 123 |
constexpr B b; |
| 124 |
constexpr C c; |
| 125 |
constexpr auto mp = static_cast<int(A::*)() const>(&C::foo); |
| 126 |
static_assert((a.*mp)() == 1); // continues to be rejected |
| 127 |
static_assert((b.*mp)() == 1); // newly rejected |
| 128 |
static_assert((c.*mp)() == 1); // accepted |
| 129 |
|
| 130 |
- ``VarTemplateSpecializationDecl::getTemplateArgsAsWritten()`` method now |
| 131 |
returns ``nullptr`` for implicitly instantiated declarations. |
| 132 |
|
| 133 |
- ``__builtin_is_replaceable``, ``trivially_relocable_if_eligible``, and ``replaceable_if_eligible`` |
| 134 |
have been removed as `P2786 <https://wg21.link/P2786>`_ have been removed from C++2c. |
| 135 |
``__builtin_is_cpp_trivially_relocatable`` and ``__builtin_trivially_relocate`` have been kept back, |
| 136 |
with the `P2786 <https://wg21.link/P2786>`_ semantics, except there is no longer a way |
| 137 |
to explicitly specify a type is relocatable. |
| 138 |
|
| 139 |
ABI Changes in This Version |
| 140 |
--------------------------- |
| 141 |
- Fix AArch64 argument passing for C++ empty classes with large explicitly specified alignment. |
| 142 |
|
| 143 |
AST Potentially Breaking Changes |
| 144 |
-------------------------------- |
| 145 |
- Abbreviated function templates and generic lambdas now have a valid begin source location. |
| 146 |
The begin source location of abbreviated function templates is the begin source location of the templated function. |
| 147 |
The begin source location of generic lambdas is the begin source location of the lambda introducer ``[...]``. |
| 148 |
|
| 149 |
AST Dumping Potentially Breaking Changes |
| 150 |
---------------------------------------- |
| 151 |
- How nested name specifiers are dumped and printed changes, keeping track of clang AST changes. |
| 152 |
|
| 153 |
- Pretty-printing of atomic builtins ``__atomic_test_and_set`` and ``__atomic_clear`` in ``-ast-print`` output. |
| 154 |
These previously displayed an extra ``<null expr>`` argument, e.g.: |
| 155 |
|
| 156 |
``__atomic_test_and_set(p, <null expr>, 0)`` |
| 157 |
|
| 158 |
Now they are printed as: |
| 159 |
|
| 160 |
``__atomic_test_and_set(p, 0)`` |
| 161 |
|
| 162 |
- Pretty-printing of templates with inherited (i.e. specified in a previous |
| 163 |
redeclaration) default arguments has been fixed. |
| 164 |
|
| 165 |
- Default arguments of template template parameters are pretty-printed now. |
| 166 |
|
| 167 |
- Pretty-printing of ``asm`` attributes are now always the first attribute |
| 168 |
on the right side of the declaration. Before we had, e.g.: |
| 169 |
|
| 170 |
``__attribute__(("visibility")) asm("string")`` |
| 171 |
|
| 172 |
Now we have: |
| 173 |
|
| 174 |
``asm("string") __attribute__(("visibility"))`` |
| 175 |
|
| 176 |
Which is accepted by both clang and gcc parsers. |
| 177 |
|
| 178 |
Clang Frontend Potentially Breaking Changes |
| 179 |
------------------------------------------- |
| 180 |
- Members of anonymous unions/structs are now injected as ``IndirectFieldDecl`` |
| 181 |
into the enclosing record even if their names conflict with other names in the |
| 182 |
scope. These ``IndirectFieldDecl`` are marked invalid. |
| 183 |
|
| 184 |
Clang Python Bindings Potentially Breaking Changes |
| 185 |
-------------------------------------------------- |
| 186 |
- Return ``None`` instead of null cursors from ``Token.cursor`` |
| 187 |
- TypeKind ``ELABORATED`` is not used anymore, per clang AST changes removing |
| 188 |
ElaboratedTypes. The value becomes unused, and all the existing users should |
| 189 |
expect the former underlying type to be reported instead. |
| 190 |
- Remove ``AccessSpecifier.NONE`` kind. No libclang interfaces ever returned this kind. |
| 191 |
- Allow setting the path to the libclang library via environment variables: ``LIBCLANG_LIBRARY_PATH`` |
| 192 |
to specifiy the path to the containing folder, or ``LIBCLANG_LIBRARY_FILE`` to specify the path to |
| 193 |
the library file |
| 194 |
- ``TranslationUnit.reparse`` will now throw an exception when an error occurs. |
| 195 |
Previously, errors were silently ignored. |
| 196 |
|
| 197 |
What's New in Clang |release|? |
| 198 |
============================== |
| 199 |
|
| 200 |
C++ Language Changes |
| 201 |
-------------------- |
| 202 |
|
| 203 |
- A new family of builtins ``__builtin_*_synthesizes_from_spaceship`` has been added. These can be queried to know |
| 204 |
whether the ``<`` (``lt``), ``>`` (``gt``), ``<=`` (``le``), or ``>=`` (``ge``) operators are synthesized from a |
| 205 |
``<=>``. This makes it possible to optimize certain facilities by using the ``<=>`` operation directly instead of |
| 206 |
doing multiple comparisons. |
| 207 |
|
| 208 |
C++2c Feature Support |
| 209 |
^^^^^^^^^^^^^^^^^^^^^ |
| 210 |
|
| 211 |
- Started the implementation of `P2686R5 <https://wg21.link/P2686R5>`_ Constexpr structured bindings. |
| 212 |
At this time, references to constexpr and decomposition of *tuple-like* types are not supported |
| 213 |
(only arrays and aggregates are). |
| 214 |
|
| 215 |
C++23 Feature Support |
| 216 |
^^^^^^^^^^^^^^^^^^^^^ |
| 217 |
|
| 218 |
C++20 Feature Support |
| 219 |
^^^^^^^^^^^^^^^^^^^^^ |
| 220 |
|
| 221 |
- Clang now normalizes constraints before checking whether they are satisfied, as mandated by the standard. |
| 222 |
As a result, Clang no longer incorrectly diagnoses substitution failures in template arguments only |
| 223 |
used in concept-ids, and produces better diagnostics for satisfaction failure. (#GH61811) (#GH135190) |
| 224 |
|
| 225 |
C++17 Feature Support |
| 226 |
^^^^^^^^^^^^^^^^^^^^^ |
| 227 |
|
| 228 |
Resolutions to C++ Defect Reports |
| 229 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 230 |
|
| 231 |
C Language Changes |
| 232 |
------------------ |
| 233 |
|
| 234 |
- Clang now supports the |
| 235 |
:ref:`__builtin_stack_address <builtin_stack_address-doc>` () builtin. |
| 236 |
The semantics match those of GCC's builtin with the same name. |
| 237 |
- Implemented the ``defer`` draft Technical Specification |
| 238 |
(`WG14 N3734 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3734.pdf>`_); it is enabled in C mode by |
| 239 |
passing ``-fdefer-ts``. Note, the details of this feature are subject to change given that the Technical |
| 240 |
Specification is not yet ratified. |
| 241 |
|
| 242 |
C2y Feature Support |
| 243 |
^^^^^^^^^^^^^^^^^^^ |
| 244 |
- No longer triggering ``-Wstatic-in-inline`` in C2y mode; use of a static |
| 245 |
function or variable within an extern inline function is no longer a |
| 246 |
constraint per `WG14 N3622 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3622.txt>`_. |
| 247 |
- Clang now supports `N3355 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3355.htm>`_ Named Loops. |
| 248 |
- Clang's implementation of ``__COUNTER__`` was updated to conform to |
| 249 |
`WG14 N3457 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm>`_. |
| 250 |
This includes adding pedantic warnings for the feature being an extension in |
| 251 |
other language modes as well as an error when the counter is expanded more |
| 252 |
than 2147483647 times. |
| 253 |
|
| 254 |
C23 Feature Support |
| 255 |
^^^^^^^^^^^^^^^^^^^ |
| 256 |
- Added ``FLT_SNAN``, ``DBL_SNAN``, and ``LDBL_SNAN`` to Clang's ``<float.h>`` |
| 257 |
header in C23 and later modes. This implements |
| 258 |
`WG14 N2710 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2710.htm>`_. |
| 259 |
- Fixed accepting as compatible unnamed tag types with the same fields within |
| 260 |
the same translation unit but from different types. |
| 261 |
- ``-MG`` now silences the "file not found" errors with ``#embed`` when |
| 262 |
scanning for dependencies and encountering an unknown file. #GH165632 |
| 263 |
|
| 264 |
Non-comprehensive list of changes in this release |
| 265 |
------------------------------------------------- |
| 266 |
- Added ``__scoped_atomic_uinc_wrap`` and ``__scoped_atomic_udec_wrap``. |
| 267 |
|
| 268 |
- Removed OpenCL header-only feature macros (previously unconditionally enabled |
| 269 |
on SPIR-V and only selectively disabled via ``-D__undef_<feature>``). All |
| 270 |
OpenCL extensions and features are now centralized in OpenCLExtensions.def, |
| 271 |
allowing consistent control via ``getSupportedOpenCLOpts`` and ``-cl-ext``. |
| 272 |
|
| 273 |
- Added ``__builtin_elementwise_ldexp``. |
| 274 |
|
| 275 |
- Added ``__builtin_elementwise_fshl`` and ``__builtin_elementwise_fshr``. |
| 276 |
|
| 277 |
- ``__builtin_elementwise_abs`` can now be used in constant expression. |
| 278 |
|
| 279 |
- Added ``__builtin_elementwise_minnumnum`` and ``__builtin_elementwise_maxnumnum``. |
| 280 |
|
| 281 |
- Trapping UBSan (e.g. ``-fsanitize=undefined -fsanitize-trap=undefined``) now |
| 282 |
emits a string describing the reason for trapping into the generated debug |
| 283 |
info. This feature allows debuggers (e.g. LLDB) to display the reason for |
| 284 |
trapping if the trap is reached. The string is currently encoded in the debug |
| 285 |
info as an artificial frame that claims to be inlined at the trap location. |
| 286 |
The function used for the artificial frame is an artificial function whose |
| 287 |
name encodes the reason for trapping. The encoding used is currently the same |
| 288 |
as ``__builtin_verbose_trap`` but might change in the future. This feature is |
| 289 |
enabled by default but can be disabled by compiling with |
| 290 |
``-fno-sanitize-debug-trap-reasons``. The feature has a ``basic`` and |
| 291 |
``detailed`` mode (the default). The ``basic`` mode emits a hard-coded string |
| 292 |
per trap kind (e.g. ``Integer addition overflowed``) and the ``detailed`` mode |
| 293 |
emits a more descriptive string describing each individual trap (e.g. ``signed |
| 294 |
integer addition overflow in 'a + b'``). The ``detailed`` mode produces larger |
| 295 |
debug info than ``basic`` but is more helpful for debugging. The |
| 296 |
``-fsanitize-debug-trap-reasons=`` flag can be used to switch between the |
| 297 |
different modes or disable the feature entirely. Note due to trap merging in |
| 298 |
optimized builds (i.e. in each function all traps of the same kind get merged |
| 299 |
into the same trap instruction) the trap reasons might be removed. To prevent |
| 300 |
this build without optimizations (i.e. use `-O0` or use the `optnone` function |
| 301 |
attribute) or use the `fno-sanitize-merge=` flag in optimized builds. |
| 302 |
|
| 303 |
- ``__builtin_elementwise_max`` and ``__builtin_elementwise_min`` functions for integer types can |
| 304 |
now be used in constant expressions. |
| 305 |
|
| 306 |
- A vector of booleans is now a valid condition for the ternary ``?:`` operator. |
| 307 |
This binds to a simple vector select operation. |
| 308 |
|
| 309 |
- Added ``__builtin_masked_load``, ``__builtin_masked_expand_load``, |
| 310 |
``__builtin_masked_store``, ``__builtin_masked_compress_store`` for |
| 311 |
conditional memory loads from vectors. Binds to the LLVM intrinsics of the |
| 312 |
same name. |
| 313 |
|
| 314 |
- Added ``__builtin_masked_gather`` and ``__builtin_masked_scatter`` for |
| 315 |
conditional gathering and scattering operations on vectors. Binds to the LLVM |
| 316 |
intrinsics of the same name. |
| 317 |
|
| 318 |
- The ``__builtin_popcountg``, ``__builtin_ctzg``, and ``__builtin_clzg`` |
| 319 |
functions now accept fixed-size boolean vectors. |
| 320 |
|
| 321 |
- Use of ``__has_feature`` to detect the ``ptrauth_qualifier`` and ``ptrauth_intrinsics`` |
| 322 |
features has been deprecated, and is restricted to the arm64e target only. The |
| 323 |
correct method to check for these features is to test for the ``__PTRAUTH__`` |
| 324 |
macro. |
| 325 |
|
| 326 |
- Added a new builtin, ``__builtin_dedup_pack``, to remove duplicate types from a parameter pack. |
| 327 |
This feature is particularly useful in template metaprogramming for normalizing type lists. |
| 328 |
The builtin produces a new, unexpanded parameter pack that can be used in contexts like template |
| 329 |
argument lists or base specifiers. |
| 330 |
|
| 331 |
.. code-block:: c++ |
| 332 |
|
| 333 |
template <typename...> struct TypeList; |
| 334 |
|
| 335 |
// The resulting type is TypeList<int, double, char> |
| 336 |
using MyTypeList = TypeList<__builtin_dedup_pack<int, double, int, char, double>...>; |
| 337 |
|
| 338 |
Currently, the use of ``__builtin_dedup_pack`` is limited to template arguments and base |
| 339 |
specifiers, it also must be used within a template context. |
| 340 |
|
| 341 |
- ``__builtin_assume_dereferenceable`` now accepts non-constant size operands. |
| 342 |
|
| 343 |
- Fixed a crash when the second argument to ``__builtin_assume_aligned`` was not constant (#GH161314) |
| 344 |
|
| 345 |
- Introduce support for :doc:`allocation tokens <AllocToken>` to enable |
| 346 |
allocator-level heap organization strategies. A feature to instrument all |
| 347 |
allocation functions with a token ID can be enabled via the |
| 348 |
``-fsanitize=alloc-token`` flag. |
| 349 |
|
| 350 |
- A new generic byte swap builtin function ``__builtin_bswapg`` that extends the existing |
| 351 |
__builtin_bswap{16,32,64} function family to support all standard integer types. |
| 352 |
|
| 353 |
- A builtin ``__builtin_infer_alloc_token(<args>, ...)`` is provided to allow |
| 354 |
compile-time querying of allocation token IDs, where the builtin arguments |
| 355 |
mirror those normally passed to an allocation function. |
| 356 |
|
| 357 |
- Clang now rejects the invalid use of ``constexpr`` with ``auto`` and an explicit type in C. (#GH163090) |
| 358 |
|
| 359 |
New Compiler Flags |
| 360 |
------------------ |
| 361 |
- New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``). |
| 362 |
- New option ``-fsanitize-debug-trap-reasons=`` added to control emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``). |
| 363 |
- New options for enabling allocation token instrumentation: ``-fsanitize=alloc-token``, ``-falloc-token-max=``, ``-fsanitize-alloc-token-fast-abi``, ``-fsanitize-alloc-token-extended``. |
| 364 |
- The ``-resource-dir`` option is now displayed in the list of options shown by ``--help``. |
| 365 |
- New option ``-fmatrix-memory-layout`` added to control the memory layout of Clang matrix types. (e.g. ``-fmatrix-memory-layout=column-major`` or ``-fmatrix-memory-layout=row-major``). |
| 366 |
|
| 367 |
Lanai Support |
| 368 |
^^^^^^^^^^^^^^ |
| 369 |
- The option ``-mcmodel={small,medium,large}`` is supported again. |
| 370 |
|
| 371 |
Deprecated Compiler Flags |
| 372 |
------------------------- |
| 373 |
|
| 374 |
Modified Compiler Flags |
| 375 |
----------------------- |
| 376 |
- The `-gkey-instructions` compiler flag is now enabled by default when DWARF is emitted for plain C/C++ and optimizations are enabled. (#GH149509) |
| 377 |
- The `-fconstexpr-steps` compiler flag now accepts value `0` to opt out of this limit. (#GH160440) |
| 378 |
- The `-fdevirtualize-speculatively` compiler flag is now supported to enable speculative devirtualization of virtual function calls, it's disabled by default. (#GH159685) |
| 379 |
|
| 380 |
Removed Compiler Flags |
| 381 |
------------------------- |
| 382 |
|
| 383 |
Attribute Changes in Clang |
| 384 |
-------------------------- |
| 385 |
- The definition of a function declaration with ``[[clang::cfi_unchecked_callee]]`` inherits this |
| 386 |
attribute, allowing the attribute to only be attached to the declaration. Prior, this would be |
| 387 |
treated as an error where the definition and declaration would have differing types. |
| 388 |
|
| 389 |
- Instrumentation added by ``-fsanitize=function`` will also be omitted for indirect calls to function |
| 390 |
pointers and function declarations marked with ``[[clang::cfi_unchecked_callee]]``. |
| 391 |
|
| 392 |
- New format attributes ``gnu_printf``, ``gnu_scanf``, ``gnu_strftime`` and ``gnu_strfmon`` are added |
| 393 |
as aliases for ``printf``, ``scanf``, ``strftime`` and ``strfmon``. (#GH16219) |
| 394 |
|
| 395 |
- New function attribute `malloc_span` is added. It has semantics similar to that of the `malloc` |
| 396 |
attribute, but `malloc_span` applies not to functions returning pointers, but to functions returning |
| 397 |
span-like structures (i.e. those that contain a pointer field and a size integer field or two pointers). |
| 398 |
|
| 399 |
- Added new attribute ``modular_format`` to allow dynamically selecting at link |
| 400 |
time which aspects of a statically linked libc's printf (et al) |
| 401 |
implementation are required. This can reduce code size without requiring e.g. |
| 402 |
multilibs for printf features. Requires cooperation with the libc |
| 403 |
implementation. |
| 404 |
|
| 405 |
- On targets with Itanium C++ ABI, Clang now supports ``[[gnu:gcc_struct]]`` |
| 406 |
with the behavior similar to one existing in GCC. In particular, whenever |
| 407 |
``-mms-bitfields`` command line option is provided (or if Microsoft-compatible |
| 408 |
structure layout is default on the target), ``[[gnu::gcc_struct]]`` requests |
| 409 |
the compiler to follow Itanium rules for the layout of an annotated structure. |
| 410 |
|
| 411 |
Improvements to Clang's diagnostics |
| 412 |
----------------------------------- |
| 413 |
- Diagnostics messages now refer to ``structured binding`` instead of ``decomposition``, |
| 414 |
to align with `P0615R0 <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0615r0.html>`_ changing the term. (#GH157880) |
| 415 |
- Clang now suppresses runtime behavior warnings for unreachable code in file-scope |
| 416 |
variable initializers, matching the behavior for functions. This prevents false |
| 417 |
positives for operations in unreachable branches of constant expressions. |
| 418 |
- Added a separate diagnostic group ``-Wfunction-effect-redeclarations``, for the more pedantic |
| 419 |
diagnostics for function effects (``[[clang::nonblocking]]`` and ``[[clang::nonallocating]]``). |
| 420 |
Moved the warning for a missing (though implied) attribute on a redeclaration into this group. |
| 421 |
Added a new warning in this group for the case where the attribute is missing/implicit on |
| 422 |
an override of a virtual method. |
| 423 |
- Remove ``-Wperf-constraint-implies-noexcept`` from ``-Wall``. This warning is somewhat nit-picky and |
| 424 |
attempts to resolve it, by adding ``noexcept``, can create new ways for programs to crash. (#GH167540) |
| 425 |
- Implemented diagnostics when retrieving the tuple size for types where its specialization of `std::tuple_size` |
| 426 |
produces an invalid size (either negative or greater than the implementation limit). (#GH159563) |
| 427 |
- Fixed fix-it hint for fold expressions. Clang now correctly places the suggested right |
| 428 |
parenthesis when diagnosing malformed fold expressions. (#GH151787) |
| 429 |
- Added fix-it hint for when scoped enumerations require explicit conversions for binary operations. (#GH24265) |
| 430 |
- Constant template parameters are now type checked in template definitions, |
| 431 |
including template template parameters. |
| 432 |
- Fixed an issue where emitted format-signedness diagnostics were not associated with an appropriate |
| 433 |
diagnostic id. Besides being incorrect from an API standpoint, this was user visible, e.g.: |
| 434 |
"format specifies type 'unsigned int' but the argument has type 'int' [-Wformat]" |
| 435 |
"signedness of format specifier 'u' is incompatible with 'c' [-Wformat]" |
| 436 |
This was misleading, because even though -Wformat is required in order to emit the diagnostics, |
| 437 |
the warning flag the user needs to concerned with here is -Wformat-signedness, which is also |
| 438 |
required and is not enabled by default. With the change you'll now see: |
| 439 |
"format specifies type 'unsigned int' but the argument has type 'int', which differs in signedness [-Wformat-signedness]" |
| 440 |
"signedness of format specifier 'u' is incompatible with 'c' [-Wformat-signedness]" |
| 441 |
and the API-visible diagnostic id will be appropriate. |
| 442 |
- Clang now produces better diagnostics for template template parameter matching |
| 443 |
involving 'auto' template parameters. |
| 444 |
- Fixed false positives in ``-Waddress-of-packed-member`` diagnostics when |
| 445 |
potential misaligned members get processed before they can get discarded. |
| 446 |
(#GH144729) |
| 447 |
- Fix a false positive warning in ``-Wignored-qualifiers`` when the return type is undeduced. (#GH43054) |
| 448 |
|
| 449 |
- Clang now emits a diagnostic with the correct message in case of assigning to const reference captured in lambda. (#GH105647) |
| 450 |
|
| 451 |
- Fixed false positive in ``-Wmissing-noreturn`` diagnostic when it was requiring the usage of |
| 452 |
``[[noreturn]]`` on lambdas before C++23 (#GH154493). |
| 453 |
|
| 454 |
- Clang now diagnoses the use of ``#`` and ``##`` preprocessor tokens in |
| 455 |
attribute argument lists in C++ when ``-pedantic`` is enabled. The operators |
| 456 |
can be used in macro replacement lists with the usual preprocessor semantics, |
| 457 |
however, non-preprocessor use of tokens now triggers a pedantic warning in C++. |
| 458 |
Compilation in C mode is unchanged, and still permits these tokens to be used. (#GH147217) |
| 459 |
|
| 460 |
- Clang now diagnoses misplaced array bounds on declarators for template |
| 461 |
specializations in th same way as it already did for other declarators. |
| 462 |
(#GH147333) |
| 463 |
|
| 464 |
- A new warning ``-Walloc-size`` has been added to detect calls to functions |
| 465 |
decorated with the ``alloc_size`` attribute don't allocate enough space for |
| 466 |
the target pointer type. |
| 467 |
|
| 468 |
- The :doc:`ThreadSafetyAnalysis` attributes ``ACQUIRED_BEFORE(...)`` and |
| 469 |
``ACQUIRED_AFTER(...)`` have been moved to the stable feature set and no |
| 470 |
longer require ``-Wthread-safety-beta`` to be used. |
| 471 |
- The :doc:`ThreadSafetyAnalysis` gains basic alias-analysis of capability |
| 472 |
pointers under ``-Wthread-safety-beta`` (still experimental), which reduces |
| 473 |
both false positives but also false negatives through more precise analysis. |
| 474 |
|
| 475 |
- Clang now looks through parenthesis for ``-Wundefined-reinterpret-cast`` diagnostic. |
| 476 |
|
| 477 |
- Fixed a bug where the source location was missing when diagnosing ill-formed |
| 478 |
placeholder constraints. |
| 479 |
|
| 480 |
- The two-element, unary mask variant of ``__builtin_shufflevector`` is now |
| 481 |
properly being rejected when used at compile-time. It was not implemented |
| 482 |
and caused assertion failures before (#GH158471). |
| 483 |
|
| 484 |
- Closed a loophole in the diagnosis of function pointer conversions changing |
| 485 |
extended function type information in C mode (#GH41465). Function conversions |
| 486 |
that were previously incorrectly accepted in case of other irrelevant |
| 487 |
conditions are now consistently diagnosed, identical to C++ mode. |
| 488 |
|
| 489 |
- Fix false-positive unused label diagnostic when a label is used in a named break |
| 490 |
or continue (#GH166013) |
| 491 |
- Clang now emits a diagnostic in case `vector_size` or `ext_vector_type` |
| 492 |
attributes are used with a negative size (#GH165463). |
| 493 |
- Clang no longer emits ``-Wmissing-noreturn`` for virtual methods where |
| 494 |
the function body consists of a `throw` expression (#GH167247). |
| 495 |
|
| 496 |
- A new warning ``-Wenum-compare-typo`` has been added to detect potential erroneous |
| 497 |
comparison operators when mixed with bitwise operators in enum value initializers. |
| 498 |
This can be locally disabled by explicitly casting the initializer value. |
| 499 |
- Clang now provides correct caret placement when attributes appear before |
| 500 |
`enum class` (#GH163224). |
| 501 |
|
| 502 |
- A new warning ``-Wshadow-header`` has been added to detect when a header file |
| 503 |
is found in multiple search directories (excluding system paths). |
| 504 |
|
| 505 |
- Clang now detects potential missing format and format_matches attributes on function, |
| 506 |
Objective-C method and block declarations when calling format functions. It is part |
| 507 |
of the format-nonliteral diagnostic (#GH60718) |
| 508 |
|
| 509 |
- Fixed a crash when enabling ``-fdiagnostics-format=sarif`` and the output |
| 510 |
carries messages like 'In file included from ...' or 'In module ...'. |
| 511 |
Now the include/import locations are written into `sarif.run.result.relatedLocations`. |
| 512 |
|
| 513 |
- Clang now generates a fix-it for C++20 designated initializers when the |
| 514 |
initializers do not match the declaration order in the structure. |
| 515 |
|
| 516 |
- No longer emitting a ``-Wpre-c2y-compat`` or extension diagnostic about use |
| 517 |
of octal literals with a ``0o`` prefix, and no longer emitting a |
| 518 |
``-Wdeprecated-octal-literals`` diagnostic for use of octal literals without |
| 519 |
a ``0o`` prefix, when the literal is expanded from a macro defined in a |
| 520 |
system header. (#GH192389) |
| 521 |
|
| 522 |
Improvements to Clang's time-trace |
| 523 |
---------------------------------- |
| 524 |
|
| 525 |
Improvements to Coverage Mapping |
| 526 |
-------------------------------- |
| 527 |
|
| 528 |
- [MC/DC] Unary logical not `!` among binary operators is recognized |
| 529 |
as a part of the expression. (#GH124563) |
| 530 |
|
| 531 |
Bug Fixes in This Version |
| 532 |
------------------------- |
| 533 |
- Fix a crash when marco name is empty in ``#pragma push_macro("")`` or |
| 534 |
``#pragma pop_macro("")``. (#GH149762). |
| 535 |
- Fix a crash in variable length array (e.g. ``int a[*]``) function parameter type |
| 536 |
being used in ``_Countof`` expression. (#GH152826). |
| 537 |
- ``-Wunreachable-code`` now diagnoses tautological or contradictory |
| 538 |
comparisons such as ``x != 0 || x != 1.0`` and ``x == 0 && x == 1.0`` on |
| 539 |
targets that treat ``_Float16``/``__fp16`` as native scalar types. Previously |
| 540 |
the warning was silently lost because the operands differed only by an implicit |
| 541 |
cast chain. (#GH149967). |
| 542 |
- Fix crash in ``__builtin_function_start`` by checking for invalid |
| 543 |
first parameter. (#GH113323). |
| 544 |
- Fixed a crash with incompatible pointer to integer conversions in designated |
| 545 |
initializers involving string literals. (#GH154046) |
| 546 |
- Fix crash on CTAD for alias template. (#GH131342), (#GH131408) |
| 547 |
- Clang now emits a frontend error when a function marked with the `flatten` attribute |
| 548 |
calls another function that requires target features not enabled in the caller. This |
| 549 |
prevents a fatal error in the backend. |
| 550 |
- Fixed scope of typedefs present inside a template class. (#GH91451) |
| 551 |
- Builtin elementwise operators now accept vector arguments that have different |
| 552 |
qualifiers on their elements. For example, vector of 4 ``const float`` values |
| 553 |
and vector of 4 ``float`` values. (#GH155405) |
| 554 |
- Fixed inconsistent shadow warnings for lambda capture of structured bindings. |
| 555 |
Previously, ``[val = val]`` (regular parameter) produced no warnings with ``-Wshadow`` |
| 556 |
while ``[a = a]`` (where ``a`` is from ``auto [a, b] = std::make_pair(1, 2)``) |
| 557 |
incorrectly produced warnings. Both cases now consistently show no warnings with |
| 558 |
``-Wshadow`` and show uncaptured-local warnings with ``-Wshadow-all``. (#GH68605) |
| 559 |
- Fixed a failed assertion with a negative limit parameter value inside of |
| 560 |
``__has_embed``. (#GH157842) |
| 561 |
- Fixed an assertion when an improper use of the ``malloc`` attribute targeting |
| 562 |
a function without arguments caused us to try to access a non-existent argument. |
| 563 |
(#GH159080) |
| 564 |
- Fixed a failed assertion with empty filename arguments in ``__has_embed``. (#GH159898) |
| 565 |
- Fixed a failed assertion with empty filename in ``#embed`` directive. (#GH162951) |
| 566 |
- Fixed a crash triggered by unterminated ``__has_embed``. (#GH162953) |
| 567 |
- Accept empty enumerations in MSVC-compatible C mode. (#GH114402) |
| 568 |
- Fix a bug leading to incorrect code generation with complex number compound assignment and bitfield values, which also caused a crash with UBsan. (#GH166798) |
| 569 |
- Fixed false-positive shadow diagnostics for lambdas in explicit object member functions. (#GH163731) |
| 570 |
- Fix an assertion failure when a ``target_clones`` attribute is only on the |
| 571 |
forward declaration of a multiversioned function. (#GH165517) (#GH129483) |
| 572 |
- Fix a crash caused by invalid format string in printf-like functions with ``-Wunsafe-buffer-usage-in-libc-call`` option enabled. (#GH170496) |
| 573 |
- Fixed a crash when parsing ``#embed`` parameters with unmatched closing brackets. (#GH152829) |
| 574 |
- Fixed a crash when compiling ``__real__`` or ``__imag__`` unary operator on scalar value with type promotion. (#GH160583) |
| 575 |
- Fixed a crash when parsing invalid nested name specifier sequences |
| 576 |
containing a single colon. (#GH167905) |
| 577 |
- Fixed a crash when parsing malformed #pragma clang loop vectorize_width(4,8,16) |
| 578 |
by diagnosing invalid comma-separated argument lists. (#GH166325) |
| 579 |
- Clang now treats enumeration constants of fixed-underlying enums as the enumerated type. (#GH172118) |
| 580 |
- Fixed a failed assertion in the preprocessor when ``__has_embed`` parameters are missing parentheses. (#GH175088) |
| 581 |
- Fixed the interaction between ``-pedantic-errors`` and ``-Wno-error=X``. |
| 582 |
Previously, ``-Wno-error=X`` failed to downgrade ``-pedantic-errors`` |
| 583 |
diagnostics to warnings (e.g., ``-pedantic-errors -Wno-error=long-long`` |
| 584 |
still emitted an error for ``long long`` in C89 mode). Now ``-Wno-error=X`` |
| 585 |
correctly downgrades the diagnostic to a warning, matching GCC's behavior. |
| 586 |
(#GH184250) |
| 587 |
|
| 588 |
Bug Fixes to Compiler Builtins |
| 589 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 590 |
- Fix an ambiguous reference to the builtin `type_info` (available when using |
| 591 |
`-fms-compatibility`) with modules. (#GH38400) |
| 592 |
|
| 593 |
Bug Fixes to Attribute Support |
| 594 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 595 |
|
| 596 |
- ``[[nodiscard]]`` is now respected on Objective-C and Objective-C++ methods |
| 597 |
(#GH141504) and on types returned from indirect calls (#GH142453). |
| 598 |
- Fixes some late parsed attributes, when applied to function definitions, not being parsed |
| 599 |
in function try blocks, and some situations where parsing of the function body |
| 600 |
is skipped, such as error recovery, code completion, and msvc-compatible delayed |
| 601 |
template parsing. (#GH153551) |
| 602 |
- Using ``[[gnu::cleanup(some_func)]]`` where some_func is annotated with |
| 603 |
``[[gnu::error("some error")]]`` now correctly triggers an error. (#GH146520) |
| 604 |
- Fix a crash when the function name is empty in the `swift_name` attribute. (#GH157075) |
| 605 |
- Fixes crashes or missing diagnostics with the `device_kernel` attribute. (#GH161905) |
| 606 |
- Fix handling of parameter indexes when an attribute is applied to a C++23 explicit object member function. |
| 607 |
- Fixed several false positives and false negatives in function effect (`nonblocking`) analysis. (#GH166078) (#GH166101) (#GH166110) |
| 608 |
- Fix ``cleanup`` attribute by delaying type checks until after the type is deduced. (#GH129631) |
| 609 |
- Fix a crash when instantiating a function template with ``constructor`` or ``destructor`` |
| 610 |
attributes without a priority argument. (#GH169072) |
| 611 |
- Fix an assertion when using ``target_clones`` attribute with empty argument list. (#GH173684) |
| 612 |
- Fixed a crash when applying the ``sentinel`` attribute to block variables. (#GH173820) |
| 613 |
|
| 614 |
Bug Fixes to C++ Support |
| 615 |
^^^^^^^^^^^^^^^^^^^^^^^^ |
| 616 |
- Diagnose binding a reference to ``*nullptr`` during constant evaluation. (#GH48665) |
| 617 |
- Suppress ``-Wdeprecated-declarations`` in implicitly generated functions. (#GH147293) |
| 618 |
- Fix a crash when deleting a pointer to an incomplete array (#GH150359). |
| 619 |
- Fixed a mismatched lambda scope bug when propagating up ``consteval`` within nested lambdas. (#GH145776) |
| 620 |
- Disallow immediate escalation in destructors. (#GH109096) |
| 621 |
- Fix an assertion failure when expression in assumption attribute |
| 622 |
(``[[assume(expr)]]``) creates temporary objects. |
| 623 |
- Fix the dynamic_cast to final class optimization to correctly handle |
| 624 |
casts that are guaranteed to fail (#GH137518). |
| 625 |
- Fix bug rejecting partial specialization of variable templates with auto NTTPs (#GH118190). |
| 626 |
- Fix a crash if errors "member of anonymous [...] redeclares" and |
| 627 |
"initializing multiple members of union" coincide (#GH149985). |
| 628 |
- Fix a crash when using ``explicit(bool)`` in pre-C++11 language modes. (#GH152729) |
| 629 |
- Fix the parsing of variadic member functions when the ellipis immediately follows a default argument.(#GH153445) |
| 630 |
- Fix a crash when using an explicit object parameter in a non-member function with an invalid return type.(#GH173943) |
| 631 |
- Fixed a bug that caused ``this`` captured by value in a lambda with a dependent explicit object parameter to not be |
| 632 |
instantiated properly. (#GH154054) |
| 633 |
- Fixed a bug where our ``member-like constrained friend`` checking caused an incorrect analysis of lambda captures. (#GH156225) |
| 634 |
- Fixed a crash when implicit conversions from initialize list to arrays of |
| 635 |
unknown bound during constant evaluation. (#GH151716) |
| 636 |
- Support the dynamic_cast to final class optimization with pointer |
| 637 |
authentication enabled. (#GH152601) |
| 638 |
- Fix the check for narrowing int-to-float conversions, so that they are detected in |
| 639 |
cases where converting the float back to an integer is undefined behaviour (#GH157067). |
| 640 |
- Stop rejecting C++11-style attributes on the first argument of constructors in older |
| 641 |
standards. (#GH156809). |
| 642 |
- Fix a crash when applying binary or ternary operators to two same function types with different spellings, |
| 643 |
where at least one of the function parameters has an attribute which affects |
| 644 |
the function type. |
| 645 |
- Fix an assertion failure when a ``constexpr`` variable is only referenced through |
| 646 |
``__builtin_addressof``, and related issues with builtin arguments. (#GH154034) |
| 647 |
- Fix an assertion failure when taking the address on a non-type template parameter argument of |
| 648 |
object type. (#GH151531) |
| 649 |
- Suppress ``-Wdouble-promotion`` when explicitly asked for with C++ list initialization (#GH33409). |
| 650 |
- Fix the result of `__builtin_is_implicit_lifetime` for types with a user-provided constructor. (#GH160610) |
| 651 |
- Correctly deduce return types in ``decltype`` expressions. (#GH160497) (#GH56652) (#GH116319) (#GH161196) |
| 652 |
- Fixed a crash in the pre-C++23 warning for attributes before a lambda declarator (#GH161070). |
| 653 |
- Fix a crash when attempting to deduce a deduction guide from a non deducible template template parameter. (#130604) |
| 654 |
- Fix for clang incorrectly rejecting the default construction of a union with |
| 655 |
nontrivial member when another member has an initializer. (#GH81774) |
| 656 |
- Fixed a template depth issue when parsing lambdas inside a type constraint. (#GH162092) |
| 657 |
- Fix the support of zero-length arrays in SFINAE context. (#GH170040) |
| 658 |
- Diagnose unresolved overload sets in non-dependent compound requirements. (#GH51246) (#GH97753) |
| 659 |
- Fix a crash when extracting unavailable member type from alias in template deduction. (#GH165560) |
| 660 |
- Fix incorrect diagnostics for lambdas with init-captures inside braced initializers. (#GH163498) |
| 661 |
- Fixed an issue where templates prevented nested anonymous records from checking the deletion of special members. (#GH167217) |
| 662 |
- Fixed serialization of pack indexing types, where we failed to expand those packs from a PCH/module. (#GH172464) |
| 663 |
- Fixed spurious diagnoses of certain nested lambda expressions. (#GH149121) (#GH156579) |
| 664 |
- Fix the result of ``__is_pointer_interconvertible_base_of`` when arguments are qualified and passed via template parameters. (#GH135273) |
| 665 |
- Fixed a crash when evaluating nested requirements in requires-expressions that reference invented parameters. (#GH166325) |
| 666 |
- Fixed a crash when standard comparison categories (e.g. ``std::partial_ordering``) are defined with incorrect static member types. (#GH170015) (#GH56571) |
| 667 |
- Fixed a crash when parsing the ``enable_if`` attribute on C function declarations with identifier-list parameters. (#GH173826) |
| 668 |
- Fixed an assertion failure triggered by nested lambdas during capture handling. (#GH172814) |
| 669 |
- Fixed an assertion failure in vector conversions involving instantiation-dependent template expressions. (#GH173347) |
| 670 |
- Fixed an issue where recursive instantiation could lead to escape of SFINAE errors. (#GH179118) |
| 671 |
- Fixed an assertion failure in floating conversion narrowing caused by C++ constant expression checks in C23 mode. (#GH173847) |
| 672 |
|
| 673 |
Bug Fixes to AST Handling |
| 674 |
^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 675 |
- Fix incorrect name qualifiers applied to alias CTAD. (#GH136624) |
| 676 |
- Fixed ElaboratedTypes appearing within NestedNameSpecifier, which was not a |
| 677 |
legal representation. This is fixed because ElaboratedTypes don't exist anymore. (#GH43179) (#GH68670) (#GH92757) |
| 678 |
- Fix unrecognized html tag causing undesirable comment lexing (#GH152944) |
| 679 |
- Fix comment lexing of special command names (#GH152943) |
| 680 |
- Use `extern` as a hint to continue parsing when recovering from a malformed declaration. |
| 681 |
|
| 682 |
Miscellaneous Bug Fixes |
| 683 |
^^^^^^^^^^^^^^^^^^^^^^^ |
| 684 |
- Fixed missing diagnostics of ``diagnose_if`` on templates involved in initialization. (#GH160776) |
| 685 |
|
| 686 |
Miscellaneous Clang Crashes Fixed |
| 687 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 688 |
|
| 689 |
- Fixed a crash when attempting to jump over initialization of a variable with variably modified type. (#GH175540) |
| 690 |
- Fixed a crash when ``decltype(__builtin_FUNCTION())`` is used as a template type argument. (#GH167433) |
| 691 |
|
| 692 |
OpenACC Specific Changes |
| 693 |
------------------------ |
| 694 |
|
| 695 |
Target Specific Changes |
| 696 |
----------------------- |
| 697 |
|
| 698 |
AMDGPU Support |
| 699 |
^^^^^^^^^^^^^^ |
| 700 |
|
| 701 |
NVPTX Support |
| 702 |
^^^^^^^^^^^^^^ |
| 703 |
|
| 704 |
X86 Support |
| 705 |
^^^^^^^^^^^ |
| 706 |
- More SSE, AVX and AVX512 intrinsics, including initializers and general |
| 707 |
arithmetic can now be used in C++ constant expressions. |
| 708 |
- Some SSE, AVX and AVX512 intrinsics have been converted to wrap |
| 709 |
generic __builtin intrinsics. |
| 710 |
- NOTE: Please avoid use of the __builtin_ia32_* intrinsics - these are not |
| 711 |
guaranteed to exist in future releases, or match behaviour with previous |
| 712 |
releases of clang or other compilers. |
| 713 |
- Remove `m[no-]avx10.x-[256,512]` and `m[no-]evex512` options from Clang |
| 714 |
driver. |
| 715 |
- Remove `[no-]evex512` feature request from intrinsics and builtins. |
| 716 |
- Change features `avx10.x-[256,512]` to `avx10.x`. |
| 717 |
- `-march=wildcatlake` is now supported. |
| 718 |
- `-march=novalake` is now supported. |
| 719 |
|
| 720 |
Arm and AArch64 Support |
| 721 |
^^^^^^^^^^^^^^^^^^^^^^^ |
| 722 |
- Support has been added for the following processors (command-line identifiers in parentheses): |
| 723 |
|
| 724 |
- Ampere Computing Ampere1C (``ampere1c``) |
| 725 |
- Arm C1-Nano (``c1-nano``) |
| 726 |
- Arm C1-Pro (``c1-pro``) |
| 727 |
- Arm C1-Premium (``c1-premium``) |
| 728 |
- Arm C1-Ultra (``c1-ultra``) |
| 729 |
- More intrinsics for the following AArch64 instructions: |
| 730 |
FCVTZ[US], FCVTN[US], FCVTM[US], FCVTP[US], FCVTA[US] |
| 731 |
- Support level for Function Multi-Versioning (FMV) has been upgraded to Release in ACLE. |
| 732 |
|
| 733 |
- Resolver functions can use the PAC and BTI hardening settings. |
| 734 |
- Users can override function version priority. |
| 735 |
- Unreachable function versions are diagnosed and ignored. |
| 736 |
|
| 737 |
Android Support |
| 738 |
^^^^^^^^^^^^^^^ |
| 739 |
|
| 740 |
Windows Support |
| 741 |
^^^^^^^^^^^^^^^ |
| 742 |
- clang-cl now supports /arch:AVX10.1 and /arch:AVX10.2. |
| 743 |
- clang-cl now supports /vlen, /vlen=256 and /vlen=512. |
| 744 |
|
| 745 |
- Clang now supports MSVC vector deleting destructors (GH19772). |
| 746 |
|
| 747 |
LoongArch Support |
| 748 |
^^^^^^^^^^^^^^^^^ |
| 749 |
- Enable linker relaxation by default for loongarch64. |
| 750 |
|
| 751 |
- Introduce LASX and LSX conversion intrinsics. |
| 752 |
|
| 753 |
- `__attribute__((target("lasx")))` now implies the `lsx` feature. |
| 754 |
|
| 755 |
- DWARF fission is now compatible with linker relaxations, allowing `-gsplit-dwarf` and `-mrelax` |
| 756 |
to be used together when building for the LoongArch platform. |
| 757 |
|
| 758 |
- Add support for LoongArch32, including toolchain options and pre-defined macros. |
| 759 |
|
| 760 |
RISC-V Support |
| 761 |
^^^^^^^^^^^^^^ |
| 762 |
|
| 763 |
- Add support for `__attribute__((interrupt("rnmi")))` to be used with the `Smrnmi` extension. |
| 764 |
With this the `Smrnmi` extension is fully supported. |
| 765 |
|
| 766 |
- Add `-march=unset` to clear any previous `-march=` value. This ISA string will |
| 767 |
be computed from `-mcpu` or the platform default. |
| 768 |
|
| 769 |
- `__GCC_CONSTRUCTIVE_SIZE` and `__GCC_DESTRUCTIVE_SIZE` are changed to 64. These values are |
| 770 |
unstable according to `Clang's documentation <https://clang.llvm.org/docs/LanguageExtensions.html#gcc-destructive-size-and-gcc-constructive-size>`_. |
| 771 |
|
| 772 |
- DWARF fission is now compatible with linker relaxations, allowing `-gsplit-dwarf` and `-mrelax` |
| 773 |
to be used together when building for the RISC-V platform. |
| 774 |
|
| 775 |
CUDA/HIP Language Changes |
| 776 |
^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 777 |
|
| 778 |
- Clang now supports C++17 Class Template Argument Deduction (CTAD) in CUDA/HIP |
| 779 |
device code by treating deduction guides as if they were ``__host__ __device__``. |
| 780 |
|
| 781 |
- Clang avoids ambiguous CTAD in CUDA/HIP by not synthesizing duplicate implicit |
| 782 |
deduction guides when ``__host__`` and ``__device__`` constructors differ only |
| 783 |
in CUDA target attributes (same signature and constraints). |
| 784 |
|
| 785 |
- Clang diagnoses CUDA/HIP deduction guides that are annotated as host-only, |
| 786 |
device-only, or ``__global__`` as errors. Explicit ``__host__ __device__`` |
| 787 |
deduction guides remain accepted for now but are deprecated and will be |
| 788 |
rejected in a future version of Clang; deduction guides do not participate |
| 789 |
in code generation and are treated as implicitly host+device. |
| 790 |
|
| 791 |
- Clang preserves distinct implicit deduction guides for constructors that differ |
| 792 |
by constraints, so constraint-based CTAD works in CUDA/HIP device code as in |
| 793 |
standard C++. |
| 794 |
|
| 795 |
CUDA Support |
| 796 |
^^^^^^^^^^^^ |
| 797 |
|
| 798 |
- Fixed an assertion failure when processing CUDA files with `-fsyntax-only` or |
| 799 |
device architecture flags. |
| 800 |
|
| 801 |
- Support calling `consteval` function between different target. |
| 802 |
|
| 803 |
PowerPC Support |
| 804 |
^^^^^^^^^^^^^^^ |
| 805 |
|
| 806 |
- Prototyped Dense Math Facility builtins. |
| 807 |
- Prototyped initial support for AMO load builtins. |
| 808 |
- Add support for ``-fpatchable-function-entry`` on PPC64LE. |
| 809 |
|
| 810 |
AIX Support |
| 811 |
^^^^^^^^^^^ |
| 812 |
|
| 813 |
NetBSD Support |
| 814 |
^^^^^^^^^^^^^^ |
| 815 |
|
| 816 |
WebAssembly Support |
| 817 |
^^^^^^^^^^^^^^^^^^^ |
| 818 |
|
| 819 |
- Fix a bug so that ``__has_attribute(musttail)`` is no longer true when WebAssembly's tail-call is not enabled. (#GH163256) |
| 820 |
|
| 821 |
- The `wasm32-wasi` target has been renamed to `wasm32-wasip1`. The old |
| 822 |
option is still recognized, though by default will emit a deprecation |
| 823 |
warning. |
| 824 |
|
| 825 |
AVR Support |
| 826 |
^^^^^^^^^^^ |
| 827 |
|
| 828 |
DWARF Support in Clang |
| 829 |
---------------------- |
| 830 |
|
| 831 |
Floating Point Support in Clang |
| 832 |
------------------------------- |
| 833 |
|
| 834 |
Fixed Point Support in Clang |
| 835 |
---------------------------- |
| 836 |
|
| 837 |
AST Matchers |
| 838 |
------------ |
| 839 |
- Removed elaboratedType matchers, and related nested name specifier changes, |
| 840 |
following the corresponding changes in the clang AST. |
| 841 |
- Ensure ``hasBitWidth`` doesn't crash on bit widths that are dependent on template |
| 842 |
parameters. |
| 843 |
- Remove the ``dependentTemplateSpecializationType`` matcher, as the |
| 844 |
corresponding AST node was removed. This matcher was never very useful, since |
| 845 |
there was no way to match on its template name. |
| 846 |
- Add a boolean member ``IgnoreSystemHeaders`` to ``MatchFinderOptions``. This |
| 847 |
allows it to ignore nodes in system headers when traversing the AST. |
| 848 |
|
| 849 |
- ``hasConditionVariableStatement`` now supports ``for`` loop, ``while`` loop |
| 850 |
and ``switch`` statements. |
| 851 |
- Fixed detection of explicit parameter lists in ``LambdaExpr``. (#GH168452) |
| 852 |
- Added ``hasExplicitParameters`` for ``LambdaExpr`` as an output attribute to |
| 853 |
AST JSON dumps. |
| 854 |
- Add ``arrayTypeLoc`` matcher for matching ``ArrayTypeLoc``. |
| 855 |
|
| 856 |
clang-format |
| 857 |
------------ |
| 858 |
- Add ``SpaceInEmptyBraces`` option and set it to ``Always`` for WebKit style. |
| 859 |
- Add ``NumericLiteralCase`` option for enforcing character case in numeric |
| 860 |
literals. |
| 861 |
- Add ``Leave`` suboption to ``IndentPPDirectives``. |
| 862 |
- Add ``AllowBreakBeforeQtProperty`` option. |
| 863 |
- Add ``BreakAfterOpenBracketBracedList'', ``BreakAfterOpenBracketFunction'', |
| 864 |
``BreakAfterOpenBracketIf``, ``BreakAfterOpenBracketLoop``, |
| 865 |
``BreakAfterOpenBracketSwitch``, ``BreakBeforeCloseBracketBracedList'', |
| 866 |
``BreakBeforeCloseBracketFunction``, ``BreakBeforeCloseBracketIf``, |
| 867 |
``BreakBeforeCloseBracketLoop``, ``BreakBeforeCloseBracketSwitch`` options. |
| 868 |
- Deprecate ``AlwaysBreak`` and ``BlockIndent`` suboptions from the |
| 869 |
``AlignAfterOpenBracket`` option, and make ``AlignAfterOpenBracket`` a |
| 870 |
``bool`` type. |
| 871 |
- Add ``AlignPPAndNotPP`` suboption to ``AlignTrailingComments``. |
| 872 |
- Rename ``(Binary|Decimal|Hex)MinDigits`` to ``...MinDigitsInsert`` and add |
| 873 |
``(Binary|Decimal|Hex)MaxDigitsSeparator`` suboptions to |
| 874 |
``IntegerLiteralSeparator``. |
| 875 |
|
| 876 |
libclang |
| 877 |
-------- |
| 878 |
|
| 879 |
Code Completion |
| 880 |
--------------- |
| 881 |
|
| 882 |
Static Analyzer |
| 883 |
--------------- |
| 884 |
|
| 885 |
New checkers or options |
| 886 |
^^^^^^^^^^^^^^^^^^^^^^^ |
| 887 |
|
| 888 |
- Introduced the ``alpha.core.StoreToImmutable`` checker to catch writes to |
| 889 |
immutable memory. See the `documentation |
| 890 |
<https://clang.llvm.org/docs/analyzer/checkers.html#alpha-core-storetoimmutable-c-c>`__. |
| 891 |
(#GH150417) |
| 892 |
- Introduced the ``core.NullPointerArithm`` checker to catch arithmetic on |
| 893 |
null pointers. See the `documentation |
| 894 |
<https://clang.llvm.org/docs/analyzer/checkers.html#core-nullpointerarithm-c-c>`__. |
| 895 |
(#GH157129) |
| 896 |
- The ``core.CallAndMessage`` checker gained a new checker option called |
| 897 |
``ArgPointeeInitializednessComplete``, enabling suppression of diagnostics |
| 898 |
of this checker in case at least some parts of the object was initialized. |
| 899 |
By default it's disabled. (#GH164600) |
| 900 |
|
| 901 |
Crash and bug fixes |
| 902 |
^^^^^^^^^^^^^^^^^^^ |
| 903 |
|
| 904 |
- Fixed a crash in the static analyzer that when the expression in an |
| 905 |
``[[assume(expr)]]`` attribute was enclosed in parentheses. (#GH151529) |
| 906 |
- Fixed an assertion failure of ``[[assume(expr)]]`` when the expression |
| 907 |
couldn't be folded into a constant by the engine. (#GH151854) |
| 908 |
- ``__datasizeof`` (C++) and ``_Countof`` (C) no longer cause a failed assertion |
| 909 |
when given an operand of VLA type. (#GH151711) |
| 910 |
- Sometimes the ``unix.Malloc`` checker asserted when constructing a report under |
| 911 |
rare circumstances. (#GH149754) |
| 912 |
- The ``core.StackAddressEscape`` checker was crashing if a lambda or |
| 913 |
Objective-C block expression captured itself. (#GH169208) |
| 914 |
- Fixed an assertion in the ``alpha.unix.cstring`` checker package when |
| 915 |
non-default address-spaces were used in ``memcpy``. (#GH153498) |
| 916 |
- The engine sometimes crashed when modeling a parenthesis initializer-list |
| 917 |
expression. (#GH147686) |
| 918 |
- `crosscheck-with-z3 <https://clang.llvm.org/docs/analyzer/user-docs/Options.html#crosscheck-with-z3>`__ |
| 919 |
config option sometimes crashed. (#GH168034) |
| 920 |
- The ``alpha.core.StdVariant`` checker sometimes crashed when unknown |
| 921 |
values or type aliases were involved. (#GH167341) |
| 922 |
- Hardened the engine for supporting platforms where different address-space |
| 923 |
pointers might have different sizes. (#GH151370) |
| 924 |
- The ``core.builtin.BuiltinFunctions`` checker crashed when passing |
| 925 |
``_BitInt(N)`` or ``__int128_t`` to ``__builtin_add_overflow`` or similar |
| 926 |
checked arithmetic builtin functions. (#GH173795) |
| 927 |
- Fixed a crash introduced in clang-20 when analyzing some "swap" functions. |
| 928 |
(#GH178797) |
| 929 |
- Fixed a crash introduced in clang-20 in the ``unix.Malloc`` checker when |
| 930 |
analyzing functions that had both of the ``ownership_returns`` and |
| 931 |
``ownership_takes`` attributes. (#GH183344) |
| 932 |
|
| 933 |
Improvements |
| 934 |
^^^^^^^^^^^^ |
| 935 |
|
| 936 |
.. |ss| raw:: html |
| 937 |
|
| 938 |
<strike> |
| 939 |
|
| 940 |
.. |se| raw:: html |
| 941 |
|
| 942 |
</strike> |
| 943 |
|
| 944 |
.. |br| raw:: html |
| 945 |
|
| 946 |
<br /> |
| 947 |
|
| 948 |
- |ss| The `expand-macros <https://clang.llvm.org/docs/analyzer/user-docs/Options.html#expand-macros>`__ |
| 949 |
analyzer config option now formats the macro expansions using LLVM-style |
| 950 |
clang-format. (#GH154743) |se| |br| |
| 951 |
**EDIT:** This feature was later reverted from upstream LLVM (#GH186614), and |
| 952 |
it's currently not planned to land again due to the library dependencies it |
| 953 |
would need. We didn't revert this change from the release branch for ABI |
| 954 |
compatibility reasons. We are sorry for the inconvinience. |
| 955 |
Read more about this in the relevant |
| 956 |
`LLVM Discourse thread <https://discourse.llvm.org/t/can-we-link-clang-format-into-clanganalysis/89014/7>`__. |
| 957 |
|
| 958 |
- ``[[clang::suppress]]`` now can suppress diagnostics within primary templates. |
| 959 |
(#GH168954) |
| 960 |
- Improved the false-positive suppression for ``std::unique_ptr`` and |
| 961 |
``std::shared_ptr`` in the ``unix.Malloc`` checker. (#GH60896) |
| 962 |
- Improved the false-positive suppression for ``unix.Malloc`` on protobuf code. |
| 963 |
(#GH162124) |
| 964 |
- Supporting parenthesized initialization. (#GH148875) |
| 965 |
- Fixed a false-positive of ``cplusplus.PlacementNew`` by assuming that |
| 966 |
placement-new doesn't allocate. (#GH149240) |
| 967 |
- The ``unix.Malloc`` checker can now detect use-after-free even if the |
| 968 |
address does not directly refer to the beginning of the object. |
| 969 |
(For example, taking the address of a field.) (#GH152446) |
| 970 |
- Improved the modeling of cstring lengths in the ``alpha.unix.cstring`` |
| 971 |
checkers. (#GH159795) |
| 972 |
- The ``strxfrm`` is modeled in the ``alpha.unix.cstring`` checkers. (#GH156507) |
| 973 |
- Handling of placement-new expressions were improved in the |
| 974 |
``alpha.core.PointerArithm`` checker. (#GH155855) |
| 975 |
- The ``security.ArrayBound`` checker now mentions the element count in |
| 976 |
underflow reports. (#GH158639) |
| 977 |
- The engine had a ``PrivateMethodCache`` that was not cleaned up - potentially |
| 978 |
causing spuriously failing Objective-C unittest failures because that uses the |
| 979 |
same process address-space but different clang instances inside - filling up |
| 980 |
the static cache and cause spurious hits, thus crashes. It only affects |
| 981 |
unittests. (#GH161327) |
| 982 |
- The internal ``-analyze-function`` option now also accepts Unified Symbol |
| 983 |
Resolution (USR) names. See the `documentation |
| 984 |
<https://clang.llvm.org/docs/analyzer/developer-docs/DebugChecks.html>`__. |
| 985 |
(#GH161666) |
| 986 |
- The ``dump-entry-point-stats-to-csv`` analyzer config now includes the |
| 987 |
Translation Unit path and the analysis entry point USR for each entry. |
| 988 |
The CSV output got many more improvements. See the `documentation |
| 989 |
<https://clang.llvm.org/docs/analyzer/developer-docs/Statistics.html>`__. |
| 990 |
(#GH162839) |
| 991 |
- The engine became smarter in folding binary operations. (#GH161537) |
| 992 |
- The `model-path <https://clang.llvm.org/docs/analyzer/user-docs/Options.html#model-path>`__ |
| 993 |
analyzer config option now honors virtual file system |
| 994 |
overlays (``-ivfsoverlay``). Similarly, the ``optin.taint.TaintPropagation`` |
| 995 |
checker-specific ``Config`` also accepts a virtual file path for the taint |
| 996 |
configuration file. See the `documentation |
| 997 |
<https://clang.llvm.org/docs/analyzer/user-docs/TaintAnalysisConfiguration.html>`__. |
| 998 |
(#GH164323, #GH159164) |
| 999 |
- The dynamic memory modeling got more accurate by keeping extent information |
| 1000 |
for longer. (#GH163562) |
| 1001 |
- The ``unix.BlockInCriticalSection`` checker started honoring ``defer_lock_t``. |
| 1002 |
(#GH166573) |
| 1003 |
- Improved loop unrolling for compile-time upper-bounded loops. See the |
| 1004 |
documentation of `unroll-loops |
| 1005 |
<https://clang.llvm.org/docs/analyzer/user-docs/Options.html#unroll-loops>`__. |
| 1006 |
(#GH169400) |
| 1007 |
- Improved the ``cplusplus.Move`` checker by relaxing how it handles opaque |
| 1008 |
function calls, making it more accurate. (#GH169626) |
| 1009 |
|
| 1010 |
Moved checkers |
| 1011 |
^^^^^^^^^^^^^^ |
| 1012 |
|
| 1013 |
- The functionality of the checkers in the package ``valist.*`` was |
| 1014 |
consolidated as a single new checker called ``security.VAList``. |
| 1015 |
Diagnostic messages were also improved. |
| 1016 |
(#GH156682, #GH157846) |
| 1017 |
|
| 1018 |
Removed checkers |
| 1019 |
^^^^^^^^^^^^^^^^ |
| 1020 |
|
| 1021 |
- The ``alpha.core.CastSize`` checker was removed. It had a poor |
| 1022 |
false-positives / true-positive ratio, thus rarely used in practice. |
| 1023 |
(#GH156350) |
| 1024 |
|
| 1025 |
Diagnostic changes |
| 1026 |
^^^^^^^^^^^^^^^^^^ |
| 1027 |
|
| 1028 |
- Harmonized the ``unix.Malloc`` checker diagnostics to use "release" instead |
| 1029 |
of "free". (#GH150935) |
| 1030 |
- ``sarif-html`` outputs no longer report detected issues 3 times. (#GH158103) |
| 1031 |
- ``sarif`` reports now also emit the ``IssueHash`` field. (#GH158159) |
| 1032 |
|
| 1033 |
.. _release-notes-sanitizers: |
| 1034 |
|
| 1035 |
Sanitizers |
| 1036 |
---------- |
| 1037 |
- Improved documentation for legacy ``no_sanitize`` attributes. |
| 1038 |
- Added ``__builtin_allow_sanitize_check("name")`` that returns true if the |
| 1039 |
specified sanitizer is enabled for the current function (after inlining). |
| 1040 |
This allows for conditional code execution based on sanitizer enablement, |
| 1041 |
respecting ``no_sanitize`` attributes. It currently supports sanitizers: |
| 1042 |
"address", "kernel-address", "hwaddress", "kernel-hwaddress", "memory", |
| 1043 |
"kernel-memory", and "thread". |
| 1044 |
|
| 1045 |
|
| 1046 |
Python Binding Changes |
| 1047 |
---------------------- |
| 1048 |
- Exposed ``clang_Cursor_isFunctionInlined``. |
| 1049 |
- Exposed ``clang_getCursorLanguage`` via ``Cursor.language``. |
| 1050 |
- Add all missing ``CursorKind``s, ``TypeKind``s and |
| 1051 |
``ExceptionSpecificationKind``s from ``Index.h`` |
| 1052 |
|
| 1053 |
OpenMP Support |
| 1054 |
-------------- |
| 1055 |
- Added parsing and semantic analysis support for the ``need_device_addr`` |
| 1056 |
modifier in the ``adjust_args`` clause. |
| 1057 |
- Allow array length to be omitted in array section subscript expression. |
| 1058 |
- Fixed non-contiguous strided update in the ``omp target update`` directive with the ``from`` clause. |
| 1059 |
- Added support for threadset clause in task and taskloop directives. |
| 1060 |
- Properly handle array section/assumed-size array privatization in C/C++. |
| 1061 |
- Added support to handle new syntax of the ``uses_allocators`` clause. |
| 1062 |
- Added support for ``variable-category`` modifier in ``default clause``. |
| 1063 |
- Added support for ``defaultmap`` directive implicit-behavior ``storage``. |
| 1064 |
- Added support for ``defaultmap`` directive implicit-behavior ``private``. |
| 1065 |
- Added parsing and semantic analysis support for ``groupprivate`` directive. |
| 1066 |
- Added support for 'omp fuse' directive. |
| 1067 |
- Updated parsing and semantic analysis support for ``nowait`` clause to accept |
| 1068 |
optional argument in OpenMP >= 60. |
| 1069 |
- Added support for ``default`` clause on ``target`` directive. |
| 1070 |
- Added parsing and semantic analysis support for ``need_device_ptr`` modifier |
| 1071 |
to accept an optional fallback argument (``fb_nullify`` or ``fb_preserve``) |
| 1072 |
with OpenMP >= 61. |
| 1073 |
- ``use_device_ptr`` and ``use_device_addr`` now preserve the original host |
| 1074 |
address when lookup fails. |
| 1075 |
|
| 1076 |
Improvements |
| 1077 |
^^^^^^^^^^^^ |
| 1078 |
- Mapping of expressions that have base-pointers now conforms to the OpenMP's |
| 1079 |
conditional pointer-attachment based on both pointee and poitner being |
| 1080 |
present, and one being new. This also lays the foundation of supporting |
| 1081 |
OpenMP 6.1's attach map-type modifier. |
| 1082 |
- Several improvements were made to the handling of maps on list items involving |
| 1083 |
multiple levels of pointer dereferences, including not mapping intermediate |
| 1084 |
expressions, and grouping the items that share the same base-pointer, as |
| 1085 |
belonging to the same containing structure. |
| 1086 |
- Support of array-sections on ``use_device_addr`` was made more robust, |
| 1087 |
including diagnosing when the array-section's base is not a named-variable. |
| 1088 |
- Handling of ``use_device_addr`` and ``use_device_ptr`` in the presence of |
| 1089 |
other maps with the same base-pointer/variable, was improved. |
| 1090 |
- Preserve the initializer when variable declaration dedution fails for better error recovery. |
| 1091 |
|
| 1092 |
Additional Information |
| 1093 |
====================== |
| 1094 |
|
| 1095 |
A wide variety of additional information is available on the `Clang web |
| 1096 |
page <https://clang.llvm.org/>`_. The web page contains versions of the |
| 1097 |
API documentation which are up-to-date with the Git version of |
| 1098 |
the source code. You can access versions of these documents specific to |
| 1099 |
this release by going into the "``clang/docs/``" directory in the Clang |
| 1100 |
tree. |
| 1101 |
|
| 1102 |
If you have any questions or comments about Clang, please feel free to |
| 1103 |
contact us on the `Discourse forums (Clang Frontend category) |
| 1104 |
<https://discourse.llvm.org/c/clang/6>`_. |