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