2022-02-01 23:13:01 -08:00
|
|
|
===========================================
|
|
|
|
Clang |release| |ReleaseNotesTitle|
|
|
|
|
===========================================
|
2020-02-13 22:46:33 +01:00
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
|
|
|
:depth: 2
|
|
|
|
|
|
|
|
Written by the `LLVM Team <https://llvm.org/>`_
|
|
|
|
|
2022-02-01 23:13:01 -08:00
|
|
|
.. only:: PreRelease
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2022-02-01 23:13:01 -08:00
|
|
|
.. warning::
|
|
|
|
These are in-progress notes for the upcoming Clang |version| release.
|
|
|
|
Release notes for previous releases can be found on
|
2023-03-05 00:56:15 +02:00
|
|
|
`the Releases Page <https://llvm.org/releases/>`_.
|
2020-02-13 22:46:33 +01:00
|
|
|
|
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
|
|
|
|
This document contains the release notes for the Clang C/C++/Objective-C
|
2022-02-01 23:13:01 -08:00
|
|
|
frontend, part of the LLVM Compiler Infrastructure, release |release|. Here we
|
2020-02-13 22:46:33 +01:00
|
|
|
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
|
2023-02-15 23:53:38 +02:00
|
|
|
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/>`_.
|
2020-02-13 22:46:33 +01:00
|
|
|
|
|
|
|
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>`_.
|
|
|
|
|
2022-09-15 07:29:49 -04:00
|
|
|
Potentially Breaking Changes
|
|
|
|
============================
|
|
|
|
These changes are ones which we think may surprise users when upgrading to
|
|
|
|
Clang |release| because of the opportunity they pose for disruption to existing
|
|
|
|
code bases.
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
C/C++ Language Potentially Breaking Changes
|
|
|
|
-------------------------------------------
|
2023-05-23 14:41:43 -07:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
C++ Specific Potentially Breaking Changes
|
|
|
|
-----------------------------------------
|
2024-01-19 15:08:39 +08:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
ABI Changes in This Version
|
|
|
|
---------------------------
|
|
|
|
|
2023-10-26 19:28:28 +01:00
|
|
|
AST Dumping Potentially Breaking Changes
|
|
|
|
----------------------------------------
|
|
|
|
|
2024-01-30 09:30:20 -08:00
|
|
|
Clang Frontend Potentially Breaking Changes
|
|
|
|
-------------------------------------------
|
2024-02-01 11:50:50 -05:00
|
|
|
- Removed support for constructing on-stack ``TemplateArgumentList``s; interfaces should instead
|
|
|
|
use ``ArrayRef<TemplateArgument>`` to pass template arguments. Transitioning internal uses to
|
|
|
|
``ArrayRef<TemplateArgument>`` reduces AST memory usage by 0.4% when compiling clang, and is
|
|
|
|
expected to show similar improvements on other workloads.
|
2024-01-30 09:30:20 -08:00
|
|
|
|
2024-02-14 09:08:28 -05:00
|
|
|
- The ``-Wgnu-binary-literal`` diagnostic group no longer controls any
|
|
|
|
diagnostics. Binary literals are no longer a GNU extension, they're now a C23
|
|
|
|
extension which is controlled via ``-pedantic`` or ``-Wc23-extensions``. Use
|
|
|
|
of ``-Wno-gnu-binary-literal`` will no longer silence this pedantic warning,
|
|
|
|
which may break existing uses with ``-Werror``.
|
|
|
|
|
2024-01-30 09:30:20 -08:00
|
|
|
Target OS macros extension
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
A new Clang extension (see :ref:`here <target_os_detail>`) is enabled for
|
|
|
|
Darwin (Apple platform) targets. Clang now defines ``TARGET_OS_*`` macros for
|
|
|
|
these targets, which could break existing code bases with improper checks for
|
|
|
|
the ``TARGET_OS_`` macros. For example, existing checks might fail to include
|
|
|
|
the ``TargetConditionals.h`` header from Apple SDKs and therefore leaving the
|
|
|
|
macros undefined and guarded code unexercised.
|
|
|
|
|
|
|
|
Affected code should be checked to see if it's still intended for the specific
|
|
|
|
target and fixed accordingly.
|
|
|
|
|
|
|
|
The extension can be turned off by the option ``-fno-define-target-os-macros``
|
|
|
|
as a workaround.
|
|
|
|
|
2022-02-01 23:13:01 -08:00
|
|
|
What's New in Clang |release|?
|
|
|
|
==============================
|
2020-02-13 22:46:33 +01:00
|
|
|
Some of the major new features and improvements to Clang are listed
|
|
|
|
here. Generic improvements to Clang as a whole or to its underlying
|
|
|
|
infrastructure are described first, followed by language-specific
|
|
|
|
sections with improvements to Clang's support for those languages.
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
C++ Language Changes
|
|
|
|
--------------------
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
C++20 Feature Support
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
2022-03-12 20:49:01 +01:00
|
|
|
|
2024-01-29 11:42:08 +08:00
|
|
|
- Clang won't perform ODR checks for decls in the global module fragment any
|
|
|
|
more to ease the implementation and improve the user's using experience.
|
2024-02-01 13:44:32 +08:00
|
|
|
This follows the MSVC's behavior. Users interested in testing the more strict
|
|
|
|
behavior can use the flag '-Xclang -fno-skip-odr-check-in-gmf'.
|
2024-01-29 11:42:08 +08:00
|
|
|
(`#79240 <https://github.com/llvm/llvm-project/issues/79240>`_).
|
|
|
|
|
2023-04-30 15:27:00 +02:00
|
|
|
C++23 Feature Support
|
2023-02-15 23:53:38 +02:00
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
2023-12-07 14:52:10 +01:00
|
|
|
|
2024-01-30 06:48:14 +08:00
|
|
|
- Implemented `P2718R0: Lifetime extension in range-based for loops <https://wg21.link/P2718R0>`_. Also
|
|
|
|
materialize temporary object which is a prvalue in discarded-value expression.
|
|
|
|
|
2023-05-12 07:30:21 -07:00
|
|
|
C++2c Feature Support
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-01-27 10:23:38 +01:00
|
|
|
- Implemented `P2662R3 Pack Indexing <https://wg21.link/P2662R3>`_.
|
|
|
|
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Resolutions to C++ Defect Reports
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
[Sema] Substitute parameter packs when deduced from function arguments (#79371)
This pull request would solve
https://github.com/llvm/llvm-project/issues/78449 .
There is also a discussion about this on stackoverflow:
https://stackoverflow.com/questions/77832658/stdtype-identity-to-support-several-variadic-argument-lists
.
The following program is well formed:
```cpp
#include <type_traits>
template <typename... T>
struct args_tag
{
using type = std::common_type_t<T...>;
};
template <typename... T>
void bar(args_tag<T...>, std::type_identity_t<T>..., int, std::type_identity_t<T>...) {}
// example
int main() {
bar(args_tag<int, int>{}, 4, 8, 15, 16, 23);
}
```
but Clang rejects it, while GCC and MSVC doesn't. The reason for this is
that, in `Sema::DeduceTemplateArguments` we are not prepared for this
case.
# Substitution/deduction of parameter packs
The logic that handles substitution when we have explicit template
arguments (`SubstituteExplicitTemplateArguments`) does not work here,
since the types of the pack are not pushed to `ParamTypes` before the
loop starts that does the deduction.
The other "candidate" that may could have handle this case would be the
loop that does the deduction for trailing packs, but we are not dealing
with trailing packs here.
# Solution proposed in this PR
The solution proposed in this PR works similar to the trailing pack
deduction. The main difference here is the end of the deduction cycle.
When a non-trailing template pack argument is found, whose type is not
explicitly specified and the next type is not a pack type, the length of
the previously deduced pack is retrieved (let that length be `s`). After
that the next `s` arguments are processed in the same way as in the case
of non trailing packs.
# Another possible solution
There is another possible approach that would be less efficient. In the
loop when we get to an element of `ParamTypes` that is a pack and could
be substituted because the type is deduced from a previous argument,
then `s` number of arg types would be inserted before the current
element of `ParamTypes` type. Then we would "cancel" the processing of
the current element, first process the previously inserted elements and
the after that re-process the current element.
Basically we would do what `SubstituteExplicitTemplateArguments` does
but during deduction.
# Adjusted test cases
In
`clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp`
there is a test case named `test_pack_not_at_end` that should work, but
still does not. This test case is relevant because the note for the
error message has changed.
This is what the test case looks like currently:
```cpp
template<typename ...Types>
void pack_not_at_end(tuple<Types...>, Types... values, int); // expected-note {{<int *, double *> vs. <int, int>}}
void test_pack_not_at_end(tuple<int*, double*> t2) {
pack_not_at_end(t2, 0, 0, 0); // expected-error {{no match}}
// FIXME: Should the "original argument type must match deduced parameter
// type" rule apply here?
pack_not_at_end<int*, double*>(t2, 0, 0, 0); // ok
}
```
The previous note said (before my changes):
```
deduced conflicting types for parameter 'Types' (<int *, double *> vs. <>)
````
The current note says (after my changesand also clang 14 would say this
if the pack was not trailing):
```
deduced conflicting types for parameter 'Types' (<int *, double *> vs. <int, int>)
```
GCC says:
```
error: no matching function for call to ‘pack_not_at_end(std::tuple<int*, double*>&, int, int, int)’
70 | pack_not_at_end(t2, 0, 0, 9); // expected-error {{no match}}
````
---------
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: Erich Keane <ekeane@nvidia.com>
2024-01-27 10:43:38 +01:00
|
|
|
- Substitute template parameter pack, when it is not explicitly specified
|
|
|
|
in the template parameters, but is deduced from a previous argument.
|
|
|
|
(`#78449: <https://github.com/llvm/llvm-project/issues/78449>`_).
|
2024-01-17 06:16:12 +01:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
C Language Changes
|
|
|
|
------------------
|
|
|
|
|
2023-08-10 14:18:36 -04:00
|
|
|
C23 Feature Support
|
2023-02-15 23:53:38 +02:00
|
|
|
^^^^^^^^^^^^^^^^^^^
|
2024-02-14 09:08:28 -05:00
|
|
|
- No longer diagnose use of binary literals as an extension in C23 mode. Fixes
|
|
|
|
`#72017 <https://github.com/llvm/llvm-project/issues/72017>`_.
|
2023-11-20 10:52:11 -05:00
|
|
|
|
2024-02-15 07:58:01 -05:00
|
|
|
- Corrected parsing behavior for the ``alignas`` specifier/qualifier in C23. We
|
|
|
|
previously handled it as an attribute as in C++, but there are parsing
|
|
|
|
differences. The behavioral differences are:
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
struct alignas(8) /* was accepted, now rejected */ S {
|
|
|
|
char alignas(8) /* was rejected, now accepted */ C;
|
|
|
|
};
|
|
|
|
int i alignas(8) /* was accepted, now rejected */ ;
|
|
|
|
|
|
|
|
Fixes (`#81472 <https://github.com/llvm/llvm-project/issues/81472>`_).
|
|
|
|
|
2022-08-26 10:04:06 -04:00
|
|
|
Non-comprehensive list of changes in this release
|
|
|
|
-------------------------------------------------
|
2022-08-26 09:17:14 -04:00
|
|
|
|
2024-02-13 10:06:25 -06:00
|
|
|
- Added ``__builtin_readsteadycounter`` for reading fixed frequency hardware
|
|
|
|
counters.
|
|
|
|
|
2024-02-15 09:41:19 -06:00
|
|
|
- ``__builtin_addc``, ``__builtin_subc``, and the other sizes of those
|
|
|
|
builtins are now constexpr and may be used in constant expressions.
|
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
New Compiler Flags
|
|
|
|
------------------
|
2023-09-28 07:18:11 -07:00
|
|
|
|
2024-01-30 09:30:20 -08:00
|
|
|
.. _target_os_detail:
|
|
|
|
|
|
|
|
Target OS macros extension
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
A pair of new flags ``-fdefine-target-os-macros`` and
|
|
|
|
``-fno-define-target-os-macros`` has been added to Clang to enable/disable the
|
|
|
|
extension to provide built-in definitions of a list of ``TARGET_OS_*`` macros
|
|
|
|
based on the target triple.
|
|
|
|
|
|
|
|
The extension is enabled by default for Darwin (Apple platform) targets.
|
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
Deprecated Compiler Flags
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
Modified Compiler Flags
|
|
|
|
-----------------------
|
2023-01-23 13:25:55 +02:00
|
|
|
|
2020-12-17 09:23:02 -05:00
|
|
|
Removed Compiler Flags
|
|
|
|
-------------------------
|
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
Attribute Changes in Clang
|
|
|
|
--------------------------
|
2023-11-22 12:51:24 +01:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Improvements to Clang's diagnostics
|
|
|
|
-----------------------------------
|
2024-01-27 17:52:20 +01:00
|
|
|
- Clang now applies syntax highlighting to the code snippets it
|
|
|
|
prints.
|
2023-10-25 08:58:28 -07:00
|
|
|
|
2024-02-01 11:19:04 -05:00
|
|
|
- Clang now diagnoses member template declarations with multiple declarators.
|
2024-02-08 13:37:55 +01:00
|
|
|
|
|
|
|
- Clang now diagnoses use of the ``template`` keyword after declarative nested
|
|
|
|
name specifiers.
|
|
|
|
|
|
|
|
- The ``-Wshorten-64-to-32`` diagnostic is now grouped under ``-Wimplicit-int-conversion`` instead
|
|
|
|
of ``-Wconversion``. Fixes `#69444 <https://github.com/llvm/llvm-project/issues/69444>`_.
|
2024-02-01 11:19:04 -05:00
|
|
|
|
2024-02-13 14:25:56 -05:00
|
|
|
- Clang now diagnoses friend declarations with an ``enum`` elaborated-type-specifier in language modes after C++98.
|
|
|
|
|
2023-09-01 15:30:44 +01:00
|
|
|
Improvements to Clang's time-trace
|
|
|
|
----------------------------------
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Bug Fixes in This Version
|
|
|
|
-------------------------
|
2024-01-30 08:28:13 -05:00
|
|
|
- Clang now accepts elaborated-type-specifiers that explicitly specialize
|
|
|
|
a member class template for an implicit instantiation of a class template.
|
2023-10-10 10:25:01 +02:00
|
|
|
|
2024-01-30 19:20:15 +01:00
|
|
|
- Fixed missing warnings when doing bool-like conversions in C23 (`#79435 <https://github.com/llvm/llvm-project/issues/79435>`_).
|
2024-02-12 12:44:20 +03:00
|
|
|
- Clang's ``-Wshadow`` no longer warns when an init-capture is named the same as
|
|
|
|
a class field unless the lambda can capture this.
|
|
|
|
Fixes (`#71976 <https://github.com/llvm/llvm-project/issues/71976>`_)
|
2024-01-30 19:20:15 +01:00
|
|
|
|
2024-02-02 12:53:34 -05:00
|
|
|
- Clang now accepts qualified partial/explicit specializations of variable templates that
|
|
|
|
are not nominable in the lookup context of the specialization.
|
|
|
|
|
2024-02-06 15:57:35 +03:00
|
|
|
- Clang now doesn't produce false-positive warning `-Wconstant-logical-operand`
|
|
|
|
for logical operators in C23.
|
|
|
|
Fixes (`#64356 <https://github.com/llvm/llvm-project/issues/64356>`_).
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Bug Fixes to Compiler Builtins
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-05-02 17:06:04 -04:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Bug Fixes to Attribute Support
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-08-26 19:26:32 +08:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Bug Fixes to C++ Support
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-01-18 08:49:45 -05:00
|
|
|
|
2024-02-09 20:59:02 +04:00
|
|
|
- Fix crash when calling the constructor of an invalid class.
|
|
|
|
Fixes (`#10518 <https://github.com/llvm/llvm-project/issues/10518>`_),
|
|
|
|
(`#67914 <https://github.com/llvm/llvm-project/issues/10518>`_),
|
|
|
|
and (`#78388 <https://github.com/llvm/llvm-project/issues/78388>`_)
|
2024-01-26 14:26:53 +08:00
|
|
|
- Fix crash when using lifetimebound attribute in function with trailing return.
|
|
|
|
Fixes (`#73619 <https://github.com/llvm/llvm-project/issues/73619>`_)
|
2024-01-31 12:17:41 +08:00
|
|
|
- Addressed an issue where constraints involving injected class types are perceived
|
|
|
|
distinct from its specialization types.
|
|
|
|
(`#56482 <https://github.com/llvm/llvm-project/issues/56482>`_)
|
2024-01-27 15:42:52 +08:00
|
|
|
- Fixed a bug where variables referenced by requires-clauses inside
|
|
|
|
nested generic lambdas were not properly injected into the constraint scope.
|
|
|
|
(`#73418 <https://github.com/llvm/llvm-project/issues/73418>`_)
|
2024-01-30 19:34:52 +08:00
|
|
|
- Fixed a crash where substituting into a requires-expression that refers to function
|
|
|
|
parameters during the equivalence determination of two constraint expressions.
|
|
|
|
(`#74447 <https://github.com/llvm/llvm-project/issues/74447>`_)
|
2024-01-29 06:42:52 +08:00
|
|
|
- Fixed deducing auto& from const int in template parameters of partial
|
|
|
|
specializations.
|
|
|
|
(`#77189 <https://github.com/llvm/llvm-project/issues/77189>`_)
|
2024-01-29 10:08:09 -08:00
|
|
|
- Fix for crash when using a erroneous type in a return statement.
|
|
|
|
Fixes (`#63244 <https://github.com/llvm/llvm-project/issues/63244>`_)
|
|
|
|
and (`#79745 <https://github.com/llvm/llvm-project/issues/79745>`_)
|
[clang][Sema] Populate function template depth at AddTemplateOverloadCandidate (#80395)
This is yet another one-line patch to fix crashes on constraint
substitution.
```cpp
template <class, class> struct formatter;
template <class, class> struct basic_format_context {};
template <typename CharType>
concept has_format_function = format(basic_format_context<CharType, CharType>());
template <typename ValueType, typename CharType>
requires has_format_function<CharType>
struct formatter<ValueType, CharType> {
template <typename OutputIt>
CharType format(basic_format_context<OutputIt, CharType>);
};
```
In this case, we would build up a `RecoveryExpr` for a call within a
constraint expression due to the absence of viable functions. The
heuristic algorithm attempted to find such a function inside of a
ClassTemplatePartialSpecialization, from which we started to substitute
its requires-expression, and it succeeded with a FunctionTemplate such
that
1) It has only one parameter, which is dependent.
2) The only one parameter depends on two template parameters. They are,
in canonical form, `<template-parameter-1-0>` and
`<template-parameter-0-1>` respectively.
Before we emit an error, we still want to recover the most viable
functions. This goes downhill to deducing template parameters against
its arguments, where we would collect the argument type with the same
depth as the parameter type into a Deduced set. The size of the set is
presumed to be that of function template parameters, which is 1 in this
case. However, since we haven't yet properly set the template depth
before the dance, we'll end up putting the type for
`<template-parameter-0-1>` to the second position of Deduced set, which
is unfortunately an access violation!
The bug seems to appear since clang 12.0.
This fixes [the
case](https://github.com/llvm/llvm-project/issues/58548#issuecomment-1287935336).
2024-02-03 16:14:48 +08:00
|
|
|
- Fixed an out-of-bounds error caused by building a recovery expression for ill-formed
|
|
|
|
function calls while substituting into constraints.
|
|
|
|
(`#58548 <https://github.com/llvm/llvm-project/issues/58548>`_)
|
[clang] static operators should evaluate object argument (reland) (#80108)
This re-applies 30155fc0 with a fix for clangd.
### Description
clang don't evaluate the object argument of `static operator()` and
`static operator[]` currently, for example:
```cpp
#include <iostream>
struct Foo {
static int operator()(int x, int y) {
std::cout << "Foo::operator()" << std::endl;
return x + y;
}
static int operator[](int x, int y) {
std::cout << "Foo::operator[]" << std::endl;
return x + y;
}
};
Foo getFoo() {
std::cout << "getFoo()" << std::endl;
return {};
}
int main() {
std::cout << getFoo()(1, 2) << std::endl;
std::cout << getFoo()[1, 2] << std::endl;
}
```
`getFoo()` is expected to be called, but clang don't call it currently
(17.0.6). This PR fixes this issue.
Fixes #67976, reland #68485.
### Walkthrough
- **clang/lib/Sema/SemaOverload.cpp**
- **`Sema::CreateOverloadedArraySubscriptExpr` &
`Sema::BuildCallToObjectOfClassType`**
Previously clang generate `CallExpr` for static operators, ignoring the
object argument. In this PR `CXXOperatorCallExpr` is generated for
static operators instead, with the object argument as the first
argument.
- **`TryObjectArgumentInitialization`**
`const` / `volatile` objects are allowed for static methods, so that we
can call static operators on them.
- **clang/lib/CodeGen/CGExpr.cpp**
- **`CodeGenFunction::EmitCall`**
CodeGen changes for `CXXOperatorCallExpr` with static operators: emit
and ignore the object argument first, then emit the operator call.
- **clang/lib/AST/ExprConstant.cpp**
- **`ExprEvaluatorBase::handleCallExpr`**
Evaluation of static operators in constexpr also need some small changes
to work, so that the arguments won't be out of position.
- **clang/lib/Sema/SemaChecking.cpp**
- **`Sema::CheckFunctionCall`**
Code for argument checking also need to be modify, or it will fail the
test `clang/test/SemaCXX/overloaded-operator-decl.cpp`.
- **clang-tools-extra/clangd/InlayHints.cpp**
- **`InlayHintVisitor::VisitCallExpr`**
Now that the `CXXOperatorCallExpr` for static operators also have object
argument, we should also take care of this situation in clangd.
### Tests
- **Added:**
- **clang/test/AST/ast-dump-static-operators.cpp**
Verify the AST generated for static operators.
- **clang/test/SemaCXX/cxx2b-static-operator.cpp**
Static operators should be able to be called on const / volatile
objects.
- **Modified:**
- **clang/test/CodeGenCXX/cxx2b-static-call-operator.cpp**
- **clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp**
Matching the new CodeGen.
### Documentation
- **clang/docs/ReleaseNotes.rst**
Update release notes.
---------
Co-authored-by: Shafik Yaghmour <shafik@users.noreply.github.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-01-31 15:27:06 +08:00
|
|
|
- Fix incorrect code generation caused by the object argument of ``static operator()`` and ``static operator[]`` calls not being evaluated.
|
|
|
|
Fixes (`#67976 <https://github.com/llvm/llvm-project/issues/67976>`_)
|
2024-02-02 20:26:54 -08:00
|
|
|
- Fix crash and diagnostic with const qualified member operator new.
|
|
|
|
Fixes (`#79748 <https://github.com/llvm/llvm-project/issues/79748>`_)
|
2024-02-06 09:59:16 +08:00
|
|
|
- Fixed a crash where substituting into a requires-expression that involves parameter packs
|
|
|
|
during the equivalence determination of two constraint expressions.
|
|
|
|
(`#72557 <https://github.com/llvm/llvm-project/issues/72557>`_)
|
2024-02-03 21:49:09 +08:00
|
|
|
- Fix a crash when specializing an out-of-line member function with a default
|
|
|
|
parameter where we did an incorrect specialization of the initialization of
|
|
|
|
the default parameter.
|
|
|
|
Fixes (`#68490 <https://github.com/llvm/llvm-project/issues/68490>`_)
|
2024-02-07 15:12:15 +01:00
|
|
|
- Fix a crash when trying to call a varargs function that also has an explicit object parameter.
|
|
|
|
Fixes (`#80971 ICE when explicit object parameter be a function parameter pack`)
|
2024-02-08 13:04:10 -05:00
|
|
|
- Fixed a bug where abbreviated function templates would append their invented template parameters to
|
|
|
|
an empty template parameter lists.
|
2024-02-08 14:27:14 -08:00
|
|
|
- Clang now classifies aggregate initialization in C++17 and newer as constant
|
|
|
|
or non-constant more accurately. Previously, only a subset of the initializer
|
|
|
|
elements were considered, misclassifying some initializers as constant. Fixes
|
|
|
|
some of (`#80510 <https://github.com/llvm/llvm-project/issues/80510>`).
|
2024-02-13 13:34:27 +08:00
|
|
|
- Clang now ignores top-level cv-qualifiers on function parameters in template partial orderings.
|
|
|
|
(`#75404 <https://github.com/llvm/llvm-project/issues/75404>`_)
|
2024-01-26 14:26:53 +08:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Bug Fixes to AST Handling
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-01-17 11:29:04 -08:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Miscellaneous Bug Fixes
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Miscellaneous Clang Crashes Fixed
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-05-03 14:13:56 -04:00
|
|
|
|
2023-11-17 06:29:02 -08:00
|
|
|
OpenACC Specific Changes
|
|
|
|
------------------------
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Target Specific Changes
|
|
|
|
-----------------------
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2023-03-13 09:33:08 -05:00
|
|
|
AMDGPU Support
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
X86 Support
|
|
|
|
^^^^^^^^^^^
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Arm and AArch64 Support
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2024-02-13 15:12:35 +00:00
|
|
|
- Fixed the incorrect definition of the __ARM_ARCH macro for architectures greater than or equal to v8.1.
|
|
|
|
|
2023-08-31 18:04:56 -07:00
|
|
|
Android Support
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
Windows Support
|
|
|
|
^^^^^^^^^^^^^^^
|
[clang] [MinGW] Add the option -fno-auto-import
In GCC, the .refptr stubs are only generated for x86_64, and only
for code models medium and larger (and medium is the default for
x86_64 since this was introduced). They can be omitted for
projects that are conscious about performance and size, and don't
need automatically importing dll data members, by passing -mcmodel=small.
In Clang/LLVM, such .refptr stubs are generated for any potentially
symbol reference that might end up autoimported. The .refptr stubs
are emitted for three separate reasons:
- Without .refptr stubs, undefined symbols are mostly referenced
with 32 bit wide relocations. If the symbol ends up autoimported
from a different DLL, a 32 bit relative offset might not be
enough to reference data in a different DLL, depending on runtime
loader layout.
- Without .refptr stubs, the runtime pseudo relocation mechanism
will need to temporarily make sections read-write-executable
if there are such relocations in the text section
- On ARM and AArch64, the immediate addressing encoded into
instructions isn't in the form of a plain 32 bit relative offset,
but is expressed with various bits scattered throughout two
instructions - the mingw runtime pseudo relocation mechanism
doesn't support updating offsets in that form.
If autoimporting is known not to be needed, the user can now
compile with -fno-auto-import, avoiding the extra overhead of
the .refptr stubs.
However, omitting them is potentially fragile as the code
might still rely on automatically importing some symbol without
the developer knowing. If this happens, linking still usually
will succeed, but users may encounter issues at runtime.
Therefore, if the new option -fno-auto-import is passed to the compiler
when driving linking, it passes the flag --disable-auto-import to
the linker, making sure that no symbols actually are autoimported
when the generated code doesn't expect it.
Differential Revision: https://reviews.llvm.org/D61670
2019-05-08 11:45:26 +03:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
LoongArch Support
|
|
|
|
^^^^^^^^^^^^^^^^^
|
2024-01-23 15:27:06 +08:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
RISC-V Support
|
|
|
|
^^^^^^^^^^^^^^
|
2023-12-15 11:16:05 +08:00
|
|
|
|
2024-01-25 19:19:28 -08:00
|
|
|
- ``__attribute__((rvv_vector_bits(N)))`` is now supported for RVV vbool*_t types.
|
2024-01-25 09:39:29 -08:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
CUDA/HIP Language Changes
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
2022-10-18 10:50:37 -07:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
CUDA Support
|
|
|
|
^^^^^^^^^^^^
|
2022-01-23 20:45:25 -08:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
AIX Support
|
|
|
|
^^^^^^^^^^^
|
[Clang][AArch64] Support AArch64 target(..) attribute formats.
This adds support under AArch64 for the target("..") attributes. The
current parsing is very X86-shaped, this patch attempts to bring it line
with the GCC implementation from
https://gcc.gnu.org/onlinedocs/gcc/AArch64-Function-Attributes.html#AArch64-Function-Attributes.
The supported formats are:
- "arch=<arch>" strings, that specify the architecture features for a
function as per the -march=arch+feature option.
- "cpu=<cpu>" strings, that specify the target-cpu and any implied
atributes as per the -mcpu=cpu+feature option.
- "tune=<cpu>" strings, that specify the tune-cpu cpu for a function as
per -mtune.
- "+<feature>", "+no<feature>" enables/disables the specific feature, for
compatibility with GCC target attributes.
- "<feature>", "no-<feature>" enabled/disables the specific feature, for
backward compatibility with previous releases.
To do this, the parsing of target attributes has been moved into
TargetInfo to give the target the opportunity to override the existing
parsing. The only non-aarch64 change should be a minor alteration to the
error message, specifying using "CPU" to describe the cpu, not
"architecture", and the DuplicateArch/Tune from ParsedTargetAttr have
been combined into a single option.
Differential Revision: https://reviews.llvm.org/D133848
2022-10-01 15:40:59 +01:00
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
WebAssembly Support
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
[ARM] Allow selecting hard-float ABI in integer-only MVE.
Armv8.1-M can be configured to support the integer subset of the MVE
vector instructions, and no floating point. In that situation, the FP
and vector registers still exist, and so do the load, store and move
instructions that transfer data in and out of them. So there's no
reason the hard floating point ABI can't be supported, and you might
reasonably want to use it, for the sake of intrinsics-based code
passing explicit MVE vector types between functions.
But the selection of the hard float ABI in the backend was gated on
Subtarget->hasVFP2Base(), which is false in the case of integer MVE
and no FP.
As a result, you'd silently get the soft float ABI even if you
deliberately tried to select it, e.g. with clang options such as
--target=arm-none-eabi -mfloat-abi=hard -march=armv8.1m.main+nofp+mve
The hard float ABI should have been gated on the weaker condition
Subtarget->hasFPRegs(), because the only requirement for being able to
pass arguments in the FP registers is that the registers themselves
should exist.
I haven't added a new test, because changing the existing
CodeGen/Thumb2/float-ops.ll test seemed sufficient. But I've added a
comment explaining why the results are expected to be what they are.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D142703
2023-01-31 17:31:33 +00:00
|
|
|
|
2022-02-06 08:20:54 -05:00
|
|
|
AVR Support
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
2023-02-15 23:53:38 +02:00
|
|
|
DWARF Support in Clang
|
|
|
|
----------------------
|
2023-02-13 18:29:16 +00:00
|
|
|
|
2021-11-09 09:35:25 -05:00
|
|
|
Floating Point Support in Clang
|
|
|
|
-------------------------------
|
|
|
|
|
2024-02-14 14:11:56 -08:00
|
|
|
Fixed Point Support in Clang
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
- Support fixed point precision macros according to ``7.18a.3`` of
|
|
|
|
`ISO/IEC TR 18037:2008 <https://standards.iso.org/ittf/PubliclyAvailableStandards/c051126_ISO_IEC_TR_18037_2008.zip>`_.
|
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
AST Matchers
|
|
|
|
------------
|
|
|
|
|
2024-02-15 14:55:25 +01:00
|
|
|
- ``isInStdNamespace`` now supports Decl declared with ``extern "C++"``.
|
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
clang-format
|
|
|
|
------------
|
|
|
|
|
2024-02-09 19:53:04 -08:00
|
|
|
- ``AlwaysBreakTemplateDeclarations`` is deprecated and renamed to
|
|
|
|
``BreakTemplateDeclarations``.
|
2024-02-13 14:58:33 +10:30
|
|
|
- ``AlwaysBreakAfterReturnType`` is deprecated and renamed to
|
|
|
|
``BreakAfterReturnType``.
|
2024-02-09 19:53:04 -08:00
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
libclang
|
|
|
|
--------
|
2022-08-25 08:35:46 +02:00
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
Static Analyzer
|
|
|
|
---------------
|
2023-07-24 08:26:54 +02:00
|
|
|
|
2023-12-28 15:48:59 +01:00
|
|
|
New features
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Crash and bug fixes
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Improvements
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
2024-01-24 15:45:05 +08:00
|
|
|
- Support importing C++20 modules in clang-repl.
|
|
|
|
|
2024-01-31 10:43:39 -05:00
|
|
|
- Added support for ``TypeLoc::dump()`` for easier debugging, and improved
|
|
|
|
textual and JSON dumping for various ``TypeLoc``-related nodes.
|
|
|
|
|
2023-12-28 15:48:59 +01:00
|
|
|
Moved checkers
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2022-09-26 17:41:37 -07:00
|
|
|
.. _release-notes-sanitizers:
|
|
|
|
|
|
|
|
Sanitizers
|
|
|
|
----------
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2023-04-04 09:21:04 -04:00
|
|
|
Python Binding Changes
|
|
|
|
----------------------
|
2020-02-13 22:46:33 +01:00
|
|
|
|
2024-01-29 11:19:34 -05:00
|
|
|
- Exposed `CXRewriter` API as `class Rewriter`.
|
|
|
|
|
2020-02-13 22:46:33 +01:00
|
|
|
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
|
2020-03-22 22:18:40 +01:00
|
|
|
API documentation which are up-to-date with the Git version of
|
2020-02-13 22:46:33 +01:00
|
|
|
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
|
2023-02-15 23:53:38 +02:00
|
|
|
contact us on the `Discourse forums (Clang Frontend category)
|
2022-07-01 14:07:48 -07:00
|
|
|
<https://discourse.llvm.org/c/clang/6>`_.
|