| --- | |
| myst: | |
| enable_extensions: | |
| - attrs_block | |
| - colon_fence | |
| - substitution | |
| --- | |
| % If you want to modify sections/contents permanently, you should modify both | |
| % ReleaseNotes.md and ReleaseNotesTemplate.txt. | |
| {#clang-release-releasenotestitle} | |
| # Clang {{ (('(In-Progress) ' if env.app.tags.has('PreRelease') else '') ~ 'Release Notes') if env.config.project == 'Clang' else '|ReleaseNotesTitle|' }} | |
| Written by the [LLVM Team](https://llvm.org/) | |
| ::::{only} PreRelease | |
| :::{warning} | |
| These are in-progress notes for the upcoming Clang {{env.config.version}} release. | |
| Release notes for previous releases can be found on | |
| [the Releases Page](https://llvm.org/releases/). | |
| ::: | |
| :::: | |
| ## Introduction | |
| This document contains the release notes for the Clang C/C++/Objective-C | |
| frontend, part of the LLVM Compiler Infrastructure, release {{env.config.release}}. Here we | |
| describe the status of Clang in some detail, including major | |
| improvements from the previous release and new feature work. For the | |
| general LLVM release notes, see [the LLVM | |
| documentation](https://llvm.org/docs/ReleaseNotes.html). For the libc++ release notes, | |
| see [this page](https://libcxx.llvm.org/ReleaseNotes.html). All LLVM releases | |
| may be downloaded from the [LLVM releases web site](https://llvm.org/releases/). | |
| For more information about Clang or LLVM, including information about the | |
| latest release, please see the [Clang Web Site](https://clang.llvm.org) or the | |
| [LLVM Web Site](https://llvm.org). | |
| ## Potentially Breaking Changes | |
| ### C/C++ Language Potentially Breaking Changes | |
| - `-Wunicode-whitespace` now defaults to an error. | |
| The previous behavior can be restored with `-Wno-error=unicode-whitespace`. | |
| Clang will stop accepting non-ascii whitespaces as token separators | |
| in a future version of Clang. | |
| ### C++ Specific Potentially Breaking Changes | |
| - The `[[carries_dependency]]` attribute is no longer recognized, in any language | |
| mode, as it was removed from the standard by | |
| [P3475R2](https://wg21.link/P3475R2). | |
| ### Objective-C Specific Potentially Breaking Changes | |
| - Fixed an issue where AST consumers based on `RecursiveASTVisitor` would bypass | |
| the exception parameter declaration inside Objective-C `@catch` blocks. This | |
| could cause tooling that previously ignored the parameter declaration to now | |
| find valid issues. (#GH212564) | |
| ### ABI Changes in This Version | |
| - Clang now correctly mangles C++20 parenthesized aggregate initialization | |
| expressions. Previously, initializer arguments could be omitted from the | |
| mangled name, causing distinct entities to receive the same name. | |
| (#GH231953) | |
| - Except on PlayStation, Clang now derives the x86-64 System V AVX ABI level | |
| for 256- and 512-bit vector arguments and returns from effective per-function | |
| target features. Features and `arch=` CPUs that imply AVX or AVX512F are | |
| honored, and calls use the caller's features, matching GCC. Per-function | |
| features cannot lower the translation-unit ABI level; | |
| `-fclang-abi-compat=23` restores the previous behavior. (#GH193298) | |
| - On SPARC, a `_Complex` value with an integer element type is now passed and | |
| returned packed into the one or two integer registers it fits in, matching GCC. | |
| Clang previously passed such a value indirectly and returned it with one part | |
| per register. | |
| `-fclang-abi-compat=23` restores the previous behavior. (#GH212340) | |
| - On SPARC64, a `_Complex char` or `_Complex short` is now | |
| right-justified in its slot in the parameter array, like every other scalar | |
| narrower than a slot, rather than left-justified the way a small struct is. | |
| `-fclang-abi-compat=23` restores the previous behavior. (#GH212340) | |
| - On MIPS, a `_Complex` value with an integer element type is now returned packed | |
| into a single integer register when it fits in one, matching GCC. A `_Complex char` or | |
| `_Complex short`, and on N32/N64 also a `_Complex int`, is no longer returned | |
| with one part per register. `-fclang-abi-compat=23` restores the previous | |
| behavior. (#GH212109) | |
| - On MIPS N32/N64, a `_Complex float` or `_Complex double` argument is now packed | |
| into integer registers, or onto the stack, once there is no longer room to give | |
| each of its parts a floating-point register, matching GCC. Clang previously | |
| always passed the parts separately. `-fclang-abi-compat=23` restores the previous | |
| behavior. (#GH212109) | |
| - On MIPS N32/N64, an `__int128` now correctly start in an even-numbered register | |
| or 16-byte aligned stack slot, matching GCC. | |
| - Except on PlayStation, on x86-64 System V a non-zero-width unnamed bit-field | |
| now classifies the eightbytes it occupies as INTEGER, like a named bit-field, | |
| matching GCC. Aggregates where this changes the classification may be passed | |
| or returned differently -- a struct holding a run of `__int128` bit-fields, | |
| for example, now travels in the two integer registers the ABI assigns it. | |
| This also fixes a crash when such a struct was passed or returned. | |
| `-fclang-abi-compat=23` restores the previous behavior. (#GH202205) | |
| - On 32-bit x86, Clang now matches GCC when classifying arguments for the | |
| `regparm` calling convention. Floating-point types other than `float` and | |
| `double` no longer consume general-purpose register slots, complex values | |
| are passed on the stack without consuming register slots, and unions are no | |
| longer classified according to a single member. `-fclang-abi-compat=23` | |
| restores the previous behavior. (#GH227130) | |
| - Clang now considers matrix types in its isHomogeneousAggregate() handling, | |
| which can lead to differences in how structures containing matrix types are | |
| classified for ABI purposes. The previous exclusion of matrix types appears | |
| to have been accidental. Matrix types now follow the same rules as arrays | |
| for homogeneous aggregate classification. | |
| `-fclang-abi-compat=23` restores the previous behavior. (#GH218799) | |
| - On Windows targets using the Microsoft record layout, `#pragma pack` no longer | |
| reduces the alignment of fields of vector type (e.g. `__m128`) or of x87 | |
| 80-bit `long double` (with `-mlong-double-80`), including when such fields | |
| are nested in structs or arrays. This matches MSVC and fixes misaligned | |
| accesses to these fields. `__attribute__((packed))` on the field or the | |
| enclosing record still reduces the alignment. (#GH208256) | |
| ### AST Dumping Potentially Breaking Changes | |
| ### Clang Frontend Potentially Breaking Changes | |
| - Templight support has been removed. | |
| - `-fstack-clash-protection` has been enabled implicitly by default for android | |
| target triples (except 32b arm targets). Can be disabled via | |
| `-fno-stack-clash-protection`. | |
| ### Clang Python Bindings Potentially Breaking Changes | |
| - `CompletionChunkKind` instance's `__str__` representation has been adapted to be consistent with other enums in the library. | |
| The representation now follows the `CompletionChunkKind.VARIANT_NAME` scheme instead of `VariantName`. | |
| - Remove the deprecated `SPELLING_CACHE` alias. | |
| All usage should be migrated to use `CompletionChunk.SPELLING_CACHE` instead. | |
| Note that this uses `CompletionChunkKind` enumeration as keys, instead of integer values. | |
| - Remove the deprecated `CompletionChunk.isKind...` methods. | |
| Existing uses should be adapted to directly compare equality of the `CompletionChunk` kind with the corresponding `CompletionChunkKind` variant. | |
| Affected methods: `isKindOptional`, `isKindTypedText`, `isKindPlaceHolder`, | |
| `isKindInformative` and `isKindResultType`. | |
| - `CompletionString.availability` now returns instances of `AvailabilityKind`. | |
| As a result, the `__str__` representation of its return values changed. | |
| Like other libclang enums, it now follows the `CompletionChunkKind.VARIANT_NAME` scheme instead of `VariantName`. | |
| - Change the behavior of the deprecated `CodeCompletionResults.results` property. | |
| It is used as an implementation detail now and should not be accessed directly. | |
| Existing uses of it should be changed to use `CodeCompletionResults` directly: | |
| it nows supports `__len__` and `__getitem__`, so it can be used the same as `CodeCompletionResults.results` previously. | |
| - `Cursor` instance's `enum_value` method now returns 1 instead of -1 for `true` bool enumeration values | |
| ### OpenCL Potentially Breaking Changes | |
| ## What's New in Clang {{env.config.release}}? | |
| ### C++ Language Changes | |
| - Clang now supports friend declarations with a dependent nested name specifier. (#GH104057) | |
| - ``auto()`` casts are accepted as an extension pre-C++23. | |
| #### C++2d Feature Support | |
| - Clang now supports [P3658R1](https://wg21.link/p3658r1) (Adjust identifier | |
| following new Unicode recommendations), applied as a DR to all C++ language | |
| modes. | |
| - Clang now supports [P3670R4](https://wg21.link/p3670r4) (Pack indexing for | |
| template names), which allows a pack of templates to be indexed, as in | |
| `TT...[0]<int>`. Like pack indexing of types and expressions, this is | |
| available in all C++ language modes as an extension, controlled by | |
| `-Wc++2d-extensions` and `-Wpre-c++2d-compat`, and `__cpp_pack_indexing` is | |
| bumped to `202606L`. | |
| #### C++2c Feature Support | |
| - Added `__builtin_type_order` for compatibility with GCC as part of the | |
| implementation of [P2830R10](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2830r10.html) (Constexpr Type Ordering). | |
| - Clang now supports [P3533R2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3533r2.html) (constexpr virtual inheritance). | |
| - Implemented the language part of [P3475R2](https://wg21.link/P3475R2) (Defang | |
| and deprecate `memory_order::consume`) by removing support for the | |
| `[[carries_dependency]]` attribute. | |
| #### C++23 Feature Support | |
| #### C++20 Feature Support | |
| - Now clang-scan-deps in P1689 format can find the dependencies described in | |
| module map file. See the documents of standard C++ modules for details. | |
| #### C++17 Feature Support | |
| #### Resolutions to C++ Defect Reports | |
| - Clang now falls back to alignment-aware allocation functions for | |
| non-overaligned types, implementing [CWG2282](https://wg21.link/cwg2282). | |
| - Clang now converts floating-point values to boolean first when converting | |
| them to an enumeration type with a fixed `bool` underlying type. This | |
| resolves [CWG1094](https://wg21.link/cwg1094). | |
| - Implemented [CWG2900](https://wg21.link/cwg2900), removing an ambiguity | |
| when partial ordering constant template parameters declared | |
| with placeholder types. | |
| ### C Language Changes | |
| #### C2y Feature Support | |
| - Clang now supports C2y's new syntax for `if` and `switch` statements with | |
| initializer and condition variables, as specified in | |
| [N3356](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3356.htm)_. For | |
| example: | |
| ```c | |
| if (bool x = true; x) { | |
| // ... | |
| } | |
| if (bool x = true) { | |
| // ... | |
| } | |
| // attribute list on declarations are also supported | |
| switch ([[maybe_unused]] int x = 1) { | |
| default: | |
| // ... | |
| } | |
| if (bool x [[maybe_unused]] = true; x) { | |
| // ... | |
| } | |
| ``` | |
| - Clang now diagnoses the use of the same identifier with both internal and | |
| external linkage within a translation unit, as made ill-formed by | |
| [N3410](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3410.pdf). | |
| This is also diagnosed in older C language modes as the behavior was | |
| undefined prior to C2y. (#GH54215) | |
| #### C23 Feature Support | |
| ### Objective-C Language Changes | |
| ### Non-comprehensive list of changes in this release | |
| - Clang tools now resolve tool names without a path in compilation databases | |
| through `PATH`. | |
| - On musl targets, the driver now links ``libssp_nonshared.a`` when stack | |
| protection is enabled and the library is present in the toolchain library | |
| paths, matching what musl distributions configure GCC to do. | |
| - Clang now allows GNU computed `goto` extension in `constexpr` functions, matching the relaxed | |
| `constexpr` function body rules introduced in C++23. | |
| - Added support for the `__builtin_strlcat` and `__builtin_strlcpy` builtins. | |
| - Added `__builtin_sort_pack` to sort a pack of types using the same | |
| order as `__builtin_type_order`. | |
| - Updates Unicode Names data to Unicode 18.0 (from Unicode 18.0 Beta). | |
| - `clang-scan-deps` now reports the directories whose listing a module depends | |
| on, such as umbrella directories, via `directory-deps` in its | |
| `experimental-full` output. When the listing of one of these directories or | |
| their subdirectories changes, for example because a header was added, build | |
| systems can pass the reported directory to `-invalidated-path=` in the next | |
| incremental scan so that the modules depending on it are rebuilt. Changes can | |
| be detected by watching the directories or by comparing their modification | |
| times. | |
| ### New Compiler Flags | |
| - New option `-fmodules-validate-directory-dependencies` makes an implicitly | |
| built module out of date when a header is added to a directory it enumerated, | |
| such as an umbrella directory or the directory of an umbrella header, after it | |
| was built. Off by default. | |
| - New option `-fdefined-pointer-subtraction` added to preserve stable semantics | |
| when subtracting pointers to unrelated objects. | |
| - Added `--print-cxx-stdlib` and `--print-cxx-stdlib-include-dirs` to print | |
| the C++ standard library selected by the driver and the include directories | |
| added for it. | |
| - Added `-mscs-reg=<reg>` on Hexagon to select which callee-saved register | |
| (`r16`-`r27`, default `r18`) holds the shadow call stack pointer under | |
| `-fsanitize=shadow-call-stack`. The selected register must also be reserved | |
| with the matching `-ffixed-<reg>`. | |
| - Added `-fmodules-ignore-search-path=<path>`, the search-path counterpart to | |
| `-fmodules-ignore-macro=<macro>`: the path is dropped from the context hash of | |
| every module and physically removed from every module build, and kept only for | |
| the translation unit itself. This lets builds that differ only in a search | |
| path share one module cache, and is only sound when no module needs the path | |
| -- a lookup that would have resolved through an ignored path simply fails. | |
| - Added support for `-fkeep-inline-functions` in Clang. This option forces | |
| inline function definitions that are available in the current translation | |
| unit to be emitted into the object file, even when they are inlined into all | |
| callers or are otherwise unused. | |
| - Added a new `-ast-dump-filter-path` option to filter AST dump output | |
| based on the source file path of declarations. The filter uses glob-style | |
| matching on the presumed source location (accounting for macro expansions | |
| and `#line` directives). (#GH194210) | |
| - Added the AArch64 option `-mharden-pac-ret=load-return-address` to harden | |
| return address signing against PACMAN attacks. The option requires return | |
| address signing to be enabled and emits a load from the return address before | |
| returning, reducing the cache side channel used to guess pointer | |
| authentication codes. See | |
| {doc}`Return Address Authentication Hardening <ReturnAddressAuthenticationHardening>` | |
| for more information. | |
| ### Deprecated Compiler Flags | |
| ### Modified Compiler Flags | |
| - All options of the `-fzero-call-used-regs` compiler flag are now allowed on RISC-V. | |
| - `-ftrivial-auto-var-init=` now initializes variables whose declaration is | |
| bypassed by a `goto` or `switch`, which were previously left uninitialized. | |
| The initialization is emitted at each bypassing jump. See the | |
| `-ftrivial-auto-var-init=` entry in the User's Manual for the details, | |
| including where C deliberately departs from C 6.2.4p6. | |
| - `--config` files now support trailing `#` comments after an option, in | |
| addition to whole-line comments. Mid-line comment-denoting `#`s must be | |
| separated from surrounding arguments by whitespace. Quoted arguments can no | |
| longer be split across multiple lines using a backslash. | |
| ### Removed Compiler Flags | |
| ### Attribute Changes in Clang | |
| - Clang now properly propagates attributes on class and variable templates to their redeclarations, which will result in redeclarations not interfering with diagnostics. (#GH209812) | |
| - Clang now recognizes the `[[gnu::flag_enum]]` attribute and treats it equivalent to `[[clang::flag_enum]]` | |
| - Clang now accepts `_single_inheritance` under `-fms-compatibility` as an alias for `__single_inheritance`; `_multiple_inheritance` and `_virtual_inheritance` were already correctly supported as aliases. | |
| - Fixed a bug with handling a `nonnull` attribute with an invalid argument | |
| index such that it would inadvertently apply the attribute with no arguments, | |
| causing all function parameters of pointer type to be considered nonnull. (#GH228670) | |
| - Added `[[clang::unsafe_buffer_usage_in_container]]` (and equivalent spelling | |
| `[[clang::unsafe_buffer_usage("container")]]`) to allow two-parameter container | |
| and view constructors and factory functions to opt in to | |
| `-Wunsafe-buffer-usage-in-container` diagnostics. | |
| - The thread safety attribute `lock_returned` (`RETURN_CAPABILITY`) can now be | |
| applied to function pointers, like the other thread safety function | |
| attributes: | |
| ```c | |
| struct Ops { | |
| struct Mutex *(*lock_of)(struct Dev *d) RETURN_CAPABILITY(&d->lock); | |
| }; | |
| ``` | |
| - Under `-fexperimental-late-parse-attributes`, the thread safety capability | |
| attributes (`requires_capability`, `acquire_capability`, | |
| `release_capability`, `assert_capability`, `try_acquire_capability`, | |
| `locks_excluded` and `lock_returned`) are now late parsed, as `guarded_by` | |
| and `pt_guarded_by` already were, so a requirement may name a member declared | |
| later in the same record: | |
| ```c++ | |
| struct Cache { | |
| void (*read)(void) REQUIRES(mu); // 'mu' declared below | |
| Mutex mu; | |
| }; | |
| ``` | |
| and a requirement on a parameter may name another parameter of the same | |
| prototype, declared later: | |
| ```c++ | |
| int kref_put_lock(struct kref *kref, | |
| void (*release)(struct kref *) RELEASE(lock), | |
| spinlock_t *lock); | |
| ``` | |
| A requirement naming a parameter of the pointee, such as | |
| `void (*unlock)(struct BDev *bdev) UNLOCK_FUNCTION(bdev->lock)`, keeps | |
| working. Without the flag both forward references remain errors. | |
| ### Improvements to Clang's diagnostics | |
| - Fixed spurious `-Wimplicit-void-ptr-cast` warnings in C for parenthesized | |
| null pointer macros such as `(NULL)`. (#GH171874) | |
| - `-Wfortify-source` now diagnoses when `strlcat`, `__builtin_strlcat`, `strlcpy`, or | |
| `__builtin_strlcpy` is called with a size argument larger than the destination buffer. | |
| - `-Wfortify-source` now diagnoses when `recv` or `recvfrom` is called with a | |
| size argument larger than the destination buffer. | |
| - `-Wfortify-source` now diagnoses when `poll`, `ppoll`, or `ppoll64` is called | |
| with a descriptor count whose total size exceeds the `fds` array size. | |
| - `-Wfortify-source` now diagnoses when `vsprintf`, `__builtin_vsprintf`, | |
| `__builtin___vsprintf_chk`, or `__builtin_sprintf` is called with a format | |
| string whose output exceeds the destination buffer size. | |
| - The `cannot overload a member function` diagnostic now describes the previous | |
| declaration first, matching the order in which the declarations appear in the | |
| source. (#GH219803) | |
| - More consistent rendering of Unicode characters in diagnostic messages. | |
| - Fixed `-Wunused-parameter` to diagnose coroutine parameters that are only | |
| considered during allocation function lookup or promise object | |
| initialization, while not diagnosing parameters passed to the selected | |
| allocation function or promise constructor. (#GH217501) | |
| - The `wb` and `uwb` `_BitInt` literal suffixes are no longer diagnosed by default | |
| before C23. They stay in `-Wc23-extensions` and are still reported under | |
| `-pedantic` or when that group is enabled explicitly, matching how the `_BitInt` | |
| type itself is already handled. | |
| - Fixed bug in `-Wdocumentation` so that it correctly handles explicit | |
| function template instantiations (#64087). | |
| - When a `constexpr` range-based for loop variable cannot be initialized by a | |
| constant expression, Clang now emits a single note identifying the read of | |
| the loop's implicit `__begin` variable, instead of a generic note about | |
| reading a non-constexpr variable followed by a `declared here` note. | |
| (#GH211926) | |
| - Fixed concept template parameters not being recognized in `-Wdocumentation` | |
| when mentioned in tparam comments. (#GH64087) | |
| - `-Wunused-but-set-variable` now diagnoses file-scope variables with | |
| internal linkage (`static` storage class) that are assigned but never used. | |
| This new coverage is added under the subgroup `-Wunused-but-set-global`, | |
| allowing it to be disabled independently with `-Wno-unused-but-set-global`. | |
| (#GH148361) | |
| - Added `-Wlifetime-safety` to enable lifetime safety analysis, | |
| a CFG-based intra-procedural analysis that detects use-after-free and related | |
| temporal safety bugs. See the | |
| [RFC](https://discourse.llvm.org/t/rfc-intra-procedural-lifetime-analysis-in-clang/86291) | |
| for more details. By design, this warning is enabled in `-Weverything`. To disable | |
| the analysis, use `-Wno-lifetime-safety` or `-fno-lifetime-safety`. | |
| - Added `-Wlifetime-safety-suggestions` to enable lifetime annotation suggestions. | |
| This provides suggestions for function parameters that | |
| should be marked `[[clang::lifetimebound]]` based on lifetime analysis. For | |
| example, for the following function: | |
| ```c++ | |
| int* p(int *in) { return in; } | |
| ``` | |
| Clang will suggest: | |
| ```c++ | |
| warning: parameter in intra-TU function should be marked [[clang::lifetimebound]] | |
| int* p(int *in) { return in; } | |
| ^~~~~~~ | |
| [[clang::lifetimebound]] | |
| note: param returned here | |
| int* p(int *in) { return in; } | |
| ^~ | |
| ``` | |
| - Added `-Wlifetime-safety-noescape` to detect misuse of `[[clang::noescape]]` | |
| annotation where the parameter escapes through return. For example: | |
| ```c++ | |
| int* p(int *in [[clang::noescape]]) { return in; } | |
| ``` | |
| Clang will warn: | |
| ```c++ | |
| warning: parameter is marked [[clang::noescape]] but escapes | |
| int* p(int *in [[clang::noescape]]) { return in; } | |
| ^~~~~~~ | |
| note: returned here | |
| int* p(int *in [[clang::noescape]]) { return in; } | |
| ^~ | |
| ``` | |
| - Added `-Wlifetime-safety-dangling-field` to detect dangling field references | |
| when stack memory escapes to class fields. This is part of `-Wlifetime-safety` | |
| and detects cases where local variables or parameters are stored in fields but | |
| outlive their scope. For example: | |
| ```c++ | |
| struct DanglingView { | |
| std::string_view view; | |
| DanglingView(std::string s) : view(s) {} // warning: address of stack memory escapes to a field | |
| }; | |
| ``` | |
| - Lifetime safety analysis is now enabled for C by default. The `-fexperimental-lifetime-safety-c` | |
| flag is renamed to `-flifetime-safety-c`. Use `-fno-lifetime-safety-c` to disable it. | |
| - Improved `-Wassign-enum` performance by caching enum enumerator values. (#GH176454) | |
| - Fixed a false negative in `-Warray-bounds` where the warning was suppressed | |
| when accessing a member function on a past-the-end array element. | |
| (#GH179128) | |
| - Added a missing space to the FixIt for the `implicit-int` group of diagnostics and | |
| made sure that only one such diagnostic and FixIt is emitted per declaration group. (#GH179354) | |
| - Fixed the Fix-It insertion point for `expected ';' after alias declaration` | |
| when parsing alias declarations involving a token-split `>>` sequence | |
| (for example, `using A = X<int>>;`). (#GH184425) | |
| - Fixed incorrect `implicitly deleted` diagnostic for explicitly deleted | |
| candidate function. (#GH185693) | |
| - The `-Wloop-analysis` warning has been extended to catch more cases of | |
| variable modification inside lambda expressions (#GH132038). | |
| - Clang now emits `-Wsizeof-pointer-memaccess` when snprintf/vsnprintf use the sizeof | |
| the destination buffer(dynamically allocated) in the len parameter(#GH162366) | |
| - Added `-Wmodule-map-path-outside-directory` (off by default) to warn on | |
| header and umbrella directory paths that use `..` to refer outside the module | |
| directory in module maps found via implicit search | |
| (`-fimplicit-module-maps`). This does not affect module maps specified | |
| explicitly via `-fmodule-map-file=`. | |
| - Honour `[[maybe_unused]]` attribute on private fields. | |
| `-Wunused-private-field` no longer emits a warning for annotated private | |
| fields. | |
| - Improved `-Wgnu-zero-variadic-macro-arguments` to suggest using | |
| `__VA_OPT__` if the current language version supports it(#GH188624) | |
| - Clang now emits an error when implicitly casting a complex type to a built-in vector type. (#GH186805) | |
| - Added `-Wnonportable-include-path-separator` (off by default) to catch | |
| #include directives that use backslashes as a path separator. The warning | |
| includes a FixIt to change all the backslashes to forward slashes, so that the | |
| code can automatically be made portable to other host platforms that don't | |
| support backslashes. | |
| - Clang now explains why template deduction fails for explicit template arguments. | |
| - No longer emitting a `-Wpre-c2y-compat` or extension diagnostic about use | |
| of octal literals with a `0o` prefix, and no longer emitting a | |
| `-Wdeprecated-octal-literals` diagnostic for use of octal literals without | |
| a `0o` prefix, when the literal is expanded from a macro defined in a | |
| system header. (#GH192389) | |
| - Improved error recovery for missing semicolons after class members. Clang now avoids | |
| skipping subsequent valid declarations when their previous decl is missing semicolon. | |
| - Removed the body of lambdas from some diagnostic messages. | |
| - Fixed false positive host-device mismatch errors in discarded `if constexpr` branches for CUDA/HIP; | |
| such calls are now correctly skipped. | |
| - Clang now errors when a function declaration aliases a variable or vice versa. (#GH195550) | |
| - Added `-Wattribute-alias` to diagnose type mismatches between an alias and its aliased function. (#GH195550) | |
| - The diagnostics around `__block` now explain why a variable cannot be marked `__block`. (#GH197213) | |
| - Extended `-Wnonportable-include-path` to warn about trailing whitespace and dots in `#include` paths. (#GH190610) | |
| - Clang now emits error when attribute is missing closing `]]` followed by `;;`. (#GH187223) | |
| - Clang now rejects inline asm constraints and clobbers that contain an | |
| embedded null character, instead of silently truncating them. (#GH173900) | |
| - Added `-Wstringop-overread` to warn when `memcpy`, `memmove`, `memcmp`, | |
| and related builtins read more bytes than the source buffer size (#GH83728). | |
| - Diagnostics for the C++11 range-based for statement now report the correct | |
| iterator type in notes for invalid iterator types. | |
| - `-Wfortify-source` now diagnoses calls to `fread`, `fwrite`, and `fgets` | |
| when the requested size exceeds the corresponding buffer. (#GH204337) | |
| - `-Wfortify-source` now warns when the constant-evaluated argument to | |
| `umask` has bits set outside `0777`. Those bits are silently discarded | |
| by the kernel, so setting them is almost always a typo (matching the | |
| bionic libc `diagnose_if` check). | |
| - Improved how Unicode characters are displayed in diagnostic messages. | |
| - Clang no longer retains source comments in the AST when nothing will read them | |
| back. Comments are now collected only when they may be consumed (e.g. with | |
| ``-fparse-all-comments``, when ``-Wdocumentation`` is enabled, when emitting a | |
| PCH/module, or during code completion), reducing memory overhead for typical | |
| compilations. | |
| - `-Wtautological-pointer-compare` and `-Wpointer-bool-conversion` now | |
| diagnose a reference to a function (e.g. of type `void (&)()`) compared | |
| against or converted to a null pointer, the same as a bare function name. | |
| (#GH46362) | |
| - Clang now attempts to print enumerator names rather than C-style cast expressions | |
| in more diagnostics. | |
| - `-Wunsafe-buffer-usage` now warns about unsafe two-parameter constructors of | |
| `std::string_view` (pointer and size), consistent with the existing warning for `std::span`. | |
| - `-Wno-unsafe-buffer-usage-in-static-sized-array` now also suppresses warnings | |
| for pointer arithmetic on statically-sized arrays when the offset is a | |
| non-negative constant within the array bounds. | |
| - `-Wunsafe-buffer-usage-in-container` now warns on unsafe calls to | |
| two-parameter constructors and factory functions annotated with | |
| `[[clang::unsafe_buffer_usage_in_container]]` or | |
| `[[clang::unsafe_buffer_usage("container")]]`. For these annotated functions, | |
| the safe `(.data(), .size())` and `(.begin(), .end())` argument checks use | |
| duck typing rather than a hardcoded type list, suppressing false positives | |
| when both methods are called on the same user-defined container object. | |
| - `-Wc++98-compat` now diagnoses explicit conversion functions in C++20 and | |
| later, matching the behavior in C++11 through C++17. (#GH161689) | |
| - Added `-Wcounter-extension` as a diagnostic group under `-Wc2y-extensions` to | |
| control `__COUNTER__` being diagnosed as an extension. This allows `-pedantic` | |
| users to disable the diagnostic with `-Wno-counter-extension` without having | |
| to disable all pedantic diagnostics. (#GH196557) | |
| - Clang now diagnoses more details when a constraint evaluates to false. | |
| - `-Wpointer-arith` no longer reports subtraction of pointers to a variably | |
| modified type, such as `int[n]`, as a subtraction of pointers to a type of | |
| zero size, unless the size is provably zero: a zero-sized base element or a | |
| dimension that is a zero integer constant, as in `struct Empty vla[n]` or | |
| `int vla[n][0]`. (#GH28328) | |
| - Fixed a missing `-Wconstant-conversion` diagnostic for signed `char` arrays. | |
| - Clang now diagnoses passing wrong vector type as a mask to `__builtin_shufflevector`. (#GH218132) | |
| - `-Wdelete-abstract-non-virtual-dtor` and `-Wdelete-non-abstract-non-virtual-dtor` | |
| no longer warn when the selected deallocation function is a destroying | |
| `operator delete`, since such a delete expression never invokes the | |
| destructor. (#GH65524) | |
| - Suggest missing `typename` prefixes to dependent packs within template arguments. (#GH75248) | |
| - Fixed a false-positive `-Wshadow` warning when a variable in an | |
| inline-defined friend function shares the name of a non-static class | |
| member variable. (#GH221190) | |
| - Clang now diagnoses matrix logical operations are only supported for HLSL. (#GH222381) | |
| - Improve the input size mismatch diagnostic when calling `__builtin_shufflevector` with valid | |
| vector element types but different sizes. (#GH221791) | |
| - Suggests the correct location for an attribute written before the `using` | |
| keyword of an alias-declaration. (#GH155787) | |
| - Improve Clang diagnoses when unary `__imag` operator with non-complex type operand is used as lvalue. (#GH222383) | |
| - Added `-Wredundant-defer` to diagnose redundant uses of the `_Defer` | |
| keyword, such as when deferring the last statement of a block; when | |
| used as the body of a conditional; or when it immediately precedes | |
| a `break`/`continue` statement or a `return` with no argument. | |
| - Clang now diagnoses arrays whose size is deduced from an initializer list when they exceed the maximum object size | |
| - Added `-Wunsafe-buffer-usage-main-argv` as a diagnostic group under | |
| `-Wunsafe-buffer-usage` to control warnings on `main`'s `argv` parameter, | |
| allowing users to suppress them with `-Wno-unsafe-buffer-usage-main-argv`. | |
| ### Improvements to Clang's time-trace | |
| ### Improvements to Coverage Mapping | |
| ### Bug Fixes in This Version | |
| - Fixed incorrect handling of C++ import preprocessing token when a digraph character after import. (#GH190693) | |
| - Fixed a crash when emitting RTTI for a `dllexport` class, or the fundamental type descriptors for `__cxxabiv1::__fundamental_type_info`, under `-fvisibility=hidden`. (#GH207963) | |
| - Fixed an assertion failure when passing a wide string literal to `__builtin_nan`. (#GH212108) | |
| - Fixed an assertion failure when converting between an x87 `long double` vector and another vector type of the same size. (#GH173254), (#GH63548) | |
| - Fixed a constraint comparison bug in partial ordering. (#GH182671) | |
| - Fixed a rejected-valid case that used an explicit object parameter in an out-of-line definition of a nested class member. (#GH136472) | |
| - Fixed an assertion on omp taskloop transparent (#GH197162) | |
| - Fixed a bug where `__func__`, `__PRETTY_FUNCTION__` and `__FUNCTION__` were not resolving to the proper function when inside a lambda return type (#GH211811) | |
| - Fixed USR generation for declarations whose signature mentions a class-type | |
| non-type template parameter. (#GH212351) | |
| - Fixed an assertion caused by Microsoft integer literals exceeding the maximum value. (#GH212504) | |
| - Fixed an assertion failure when a value of a Unicode character type (`char8_t`, `char16_t`, `char32_t`) was implicitly splatted to a vector of the same element type, e.g. when comparing an `ext_vector_type` of `char32_t` with one of its elements. (#GH202317) | |
| - Fixed a crash when checking scalar type with excess braces. (#GH69213), (#GH137845), (#GH198767), (#GH207566), (#GH106180) | |
| - Fixed an assertion failure when a global variable in a non-default address space, such as one declared with `__seg_gs`, is mapped into an OpenMP `target` region. (#GH140069) | |
| - Fixed an assertion crash when instantiating a nested requirement with an invalid constraint. (#GH213575) | |
| - Clang now defines the GCC-compatible predefined macro `__SIG_ATOMIC_TYPE__`. (#GH213895) | |
| - Fixed IEEE f128 complex mul/div using the IBM f128 libcalls on powerpc. (#GH216820) | |
| - Fixed an ICE that occurred when a structured binding pack is expanded outside the lambda where it was declared. (#GH214160) | |
| - Fixed a bug where a stray closing curley brace in an OpenMP/OpenACC pragma could cause pragma parsing issues when inside of a member function. (#GH214195) | |
| - Fixed a bug where preprocessor directives following comments were not correctly recognized when using -C. (#GH48361) | |
| - Fixed a crash when declaring a member template within a local class inside an OpenMP region. (#GH216052) | |
| - Fixed a crash when an OpenMP `copyprivate` clause names a non-static data member that is not private in the | |
| enclosing context, which is now diagnosed, a data member inside a member function template, or a structured | |
| binding. (#GH217893) | |
| - Fixed an assertion failure when a variable implicitly mapped by an OpenMP `target` directive has a class type | |
| (such as `std::map`) whose mapper lookup instantiates a class template specialization. (#GH154704) | |
| - Fixed a bug where repeated #imports of modular headers in non-modular compilation were translated to #pragma clang module import. (#GH216924) | |
| - Fixed an assertion when `#pragma omp declare simd` or `#pragma omp declare variant` is followed by another OpenMP declarative directive containing a qualified identifier. (#GH217204) | |
| - Fixed crashes on an OpenMP `target` region inside a lambda or block at namespace scope, including when the region used a global reference. (#GH223397) | |
| - Fixed a crash when an `asm` label names the register for a global variable of incomplete type. (#GH219746) | |
| - Fixed a crash when a local register variable bound to a pseudo or status register by an `asm` label, | |
| such as `register long double t __asm("17");` (the flags register), was used as an inline asm operand. | |
| Such declarations are now rejected, matching GCC. (#GH225033) | |
| - Fixed an ICE hat occurred when using `__imag int/float` as lvalue in assignment. (#GH119498) | |
| - Fixed a C23 rejects-valid where `auto T x;` (with `T` a typedef-name) was rejected as a missing initializer. (#GH164930) | |
| - Fixed an assertion failure in `-Wsign-compare` when a negated or complemented vector of unsigned integers was compared against a signed constant. (#GH203575) | |
| - Fixed an assertion failure when a constant statement expression that declares a variable is used as a bound of an OpenMP loop. A statement expression in a bound of a non-rectangular loop is now diagnosed. (#GH153987) | |
| - Fixed a bug where a bit-field accessed as the result of a statement expression | |
| (e.g. `({ s.b; })`) was not subject to integer promotion, unlike an ordinary | |
| bit-field access. (#GH221542) | |
| - No longer crashing due to follow-on diagnostics when there is an invalid operand in a logical operator involving a vector operand. (#GH227588) | |
| - Fixed assertion failures caused by stale linkage information when an extern variable or function declaration is merged with a preceding static declaration. (#GH204759, #GH204754) | |
| - Fixed a crash due to typo correction mishandling custom keywords `_virtual_inheritance` and `_multiple_inheritance` in `-fms-compatibility` mode. (#GH228003) | |
| - Clang no longer treats a file-scope `thread_local` declaration without an initializer as a tentative definition in C23 mode. As specified by C23 6.9.3, such a declaration is a definition, so declaring the same variable more that once is now diagnosed as a redefinition. (#GH217636) | |
| - Fixed an assertion failure on use of an uninitialized token in dependency directives lexing in clang-scan-deps. | |
| - Fixed auto type inference being rejected when the initializer is a bit-field. (#GH226280) | |
| - Fixed failed assertion when creating a compound literal with erroneous initializer at file scope. (#GH229888) | |
| #### Bug Fixes to Compiler Builtins | |
| - Fixed a crash when classifying a call to a builtin with dependent arguments, | |
| such as when the call is used as an `auto` non-type template argument. | |
| - Fixed an assertion failure when diagnosing a constant evaluation failure | |
| inside a member function call synthesized by ``__builtin_invoke``. (#GH185241) | |
| - Fixed a crash in ``__builtin_dump_struct`` when ``-Werror`` promotes | |
| format warnings to errors. (#GH211943) | |
| - Fixed a crash when `__atomic_always_lock_free` or `__atomic_is_lock_free` is | |
| called with a size of zero. (#GH170139, #GH120082) | |
| - Fixed wrong code generation in `__builtin_clear_padding` wherein the wrong | |
| bits of the following types were cleared: `_BitInt`, struct bitfields, and | |
| packed boolean vectors. (#GH215809), (#GH216063), (#GH224033) | |
| - Fixed an assertion failure when `__builtin_vectorelements` is applied to a | |
| reference to a vector type; `vec_step` (in C++ for OpenCL) and | |
| `__builtin_ptrauth_type_discriminator` similarly no longer accept reference | |
| types that their evaluation silently mishandled. (#GH216997) | |
| - Fix a crash when using `__builtin_assume_aligned` with dynamic allocations | |
| during constant evaluation. (#GH173767) | |
| - Fixed a crash on an invalid pointer argument to `__builtin_assume_aligned`. (#GH194289) | |
| - Fixed a crash when constant-evaluating `__builtin_align_up`, `__builtin_align_down`, | |
| or `__builtin_is_aligned` with pointers without an underlying object. Null pointers | |
| are handled as aligned values, while other base-less pointers are rejected during constant | |
| evaluation. | |
| - Fixed an assertion failure when `__builtin_object_size` or | |
| `__builtin_dynamic_object_size` is called with an out-of-range type argument | |
| during constant evaluation. (#GH225041) | |
| - Fixed an assertion failure when constant-evaluating `__builtin_object_size` | |
| or `__builtin_dynamic_object_size` with a type argument that is not an | |
| integer constant expression. (#GH231108) | |
| - `__has_unique_object_representations` now returns `true` for `_Atomic` types | |
| whose object representation is identical to that of their value type, such | |
| as `_Atomic(int)`. Atomic types whose size is rounded up to a power of two | |
| (adding padding bits) continue to report `false`. This also fixes a false | |
| positive in the `bugprone-suspicious-memory-comparison` clang-tidy check. | |
| #### Bug Fixes to Attribute Support | |
| - Fixed an assertion failure when parsing malformed GNU `__attribute__` | |
| syntax followed by a parenthesized expression list in C code. (#GH225045) | |
| - Clang now diagnoses incompatible `weak` and `ifunc` attributes, including | |
| weak linkage introduced through redeclarations or `#pragma weak`. (#GH220923) | |
| - Fixed crash (assertion) when the `alloc_align` attribute was applied to a declaration whose type has a `FunctionProtoType` but which is not itself a `FunctionDecl`, such as a function-pointer variable. (#GH122058) | |
| - Fixed a crash on `bool` vectors declared with `ext_vector_type` and more than | |
| 2^23 elements; `ext_vector_type` and `vector_size` now both reject vectors | |
| with more than 2^23 elements or larger than 2^28 bytes. (#GH165458) | |
| - Fixed an assertion failure when an unscoped enumeration type was used as | |
| the element type of a vector declared with `ext_vector_type`. Clang now | |
| diagnoses such element types as invalid. (#GH225037) | |
| - The `counted_by`/`counted_by_or_null` diagnostic that rejects a pointer whose | |
| pointee is a struct with a flexible array member (e.g. | |
| ``struct with_fam * __sized_by(size) ptr;``) was incorrectly also applied to | |
| the `sized_by`/`sized_by_or_null` attributes. Because `sized_by` and | |
| `sized_by_or_null` describe the size in bytes rather than a count of elements, | |
| they are now correctly accepted on such pointers. | |
| - Fixed a crash when an `address_space` attribute with a dependent argument was | |
| written after the declarator-id, where it appertains to the declared entity | |
| rather than to a declarator chunk. (#GH196982, #GH111463) | |
| - Fixed an assertion failure when the `alias` attribute was applied to an | |
| `extern` variable with an initializer. Static data members declared with | |
| `alias` are now correctly diagnosed as definitions when followed by an | |
| out-of-line definition. (#GH204762) | |
| #### Bug Fixes to C++ Support | |
| - Fixed lambdas with specifiers or attributes after the capture list being | |
| misparsed as function declarations in direct-initialization contexts under | |
| `-fms-extensions` or in HLSL mode. | |
| - Fixed the destruction timing of temporaries created by default member | |
| initializers during aggregate initialization. Such an initializer is part of | |
| the full-expression containing the aggregate initialization. (#GH85601) | |
| - Fixed false-positive module ODR diagnostics when a type is found through a | |
| using-declaration in one definition and directly in another. ODR hashing also | |
| now distinguishes differently qualified uses of types found through | |
| using-declarations. (#GH78850) | |
| - Fixed an assertion when diagnosing module ODR violations for enum underlying | |
| types found through using-declarations with the same name but different types. | |
| - Fixed a false type mismatch when a typedef naming an anonymous enumeration | |
| was used through a C++20 named module and its defining header was subsequently | |
| included. (#GH213299) | |
| - Fixed an issue where `__typeof__` incorrectly rejected cv-qualified function types. | |
| - Fixed an assertion failure when `#embed` was used in the braced initializer | |
| of an array new-expression, or of an array whose elements are of class type. | |
| (#GH128985) | |
| - Fixed a bug where top-level CV qualifiers (such as ``const``) were dropped from pointers modified by Microsoft pointer attributes (like ``__ptr32`` and ``__ptr64``) and WebAssembly's ``__funcref``. | |
| - Fixed a bug where we accepted ``__super`` being qualified by a scope specifier, causing codegen to assertion fail elsewhere. (#GH212988) | |
| - Fixed an assertion when typo correction replaced or dropped the qualifier of | |
| a name such as `foo::S<int>` while the parser was deciding whether a | |
| parenthesized construct like `(void(foo::S<int>))` is a type-id or an | |
| expression. (#GH221890) | |
| - Fixed an issue where we tried to compare invalid NTTPs for variable declarations, which ended up in hitting an assertion with a constrained non-plain-auto NTTP, which we don't quite implement yet. (#GH208658) | |
| - Fixed a crash when a using-declaration naming an unresolvable member of a | |
| dependent base was shadowed by an invalid using-declaration. (#GH209427) | |
| - Fixed a CTAD bug when combining with concepts. (#GH124715) | |
| - Fixed a regression where an internal-linkage function (e.g. a `static` or | |
| anonymous-namespace helper) declared in the global module fragment of the | |
| current translation unit was removed from the overload set when the calling | |
| template was instantiated after the global module fragment was closed, | |
| producing a spurious "no matching function" error with no candidate notes. | |
| (#GH210822) | |
| - Fixed a crash when module directive export module foo not following a | |
| semicolon and there are no rest pp-tokens in current module file. (#GH187771) | |
| - Fixed concept evaluation bugs where some declarations were not added to | |
| the current instantiation scope. (#GH198052) | |
| - Fixed a crash when a lambda parameter pack was given a default argument that | |
| is a pack expansion referencing an enclosing function's parameter pack (e.g. | |
| `[](Types... = args...) {}`). Clang now diagnoses the illegal default | |
| argument instead of asserting. (#GH210714) | |
| - Fixed a crash on invalid code where a ``decltype`` not followed by ``(`` was | |
| parsed where a nested-name-specifier could appear (e.g. ``int decltype = 0;``). | |
| Clang now diagnoses the error instead of asserting. (#GH211207) | |
| - Fixed a spurious unused function warning when using `operator<=>` within an anonymous namespace. (#GH125233) | |
| - Fixed a regression where the rewritten comparison operator was not instantiated properly. (#GH104720) | |
| - Fixed an assertion failure when a parenthesized structured binding declarator | |
| was followed by a function declarator and body (e.g. ``([a, b])() {}``). | |
| (#GH218144, #GH193687) | |
| - Fixed a crash when computing the implicit deletion of a defaulted comparison | |
| operator required an access check that ran while an enclosing declaration | |
| was still being parsed. (#GH210692) | |
| - Fixed an assertion when a call to a class object was resolved through a | |
| conversion function to a function pointer that was introduced into the class | |
| by a using-declaration (e.g. `using Base::operator auto;`). Such a conversion | |
| function is now also diagnosed if it is deleted. (#GH189146) | |
| - A workaround that was introduced to fix an issue with the `<format>` header present in some versions of | |
| libstdc++15 has been extended to support preprocessed input. Previously, splitting the preprocessing and | |
| compilation step would result in the fix not being applied. (#GH160314) | |
| - A defaulted copy or move assignment operator for a union was left with an | |
| empty body and copied nothing when the operator was actually called, for | |
| example through a pointer to member. Clang now synthesizes a whole-object | |
| copy so the union's object representation is copied, matching the defaulted | |
| union copy constructor. | |
| - Compute value dependence correctly for structured bindings. This mostly | |
| affect C++26 constexpr structured bindings and expansion statements, but | |
| also affects some uses of plain structured bindings. (#GH211930) | |
| - Fixed an assertion when instantiating the body of a C++26 expansion | |
| statement after a fatal error had occurred. (#GH214917) | |
| - Fixed an assertion when an invalid statement appeared in a ``switch`` | |
| statement nested inside a C++26 expansion statement. (#GH210575) | |
| - Fixed an assertion when a ``matrix_type`` with constant dimensions and a | |
| dependent element type was instantiated with an invalid element type. | |
| (#GH202744) | |
| - Fixed friend declarations sometimes making non-visible default arguments | |
| incorrectly visible to default argument redefinition checks across modules. | |
| - Fixed handling of SFINAE failures for expressions which depend on in-class | |
| member initializers of templates which are not yet parsed. An example is | |
| using ``__is_constructible`` on a nested class template inside the definition | |
| of the containing class. (#GH215166) | |
| - Fixed a crash issue when a value dependent recovery init appeared in constant | |
| evaluation context in default constant evaluator. | |
| - Fixed a bug where Clang incorrectly required `promise.return_value()` for a | |
| dependent `co_return` operand that inits to `void`, instead of using | |
| `promise.return_void()`. (#GH218368) | |
| - Fixed merging of lambdas across modules in the case where neither lambda is | |
| imported from an AST file. (#GH214560) | |
| - Fixed a crash when a non-type template parameter of reference type is bound | |
| to a subobject and is used in a context that requires an implicit conversion. | |
| (#GH215900) | |
| - Fixed an assertion when mangling an abbreviated function template whose | |
| return type has an ABI tag. (#GH204178) | |
| - Fixed an assertion during template argument deduction where a function parameter pack is referenced by other types in the function type. (#GH28877), (#GH213760) | |
| - Fixed a regression where deprecation warnings were omitted for synthesized | |
| deduction guide. (#GH160543) | |
| - Fixed an assertion when a redeclaration of a function template or an out-of-line | |
| definition of a member of a class template added a default argument to a | |
| parameter that follows a parameter pack (e.g. | |
| `template <typename... T> S::S(T..., int = 10) {}`). (#GH216211) | |
| - Fixed an assertion failure when instantiating a late-parsed function template defined in an earlier translation unit with -fdelayed-template-parsing. (#GH217073) | |
| - Allow redeclaration lookup to consider conversion function templates, allowing | |
| Clang to match an in-class specialization such as `template<> operator int()` | |
| against a prior conversion function template `template<class T> operator T()`. | |
| (#GH218261) | |
| - Fixed an assertion when an ill-formed qualified member function definition | |
| inside a union caused the union to be treated as a polymorphic class. | |
| (#GH213854) | |
| - Fixed a crash, a miscompile and a rejected-valid case when instantiating a | |
| constructor whose mem-initializer used parenthesized aggregate initialization, | |
| e.g. ``: agg({1, 2})`` or ``: arr(1, 2)``. (#GH176161, #GH189005, #GH213284) | |
| - Fixed an assertion when a type-trait keyword that had already been made | |
| available as an identifier (e.g. `struct __make_unsigned`) was seen again | |
| in a token that was lexed and cached before the first occurrence was parsed. | |
| (#GH214128) | |
| - Fixed a crash when a coroutine keyword appeared inside a mem-initializer on a | |
| function that is not a constructor. (#GH194298) | |
| - Fixed an assertion when a defaulted comparison operator was synthesized for a | |
| class with an invalid non-static data member, such as one qualified with an | |
| address space. (#GH194605) | |
| - Fixed deduction of the template parameters appearing in the type of a | |
| constant template parameter of reference type. (#GH40328) | |
| - Template template parameters of the form `template <X &> class` no longer reject | |
| template template arguments with the same parameters. | |
| - Fixed an assertion when matching a template template argument against a | |
| template template parameter whose constant template parameter is declared | |
| as `auto &&`. | |
| - Fixed an issue where an explicit specialization of a constexpr variable would | |
| result in a link error. (#GH219796) | |
| - Fixed ambiguous overload where two non-static member functions with | |
| different signatures could be incorrectly considered equivalent. (#GH224499) | |
| - Fixed an assertion failure when explicitly instantiating a nested member with | |
| an ill-formed template argument. Clang now checks for a failed declaration | |
| lookup before asserting that the name is not dependent, avoiding an assertion | |
| after an earlier diagnostic has caused the declaration to be unavailable. (#GH220525) | |
| - Fixed a crash in constant evaluation when a new-expression selects a | |
| user-declared allocation function that takes std::nothrow_t by value. Such | |
| a new-expression is now correctly rejected in a constant expression because | |
| it does not select a replaceable global allocation function. (#GH212211) | |
| - Fixed `__attribute__((used))` and `-fkeep-inline-functions` being | |
| incorrectly ignored for complete constructors and destructors (C1/D1 variants) | |
| when `-mconstructor-aliases` is active. C1/D1 variants were previously | |
| replaced with their base variants (C2/D2) in the IR before retention could | |
| take effect, causing them to be dropped from llvm.used and omitted from | |
| the object file. (#GH226572) | |
| - Fixed an assertion failure when the initializer of a variable template | |
| specialization with a deduced type is instantiated from inside a lambda in | |
| the initializer of another specialization of the same variable template. | |
| (#GH134148) | |
| - Fixed an assertion failure in partial ordering of function templates whose | |
| parameters use pack-indexed template template parameters (`TT...[N]<int>`) | |
| with different template parameter lists. (#GH228870) | |
| - Fixed a use-after-free when parsing a non-type template parameter with a | |
| constrained placeholder type (such as `C auto`) whose default argument | |
| contains a lambda. (#GH230539) | |
| - Fixed a bug where Clang failed to resolve a reference to an overloaded | |
| conversion function when one of the overloads was non-template. (#GH230682) | |
| - Fixed a crash when classifying a dependent call whose callee has already | |
| been substituted to a value of non-callable type. (#GH218323) | |
| - Fixed an issue where Clang would allow invoking consteval functions outside | |
| of a manifestly constant evaluated context. (#GH183415, #GH169139) | |
| - A pack-index-specifier (`T...[N]`) is now treated as a non-deduced context, | |
| per C++26 [temp.deduct.type]. This fixes a crash when matching an explicit | |
| instantiation, explicit specialization, or call against a function template | |
| whose parameter type uses pack indexing, and makes such valid matches | |
| succeed instead of being rejected. (#GH232220) | |
| #### Bug Fixes to AST Handling | |
| - Fixed a non-deterministic ordering of unused local typedefs that made | |
| serialized PCH/AST files and `-Wunused-local-typedef` diagnostics | |
| non-reproducible across runs. (#GH209639) | |
| - `FunctionDecl::getReturnTypeSourceRange()` now returns correct source | |
| location of a trailing return type. (#GH162649) | |
| - Added missed information to the AST node representing the member function | |
| when calling a explicit object member function. (#GH218829) | |
| #### Miscellaneous Bug Fixes | |
| #### Miscellaneous Clang Crashes Fixed | |
| - Fixed a crash when Microsoft extensions were enabled and an unterminated | |
| `__identifier` expression reached the end of a preprocessing directive or | |
| source file. (#GH222310) | |
| - Fixed a crash in CTAD for type alias templates when the aggregate deduction guide could not be resolved. (#GH206994) | |
| - Fixed a crash when instantiating an invalid dependent friend destructor declaration in a class template. (#GH210234) | |
| - Fixed an assertion failure when the dynamic initializer of a global variable | |
| takes the address of a file-scope compound literal whose initializer is only | |
| constant under constant-evaluation rules, such as `__builtin_constant_p` of a | |
| non-constant expression. The elements of a file-scope compound literal are now | |
| evaluated once in Sema and the results are stored in the AST. (#GH212106) | |
| - Fixed an assertion failure in `-extract-api` when a documentation comment | |
| contains invalid UTF-8. (#GH212393) | |
| - Fixed a crash in codegen on 32-bit targets caused by a struct too large to | |
| represent in `size_t`. The `err_struct_too_large` check now scales the | |
| threshold to the target's `size_t` width instead of using a fixed | |
| threshold of `1 << 60` regardless of the target. | |
| - Fixed a crash when generating fake uses for parameters of bodyless destructors with `-fextend-variable-liveness`. | |
| - Fixed a crash when filling in the ``TypeLoc`` for an ``AttributedType`` | |
| that was inherited from a different declarator, for example when | |
| ``__typeof__`` resolves to the type of another, already-processed | |
| declaration. (#GH217489) | |
| - Fixed a crash when the constant evaluator default-constructed or copied a | |
| very large array, such as a local ``T s[0xFFFFFFFF][0]`` of an empty class | |
| ``T``. Such evaluations now fail once the element count exceeds the | |
| ``-fconstexpr-steps`` limit, as they already did for ``new``. (#GH173728) | |
| - Fixed an assertion failure when instantiating a block that captures | |
| `this` via a member access through a dependent base class. | |
| - Fixed `DiagnoseUnguardedAvailability::TraverseIfStmt` dereferencing a nullptr | |
| on `if consteval {}`. (#GH220004) | |
| - Fixed an assertion when the `dim` argument to an OpenACC `gang` clause | |
| evaluated to a value not representable by a signed integer, such as an | |
| unsigned wrap around. (#GH221418) | |
| - Fixed an assertion failure when a method or function definition follows an | |
| Objective-C `@implementation` that was ended by a nested `@interface`, | |
| `@protocol` or `@implementation` before its `@end`. (#GH209503) | |
| - Fixed use-after-free with annotate attribute on a C++ class method with a this-adjusting thunk. | |
| ### OpenACC Specific Changes | |
| ### OpenCL Specific Changes | |
| - Extensions ``cl_khr_extended_bit_ops``, ``cl_khr_integer_dot_product``, | |
| ``cl_khr_subgroup_extended_types``, ``cl_khr_subgroup_rotate``, | |
| ``cl_khr_subgroup_shuffle``, and ``cl_khr_subgroup_shuffle_relative`` are | |
| promoted to core features in OpenCL C 3.1. A target claiming OpenCL C 3.1 | |
| conformance without supporting one of these features is now diagnosed. | |
| ### Target Specific Changes | |
| #### AMDGPU Support | |
| - Deprecated the following builtins in favor of `__builtin_amdgcn_ballot_w32` or | |
| `__builtin_amdgcn_ballot_w64`: | |
| - `__builtin_amdgcn_uicmp` | |
| - `__builtin_amdgcn_uicmpl` | |
| - `__builtin_amdgcn_sicmpl` | |
| - `__builtin_amdgcn_fcmp` | |
| - `__builtin_amdgcn_fcmpf` | |
| #### DirectX Support | |
| - `clang-dxc` and HLSL support are now enabled by default, following the | |
| promotion of the DirectX backend to an official LLVM target. | |
| #### NVPTX Support | |
| #### X86 Support | |
| - Support `AVX10_V2_AUX` ISA (`-mavx10v2aux`). | |
| #### Arm and AArch64 Support | |
| - Added support for the following Arm processors (command-line identifiers in | |
| parentheses): | |
| - C2-Pro (`c2-pro`). | |
| - C2-Ultra (`c2-ultra`). | |
| - Assembler/disassembler support has been added for Armv9.8-A (2026) | |
| architecture extensions. | |
| - Added support for pointer authentication discrimination of C++ virtual table | |
| pointers stored in VTTs via the `-fptrauth-vtt-vtable-pointer-discrimination` | |
| option. | |
| #### Android Support | |
| - Enabled PAC and BTI by default for AArch64 Android targets. | |
| #### Windows Support | |
| - Clang now accepts ``_except`` as an alias for ``__except`` in SEH handler | |
| position when ``-fms-compatibility`` is enabled, matching the existing | |
| ``_try``, ``_finally``, and ``_leave`` aliases. ``_except`` remains an ordinary | |
| identifier outside that context. | |
| - Fixed ``setjmp`` on 32-bit Arm passing the frame pointer, rather than the | |
| stack pointer as it was on entry to the function, as the frame value the CRT | |
| stores in the ``jmp_buf``. Clang now uses ``llvm.sponentry`` there, as it | |
| already did on AArch64. | |
| - Fixed a bug where Clang did not match the MSVC ABI on Arm64 when an | |
| over-aligned base class is followed by another base class. MSVC on Arm64 (but | |
| not Arm64EC or x64) reuses the tail padding of the over-aligned base for the | |
| subsequent base; Clang now does the same. | |
| ([#210174](https://github.com/llvm/llvm-project/issues/210174)) | |
| - Fixed ``/hotpatch`` with LTO, where objects were not marked as hotpatchable, | |
| so ``/FUNCTIONPADMIN`` didn't pad their functions. | |
| - The `__interface` tag specifier now implicitly applies `__declspec(novtable)` | |
| to the declaration, which matches the documented behavior of the keyword. #GH232046 | |
| #### LoongArch Support | |
| - `loongarch32-*-none-elf` and `loongarch64-*-none-elf` targets now use the | |
| bare-metal toolchain, like other bare-metal targets. The linker is run | |
| directly instead of through `gcc`, and host include directories are no | |
| longer searched. | |
| #### RISC-V Support | |
| - Fixed a bug where the `interrupt` attribute did not accept `machine` together | |
| with both `SiFive-CLIC-preemptible` and `SiFive-CLIC-stack-swap`. | |
| - Added a new warning when the same interrupt type is specified more than | |
| once in a RISC-V `interrupt` attribute. | |
| - SiFive CLIC preemptible interrupt handlers now support frame pointers. | |
| - Added `-march=native` for better compatibility with ARM, AArch64, and X86. This | |
| option will be treated like `-mcpu=native` if `-mcpu` is not present. If | |
| `-mcpu` is present, the ISA will be selected from the host CPU and the tune | |
| CPU will be selected from `-mcpu`. | |
| #### CUDA/HIP Language Changes | |
| - HIP compilations now add the `include/libhipcxx` directory from the selected | |
| ROCm installation to the header search path when it exists. This allows | |
| libhipcxx headers to be included with paths such as `<cuda/std/atomic>`. | |
| The `-nogpuinc` option disables this path together with the other HIP include | |
| paths. | |
| #### CUDA Support | |
| - Fixed missing diagnostics for wrong-side functions reached through constructor | |
| and member initializers, as well as inherited constructors. (#GH118415) | |
| - Fixed a CUDA miscompile caused by lambdas in reopened namespaces receiving | |
| the same mangled name. (#GH231096) | |
| - Added `--cuda-emit-nvcc-abi` to emit the NVCC-compatible host registration ABI | |
| (`__cudaRegisterLinkedBinary`). | |
| - Fixed CUDA built-in variables such as `threadIdx` and `blockDim` being incorrectly treated as having side effects in assumptions. (#GH181340) | |
| - Clang now provides device-side definitions of `__cxa_pure_virtual()` and | |
| `__cxa_deleted_virtual()`; previously, any (potential) call to a pure/deleted | |
| virtual function that could not be optimised out would cause the program to | |
| fail to assemble. This is now fixed. (#GH49183) (#GH67533) | |
| - External CUDA kernel declarations now use the correct calling convention. (#GH118212) | |
| #### AIX Support | |
| #### NetBSD Support | |
| #### WebAssembly Support | |
| - Added `__builtin_wasm_memory_copy` and `__builtin_wasm_memory_fill` builtins | |
| for the WebAssembly `memory.copy` and `memory.fill` bulk memory instructions. | |
| - Fixed a "function signature mismatch" trap at program exit when destroying a | |
| temporary that is bound to a reference with static or thread storage | |
| duration. (#GH45221) | |
| #### AVR Support | |
| #### SystemZ Support | |
| ### DWARF Support in Clang | |
| ### Floating Point Support in Clang | |
| ### Fixed Point Support in Clang | |
| ### AST Matchers | |
| ### clang-format | |
| - Add `SpacesInBlockComments` option to control spacing after `/*` and | |
| before `*/` in ordinary block comments. | |
| - Add `AfterRequiresExpression` sub-option of `BraceWrapping` to wrap the | |
| body of requires expressions. It is enabled by the `Allman`, `Whitesmiths`, | |
| and `GNU` styles of `BreakBeforeBraces`. | |
| - Add `AtEndOfBlock` sub-option of `KeepEmptyLines` to control the number of | |
| empty lines kept at end of blocks. | |
| - `QualifierOrder` now supports `typedef`, `consteval`, `constinit`, | |
| `thread_local`, `extern`, `mutable`, `signed`, `unsigned`, `long`, `short`, | |
| and `explicit` declaration specifiers. | |
| - Extend `IndentAccessModifiers` with `AfterFirstAccessModifier` to indent | |
| members before the first explicit access modifier by one level. Existing | |
| configuration values `true` and `false` remain supported. | |
| ### libclang | |
| - visit identifier initializers in lambda capture as VarDecl instead of VariableRef. Warning: this changes behaviour. | |
| - add unary operator handling to `clang_getCursorSpelling()`. | |
| ### Code Completion | |
| - Parameters declared with a `decltype` are now presented as the type the | |
| `decltype` resolves to, e.g. `set_x(int val)` rather than | |
| `set_x(decltype(x) val)`. This affects the completion strings produced by | |
| libclang as well as those used by clangd. | |
| - Members inherited from a dependent base class that is named through an alias | |
| template are suggested by code completion when relevant. | |
| ### Static Analyzer | |
| #### Crash and bug fixes | |
| % comment: | |
| % This is for the Static Analyzer. | |
| % Use `####` headings for subsections: | |
| % - Crash and bug fixes | |
| % - New checkers and features | |
| % - Improvements | |
| % - Moved checkers | |
| % - Diagnostic changes | |
| #### Improvements | |
| - The lock-order-reversal check in ``alpha.unix.PthreadLock`` is now disabled by default. | |
| It can be re-enabled with the ``WarnOnLockOrderReversal`` option. | |
| #### Moved checkers | |
| The `alpha.cplusplus.UseAfterLifetimeEnd` checker was renamed to `alpha.core.UseAfterLifetimeEnd`. | |
| #### Diagnostic changes | |
| - For self-assignments during initialization (`T v = v;`), `core.uninitialized.Assign` will not report them as uninitialized accesses (except C++ reference types), and the checks will be delayed until the first accesses of these variables; `deadcode.DeadStores` will not report them as dead stores. (#GH187530) | |
| (release-notes-sanitizers)= | |
| ### Sanitizers | |
| - Added the `typefunchash` and `typefunchashpointersplit` token assignment | |
| modes for `-fsanitize=alloc-token`, selected with | |
| `-Xclang -falloc-token-mode=<mode>`. These modes derive token IDs from both | |
| the allocated type and the name of the function containing the allocation. | |
| ### Python Binding Changes | |
| - Fixed a crash (`SIGFPE`) when traversing an AST via the visitor callbacks | |
| (e.g. `Cursor.get_children`) on s390x. The callbacks now return a full | |
| register word so the return value is correctly extended, working around a | |
| `ctypes` bug (https://github.com/python/cpython/issues/156933) that left the | |
| high bytes of the return register uninitialized. | |
| - Add support for retrieving unary operator information through `Cursor.unary_operator()`. | |
| ### OpenMP Support | |
| - Fixed an OpenMP `requires` directive read from a PCH or module losing its effect on | |
| semantic checks, which caused spurious `reverse_offload` errors. | |
| - Added the OpenMP 6.1 `#pragma omp flatten` loop transformation and the | |
| `depth` clause. Flatten combines perfectly nested canonical loops into one | |
| loop. `depth(k)` selects how many outermost loops to combine (default 2). | |
| - Fixed a crash when the statement of an OpenMP `atomic` directive contains an | |
| invalid expression, such as `0--;`. (#GH107979) | |
| - Canonicalize intra-tiles in loop tiling. `#pragma omp tile` still emits a | |
| min-bounded inner loop, which vectorizes well. When a parent directive such as | |
| `for collapse(n)` needs a constant per-tile trip count, Clang rereads a | |
| droppable hint and treats that inner loop as rectangular, with an overshoot | |
| guard only if the last tile can be partial. | |
| Not yet supported (diagnosed, left as follow-up): | |
| - `collapse` through stacked `#pragma omp tile` (the inner floor is not a | |
| collapsed counter). | |
| - A loop transformation (`tile`, `unroll`, `interchange`, ...) that consumes | |
| another tile's intra-tile loop. | |
| - Added parsing and semantic support for `dims` modifier in `num_teams`, | |
| `thread_limit` and `num_threads` clauses for OpenMP 6.1 or later. | |
| - Map-type-modifying modifiers applied to a list item with a user-defined mapper | |
| are now propagated onto the maps the mapper expands to. | |
| - Mapping of expressions with base-pointers through a user-defined mapper (e.g. | |
| `map(s.p[0:n])`) now conforms to OpenMP's conditional pointer-attachment, | |
| matching the behavior of such maps outside a mapper. | |
| - Fixed a crash when the `safelen` and `simdlen` clauses of an OpenMP directive | |
| have arguments of different integer types. (#GH108367) | |
| - The `holds` clause on the `assume` directive now lowers side-effect-free | |
| conditions to `llvm.assume`, enabling downstream optimizations. Previously | |
| the clause was parsed but its condition was discarded without effect. | |
| - Fixed a crash when the loop variable or a loop bound of an OpenMP loop has a | |
| `_BitInt` type wider than any standard integer type. (#GH140074) | |
| - Added support for capturing structured bindings in OpenMP regions | |
| (a C++20 extension; warned as an extension in C++17). Individual bindings | |
| form aggregate decompositions(structs, classes, and arrays) can now be used | |
| in data-sharing clauses (``private``, ``firstprivate``, ``lastprivate``, | |
| ``shared``, ``linear``) and ``map`` clauses for target directives. | |
| Tuple-like bindings (types using the tuple protocol with ``get<N>()``, | |
| such as ``std::pair`` or ``std::tuple``) are not yet supported and | |
| will produce a compilation error. Reduction clauses with structured bindings | |
| are not yet supported. | |
| When the original variable is explicitly mapped in a target region | |
| but only bindings from it are used (not the original variable itself), | |
| modifications to the bindings will not be reflected in the original variable. | |
| To ensure correct behavior, either use the original variable directly in the | |
| target region or map the bindings explicitly instead. | |
| ### SYCL Support | |
| #### Improvements | |
| ## Additional Information | |
| A wide variety of additional information is available on the [Clang web | |
| page](https://clang.llvm.org/). The web page contains versions of the | |
| API documentation which are up-to-date with the Git version of | |
| the source code. You can access versions of these documents specific to | |
| this release by going into the "`clang/docs/`" directory in the Clang | |
| tree. | |
| If you have any questions or comments about Clang, please feel free to | |
| contact us on the [Discourse forums (Clang Frontend category)](https://discourse.llvm.org/c/clang/6). |