1 ===========================================
2 Clang |release| |ReleaseNotesTitle|
3 ===========================================
9 Written by the `LLVM Team <https://llvm.org/>`_
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/>`_.
21 This document contains the release notes for the Clang C/C++/Objective-C
22 frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
23 describe the status of Clang in some detail, including major
24 improvements from the previous release and new feature work. For the
25 general LLVM release notes, see `the LLVM
26 documentation <https://llvm.org/docs/ReleaseNotes.html>`_. For the libc++ release notes,
27 see `this page <https://libcxx.llvm.org/ReleaseNotes.html>`_. All LLVM releases
28 may be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
30 For more information about Clang or LLVM, including information about the
31 latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
32 `LLVM Web Site <https://llvm.org>`_.
34 Potentially Breaking Changes
35 ============================
36 These changes are ones which we think may surprise users when upgrading to
37 Clang |release| because of the opportunity they pose for disruption to existing
41 C/C++ Language Potentially Breaking Changes
42 -------------------------------------------
44 C++ Specific Potentially Breaking Changes
45 -----------------------------------------
47 ABI Changes in This Version
48 ---------------------------
49 - Following the SystemV ABI for x86-64, ``__int128`` arguments will no longer
50 be split between a register and a stack slot.
52 What's New in Clang |release|?
53 ==============================
54 Some of the major new features and improvements to Clang are listed
55 here. Generic improvements to Clang as a whole or to its underlying
56 infrastructure are described first, followed by language-specific
57 sections with improvements to Clang's support for those languages.
71 - Implemented `P2169R4: A nice placeholder with no name <https://wg21.link/P2169R4>`_. This allows using ``_``
72 as a variable name multiple times in the same scope and is supported in all C++ language modes as an extension.
73 An extension warning is produced when multiple variables are introduced by ``_`` in the same scope.
74 Unused warnings are no longer produced for variables named ``_``.
75 Currently, inspecting placeholders variables in a debugger when more than one are declared in the same scope
81 int _, _; // Was invalid, now OK
84 int _, _; // Was invalid, now OK
87 int _; // Previously diagnosed under -Wunused, no longer diagnosed
90 - Attributes now expect unevaluated strings in attributes parameters that are string literals.
91 This is applied to both C++ standard attributes, and other attributes supported by Clang.
92 This completes the implementation of `P2361R6 Unevaluated Strings <https://wg21.link/P2361R6>`_
95 Resolutions to C++ Defect Reports
96 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100 - ``structs``, ``unions``, and ``arrays`` that are const may now be used as
101 constant expressions. This change is more consistent with the behavior of
106 - Clang now accepts ``-std=c23`` and ``-std=gnu23`` as language standard modes,
107 and the ``__STDC_VERSION__`` macro now expands to ``202311L`` instead of its
108 previous placeholder value. Clang continues to accept ``-std=c2x`` and
109 ``-std=gnu2x`` as aliases for C23 and GNU C23, respectively.
110 - Clang now supports `requires c23` for module maps.
112 Non-comprehensive list of changes in this release
113 -------------------------------------------------
118 Deprecated Compiler Flags
119 -------------------------
121 Modified Compiler Flags
122 -----------------------
124 * ``-Woverriding-t-option`` is renamed to ``-Woverriding-option``.
125 * ``-Winterrupt-service-routine`` is renamed to ``-Wexcessive-regsave`` as a generalization
127 Removed Compiler Flags
128 -------------------------
130 * ``-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang`` has been removed.
131 It has not been needed to enable ``-ftrivial-auto-var-init=zero`` since Clang 16.
133 Attribute Changes in Clang
134 --------------------------
135 - On X86, a warning is now emitted if a function with ``__attribute__((no_caller_saved_registers))``
136 calls a function without ``__attribute__((no_caller_saved_registers))``, and is not compiled with
137 ``-mgeneral-regs-only``
138 - On X86, a function with ``__attribute__((interrupt))`` can now call a function without
139 ``__attribute__((no_caller_saved_registers))`` provided that it is compiled with ``-mgeneral-regs-only``
141 - When a non-variadic function is decorated with the ``format`` attribute,
142 Clang now checks that the format string would match the function's parameters'
143 types after default argument promotion. As a result, it's no longer an
144 automatic diagnostic to use parameters of types that the format style
145 supports but that are never the result of default argument promotion, such as
146 ``float``. (`#59824: <https://github.com/llvm/llvm-project/issues/59824>`_)
148 Improvements to Clang's diagnostics
149 -----------------------------------
150 - Clang constexpr evaluator now prints template arguments when displaying
151 template-specialization function calls.
152 - Clang contexpr evaluator now displays notes as well as an error when a constructor
153 of a base class is not called in the constructor of its derived class.
154 - Clang no longer emits ``-Wmissing-variable-declarations`` for variables declared
155 with the ``register`` storage class.
156 - Clang's ``-Wtautological-negation-compare`` flag now diagnoses logical
157 tautologies like ``x && !x`` and ``!x || x`` in expressions. This also
158 makes ``-Winfinite-recursion`` diagnose more cases.
159 (`#56035: <https://github.com/llvm/llvm-project/issues/56035>`_).
160 - Clang constexpr evaluator now diagnoses compound assignment operators against
161 uninitialized variables as a read of uninitialized object.
162 (`#51536 <https://github.com/llvm/llvm-project/issues/51536>`_)
163 - Clang's ``-Wfortify-source`` now diagnoses ``snprintf`` call that is known to
164 result in string truncation.
165 (`#64871: <https://github.com/llvm/llvm-project/issues/64871>`_).
166 Also clang no longer emits false positive warnings about the output length of
167 ``%g`` format specifier.
168 - Clang now emits ``-Wcast-qual`` for functional-style cast expressions.
170 Bug Fixes in This Version
171 -------------------------
172 - Fixed an issue where a class template specialization whose declaration is
173 instantiated in one module and whose definition is instantiated in another
174 module may end up with members associated with the wrong declaration of the
175 class, which can result in miscompiles in some cases.
176 - Fix crash on use of a variadic overloaded operator.
177 (`#42535 <https://github.com/llvm/llvm-project/issues/42535>`_)
178 - Fix a hang on valid C code passing a function type as an argument to
179 ``typeof`` to form a function declaration.
180 (`#64713 <https://github.com/llvm/llvm-project/issues/64713>`_)
181 - Clang now reports missing-field-initializers warning for missing designated
183 (`#56628 <https://github.com/llvm/llvm-project/issues/56628>`_)
184 - Clang now respects ``-fwrapv`` and ``-ftrapv`` for ``__builtin_abs`` and
186 (`#45129 <https://github.com/llvm/llvm-project/issues/45129>`_,
187 `#45794 <https://github.com/llvm/llvm-project/issues/45794>`_)
188 - Fixed an issue where accesses to the local variables of a coroutine during
189 ``await_suspend`` could be misoptimized, including accesses to the awaiter
191 (`#56301 <https://github.com/llvm/llvm-project/issues/56301>`_)
192 The current solution may bring performance regressions if the awaiters have
193 non-static data members. See
194 `#64945 <https://github.com/llvm/llvm-project/issues/64945>`_ for details.
195 - Clang now prints unnamed members in diagnostic messages instead of giving an
197 (`#63759 <https://github.com/llvm/llvm-project/issues/63759>`_)
198 - Fix crash in __builtin_strncmp and related builtins when the size value
199 exceeded the maximum value representable by int64_t. Fixes
200 (`#64876 <https://github.com/llvm/llvm-project/issues/64876>`_)
201 - Fixed an assertion if a function has cleanups and fatal erors.
202 (`#48974 <https://github.com/llvm/llvm-project/issues/48974>`_)
203 - Clang now emits an error if it is not possible to deduce array size for a
204 variable with incomplete array type.
205 (`#37257 <https://github.com/llvm/llvm-project/issues/37257>`_)
206 - Clang's ``-Wunused-private-field`` no longer warns on fields whose type is
207 declared with ``[[maybe_unused]]``.
208 (`#61334 <https://github.com/llvm/llvm-project/issues/61334>`_)
209 - For function multi-versioning using the ``target``, ``target_clones``, or
210 ``target_version`` attributes, remove comdat for internal linkage functions.
211 (`#65114 <https://github.com/llvm/llvm-project/issues/65114>`_)
212 - Clang now reports ``-Wformat`` for bool value and char specifier confusion
214 (`#64987 <https://github.com/llvm/llvm-project/issues/64987>`_)
215 - Support MSVC predefined macro expressions in constant expressions and in
217 - Correctly parse non-ascii identifiers that appear immediately after a line splicing
218 (`#65156 <https://github.com/llvm/llvm-project/issues/65156>`_`)
219 - Clang no longer considers the loss of ``__unaligned`` qualifier from objects as
220 an invalid conversion during method function overload resolution.
222 Bug Fixes to Compiler Builtins
223 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
225 Bug Fixes to Attribute Support
226 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
228 Bug Fixes to C++ Support
229 ^^^^^^^^^^^^^^^^^^^^^^^^
231 - Clang limits the size of arrays it will try to evaluate at compile time
232 to avoid memory exhaustion.
233 This limit can be modified by `-fconstexpr-steps`.
234 (`#63562 <https://github.com/llvm/llvm-project/issues/63562>`_)
236 - Fix a crash caused by some named unicode escape sequences designating
237 a Unicode character whose name contains a ``-``.
238 (Fixes `#64161 <https://github.com/llvm/llvm-project/issues/64161>`_)
240 - Fix cases where we ignore ambiguous name lookup when looking up members.
241 (`#22413 <https://github.com/llvm/llvm-project/issues/22413>`_),
242 (`#29942 <https://github.com/llvm/llvm-project/issues/29942>`_),
243 (`#35574 <https://github.com/llvm/llvm-project/issues/35574>`_) and
244 (`#27224 <https://github.com/llvm/llvm-project/issues/27224>`_).
246 - Clang emits an error on substitution failure within lambda body inside a
247 requires-expression. This fixes:
248 (`#64138 <https://github.com/llvm/llvm-project/issues/64138>`_).
250 - Update ``FunctionDeclBitfields.NumFunctionDeclBits``. This fixes:
251 (`#64171 <https://github.com/llvm/llvm-project/issues/64171>`_).
253 - Expressions producing ``nullptr`` are correctly evaluated
254 by the constant interpreter when appearing as the operand
255 of a binary comparison.
256 (`#64923 <https://github.com/llvm/llvm-project/issues/64923>`_)
258 - Fix a crash when an immediate invocation is not a constant expression
259 and appear in an implicit cast.
260 (`#64949 <https://github.com/llvm/llvm-project/issues/64949>`_).
262 - Fix crash when parsing ill-formed lambda trailing return type. Fixes:
263 (`#64962 <https://github.com/llvm/llvm-project/issues/64962>`_) and
264 (`#28679 <https://github.com/llvm/llvm-project/issues/28679>`_).
266 - Fix a crash caused by substitution failure in expression requirements.
267 (`#64172 <https://github.com/llvm/llvm-project/issues/64172>`_) and
268 (`#64723 <https://github.com/llvm/llvm-project/issues/64723>`_).
270 - Fix crash when parsing the requires clause of some generic lambdas.
271 (`#64689 <https://github.com/llvm/llvm-project/issues/64689>`_)
273 - Fix crash when the trailing return type of a generic and dependent
274 lambda refers to an init-capture.
275 (`#65067 <https://github.com/llvm/llvm-project/issues/65067>`_` and
276 `#63675 <https://github.com/llvm/llvm-project/issues/63675>`_`)
278 Bug Fixes to AST Handling
279 ^^^^^^^^^^^^^^^^^^^^^^^^^
280 - Fixed an import failure of recursive friend class template.
281 `Issue 64169 <https://github.com/llvm/llvm-project/issues/64169>`_
282 - Remove unnecessary RecordLayout computation when importing UnaryOperator. The
283 computed RecordLayout is incorrect if fields are not completely imported and
284 should not be cached.
285 `Issue 64170 <https://github.com/llvm/llvm-project/issues/64170>`_
287 Miscellaneous Bug Fixes
288 ^^^^^^^^^^^^^^^^^^^^^^^
290 Miscellaneous Clang Crashes Fixed
291 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
292 - Fixed a crash when parsing top-level ObjC blocks that aren't properly
293 terminated. Clang should now also recover better when an @end is missing
295 `Issue 64065 <https://github.com/llvm/llvm-project/issues/64065>`_
296 - Fixed a crash when check array access on zero-length element.
297 `Issue 64564 <https://github.com/llvm/llvm-project/issues/64564>`_
299 Target Specific Changes
300 -----------------------
304 - Use pass-by-reference (byref) in stead of pass-by-value (byval) for struct
305 arguments in C ABI. Callee is responsible for allocating stack memory and
306 copying the value of the struct if modified. Note that AMDGPU backend still
307 supports byval for struct arguments.
312 - Added option ``-m[no-]evex512`` to disable ZMM and 64-bit mask instructions
315 Arm and AArch64 Support
316 ^^^^^^^^^^^^^^^^^^^^^^^
320 - Fixed an assertion failure that occurred due to a failure to propagate
321 ``MSInheritanceAttr`` attributes to class template instantiations created
322 for explicit template instantiation declarations.
324 - The ``-fno-auto-import`` option was added for MinGW targets. The option both
325 affects code generation (inhibiting generating indirection via ``.refptr``
326 stubs for potentially auto imported symbols, generating smaller and more
327 efficient code) and linking (making the linker error out on such cases).
328 If the option only is used during code generation but not when linking,
329 linking may succeed but the resulting executables may expose issues at
337 - Unaligned memory accesses can be toggled by ``-m[no-]unaligned-access`` or the
338 aliases ``-m[no-]strict-align``.
340 CUDA/HIP Language Changes
341 ^^^^^^^^^^^^^^^^^^^^^^^^^
349 - Introduced the ``-maix-small-local-exec-tls`` option to produce a faster
350 access sequence for local-exec TLS variables where the offset from the TLS
351 base is encoded as an immediate operand.
352 This access sequence is not used for TLS variables larger than 32KB, and is
353 currently only supported on 64-bit mode.
361 DWARF Support in Clang
362 ----------------------
364 Floating Point Support in Clang
365 -------------------------------
366 - Add ``__builtin_elementwise_log`` builtin for floating point types only.
367 - Add ``__builtin_elementwise_log10`` builtin for floating point types only.
368 - Add ``__builtin_elementwise_log2`` builtin for floating point types only.
369 - Add ``__builtin_elementwise_exp`` builtin for floating point types only.
370 - Add ``__builtin_elementwise_exp2`` builtin for floating point types only.
371 - Add ``__builtin_set_flt_rounds`` builtin for X86, x86_64, Arm and AArch64 only.
372 - Add ``__builtin_elementwise_pow`` builtin for floating point types only.
373 - Add ``__builtin_elementwise_bitreverse`` builtin for integer types only.
374 - Add ``__builtin_elementwise_sqrt`` builtin for floating point types only.
375 - ``__builtin_isfpclass`` builtin now supports vector types.
376 - ``#pragma float_control(precise,on)`` enables precise floating-point
377 semantics. If ``math-errno`` is disabled in the current TU, clang will
378 re-enable ``math-errno`` in the presense of
379 ``#pragma float_control(precise,on)``.
380 - Add ``__builtin_exp10``, ``__builtin_exp10f``,
381 ``__builtin_exp10f16``, ``__builtin_exp10l`` and
382 ``__builtin_exp10f128`` builtins.
386 - Add ``convertVectorExpr``.
387 - Add ``dependentSizedExtVectorType``.
388 - Add ``macroQualifiedType``.
392 - Add ``AllowBreakBeforeNoexceptSpecifier`` option.
397 - Exposed arguments of ``clang::annotate``.
402 - Added a new checker ``core.BitwiseShift`` which reports situations where
403 bitwise shift operators produce undefined behavior (because some operand is
404 negative or too large).
406 .. _release-notes-sanitizers:
411 - ``-fsanitize=signed-integer-overflow`` now instruments ``__builtin_abs`` and
414 Python Binding Changes
415 ----------------------
417 Additional Information
418 ======================
420 A wide variety of additional information is available on the `Clang web
421 page <https://clang.llvm.org/>`_. The web page contains versions of the
422 API documentation which are up-to-date with the Git version of
423 the source code. You can access versions of these documents specific to
424 this release by going into the "``clang/docs/``" directory in the Clang
427 If you have any questions or comments about Clang, please feel free to
428 contact us on the `Discourse forums (Clang Frontend category)
429 <https://discourse.llvm.org/c/clang/6>`_.