1======================================== 2Clang 14.0.0 (In-Progress) Release Notes 3======================================== 4 5.. contents:: 6 :local: 7 :depth: 2 8 9Written by the `LLVM Team <https://llvm.org/>`_ 10 11.. warning:: 12 13 These are in-progress notes for the upcoming Clang 14 release. 14 Release notes for previous releases can be found on 15 `the Download Page <https://releases.llvm.org/download.html>`_. 16 17Introduction 18============ 19 20This document contains the release notes for the Clang C/C++/Objective-C 21frontend, part of the LLVM Compiler Infrastructure, release 14.0.0. Here we 22describe the status of Clang in some detail, including major 23improvements from the previous release and new feature work. For the 24general LLVM release notes, see `the LLVM 25documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM 26releases may be downloaded from the `LLVM releases web 27site <https://llvm.org/releases/>`_. 28 29For more information about Clang or LLVM, including information about the 30latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the 31`LLVM Web Site <https://llvm.org>`_. 32 33Note that if you are reading this file from a Git checkout or the 34main Clang web page, this document applies to the *next* release, not 35the current one. To see the release notes for a specific release, please 36see the `releases page <https://llvm.org/releases/>`_. 37 38What's New in Clang 14.0.0? 39=========================== 40 41Some of the major new features and improvements to Clang are listed 42here. Generic improvements to Clang as a whole or to its underlying 43infrastructure are described first, followed by language-specific 44sections with improvements to Clang's support for those languages. 45 46Major New Features 47------------------ 48 49- ... 50 51Improvements to Clang's diagnostics 52^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 53 54- -Wbitwise-instead-of-logical (part of -Wbool-operation) warns about use of bitwise operators with boolean operands which have side effects. 55 56- Added diagnostic groups to control diagnostics for attribute extensions by 57 adding groups ``-Wc++N-attribute-extensions`` (where ``N`` is the standard 58 release being diagnosed against). These new groups are automatically implied 59 when passing ``-Wc++N-extensions``. Resolves PR33518. 60 61Non-comprehensive list of changes in this release 62------------------------------------------------- 63 64- Maximum _ExtInt size was decreased from 16,777,215 bits to 8,388,608 bits. 65 Motivation for this was discussed in PR51829. 66 67New Compiler Flags 68------------------ 69 70- Clang plugin arguments can now be passed through the compiler driver via 71 ``-fplugin-arg-pluginname-arg``, similar to GCC's ``-fplugin-arg``. 72 73Deprecated Compiler Flags 74------------------------- 75 76- -Wweak-template-vtables has been deprecated and no longer has any effect. The 77 flag will be removed in the next release. 78 79Modified Compiler Flags 80----------------------- 81 82- Support has been added for the following processors (``-mcpu`` identifiers in parentheses): 83 84 - RISC-V SiFive E20 (``sifive-e20``). 85 - RISC-V SiFive E21 (``sifive-e21``). 86 - RISC-V SiFive E24 (``sifive-e24``). 87 - RISC-V SiFive E34 (``sifive-e34``). 88 - RISC-V SiFive S21 (``sifive-s21``). 89 - RISC-V SiFive S51 (``sifive-s51``). 90 - RISC-V SiFive S54 (``sifive-s54``). 91 - RISC-V SiFive S76 (``sifive-s76``). 92 93- Support has been added for the following architectures (``-march`` identifiers in parentheses): 94 95 - Armv9-A (``armv9-a``). 96 - Armv9.1-A (``armv9.1-a``). 97 - Armv9.2-A (``armv9.2-a``). 98 99Removed Compiler Flags 100------------------------- 101 102- ... 103 104New Pragmas in Clang 105-------------------- 106 107- ... 108 109Attribute Changes in Clang 110-------------------------- 111 112- Attributes loaded as clang plugins which are sensitive to LangOpts must 113 now override ``acceptsLangOpts`` instead of ``diagLangOpts``. 114 Returning false will produce a generic "attribute ignored" diagnostic, as 115 with clang's built-in attributes. 116 If plugins want to provide richer diagnostics, they can do so when the 117 attribute is handled instead, e.g. in ``handleDeclAttribute``. 118 (This was changed in order to better support attributes in code completion). 119 120- __has_cpp_attribute, __has_c_attribute, __has_attribute, and __has_declspec 121 will now macro expand their argument. This causes a change in behavior for 122 code using ``__has_cpp_attribute(__clang__::attr)`` (and same for 123 ``__has_c_attribute``) where it would previously expand to ``0`` for all 124 attributes, but will now issue an error due to the expansion of the 125 predefined ``__clang__`` macro. 126 127Windows Support 128--------------- 129 130- An MSVC compatibility workaround for C++ operator names was removed. As a 131 result, the ``<query.h>`` Windows SDK header may not compile out of the box. 132 Users should use a recent SDK and pass ``-DQUERY_H_RESTRICTION_PERMISSIVE`` 133 or pass ``/permissive`` to disable C++ operator names altogether. See 134 `PR42427 <https://llvm.org/pr42427>` for more info. 135 136C Language Changes in Clang 137--------------------------- 138 139- The value of ``__STDC_VERSION__`` has been bumped to ``202000L`` when passing 140 ``-std=c2x`` so that it can be distinguished from C17 mode. This value is 141 expected to change again when C23 is published. 142- Wide multi-characters literals such as ``L'ab'`` that would previously be interpreted as ``L'b'`` 143 are now ill-formed in all language modes. The motivation for this change is outlined in 144 `P2362 <wg21.link/P2362>`_. 145- Support for ``__attribute__((error("")))`` and 146 ``__attribute__((warning("")))`` function attributes have been added. 147- The maximum allowed alignment has been increased from 2^29 to 2^32. 148 149- Clang now supports the ``_BitInt(N)`` family of bit-precise integer types 150 from C23. This type was previously exposed as ``_ExtInt(N)``, which is now a 151 deprecated alias for ``_BitInt(N)`` (so diagnostics will mention ``_BitInt`` 152 even if source uses ``_ExtInt``). ``_BitInt(N)`` and ``_ExtInt(N)`` are the 153 same types in all respects beyond spelling and the deprecation warning. 154 ``_BitInt(N)`` is supported as an extension in older C modes and in all C++ 155 modes. Note: the ABI for ``_BitInt(N)`` is still in the process of being 156 stabilized, so this type should not yet be used in interfaces that require 157 ABI stability. 158 159C++ Language Changes in Clang 160----------------------------- 161 162- ... 163 164C++20 Feature Support 165^^^^^^^^^^^^^^^^^^^^^ 166... 167 168C++2b Feature Support 169^^^^^^^^^^^^^^^^^^^^^ 170- Implemented `P1938R3: if consteval <https://wg21.link/P1938R3>`_. 171- Implemented `P2360R0: Extend init-statement to allow alias-declaration <https://wg21.link/P2360R0>`_. 172 173 174CUDA Language Changes in Clang 175------------------------------ 176 177- Clang now supports CUDA versions up to 11.5. 178- Default GPU architecture has been changed from sm_20 to sm_35. 179 180Objective-C Language Changes in Clang 181------------------------------------- 182 183OpenCL C Language Changes in Clang 184---------------------------------- 185 186... 187 188ABI Changes in Clang 189-------------------- 190 191- The ``_ExtInt(N)`` extension has been standardized in C23 as ``_BitInt(N)``. 192 The mangling of this type in C++ has accordingly changed: under the Microsoft 193 ABI it is now mangled using the ``_BitInt`` spelling, and under the Itanium ABI 194 it is now mangled using a dedicated production. Note: the ABI for ``_BitInt(N)`` 195 is still in the process of being stabilized, so this type should not yet be 196 used in interfaces that require ABI stability. 197 198OpenMP Support in Clang 199----------------------- 200 201- ``clang-nvlink-wrapper`` tool introduced to support linking of cubin files archived in an archive. See :doc:`ClangNvlinkWrapper`. 202 203 204CUDA Support in Clang 205--------------------- 206 207- ... 208 209X86 Support in Clang 210-------------------- 211 212- Support for ``AVX512-FP16`` instructions has been added. 213 214Arm and AArch64 Support in Clang 215-------------------------------- 216 217- Support has been added for the following processors (command-line identifiers in parentheses): 218 - Arm Cortex-A510 (``cortex-a510``) 219 - Arm Cortex-X2 (``cortex-x2``) 220 - Arm Cortex-A710 (``cortex-A710``) 221 222- The -mtune flag is no longer ignored for AArch64. It is now possible to 223 tune code generation for a particular CPU with -mtune without setting any 224 architectural features. For example, compiling with 225 "-mcpu=generic -mtune=cortex-a57" will not enable any Cortex-A57 specific 226 architecture features, but will enable certain optimizations specific to 227 Cortex-A57 CPUs and enable the use of a more accurate scheduling model. 228 229 230Floating Point Support in Clang 231------------------------------- 232- The default setting of FP contraction (FMA) is now -ffp-contract=on (for 233 languages other than CUDA/HIP) even when optimization is off. Previously, 234 the default behavior was equivalent to -ffp-contract=off (-ffp-contract 235 was not set). 236 Related to this, the switch -ffp-model=precise now implies -ffp-contract=on 237 rather than -ffp-contract=fast, and the documentation of these features has 238 been clarified. Previously, the documentation claimed that -ffp-model=precise 239 was the default, but this was incorrect because the precise model implied 240 -ffp-contract=fast, whereas the (now corrected) default behavior is 241 -ffp-contract=on. 242 -ffp-model=precise is now exactly the default mode of the compiler. 243 244Internal API Changes 245-------------------- 246 247- ... 248 249Build System Changes 250-------------------- 251 252- Linux distros can specify ``-DCLANG_DEFAULT_PIE_ON_LINUX=On`` to use ``-fPIE`` and 253 ``-pie`` by default. This matches GCC installations on many Linux distros 254 (configured with ``--enable-default-pie``). 255 (`D113372 <https://reviews.llvm.org/D113372>`_) 256 257AST Matchers 258------------ 259 260- ``TypeLoc`` AST Matchers are now available. These matchers provide helpful 261 utilities for matching ``TypeLoc`` nodes, such as the ``pointerTypeLoc`` 262 matcher or the ``hasReturnTypeLoc`` matcher. The addition of these matchers 263 was made possible by changes to the handling of ``TypeLoc`` nodes that 264 allows them to enjoy the same static type checking as other AST node kinds. 265- ``LambdaCapture`` AST Matchers are now available. These matchers allow for 266 the binding of ``LambdaCapture`` nodes. The ``LambdaCapture`` matchers added 267 include the ``lambdaCapture`` node matcher, the ``capturesVar`` traversal 268 matcher, and ``capturesThis`` narrowing matcher. 269- The ``hasAnyCapture`` matcher now only accepts an inner matcher of type 270 ``Matcher<LambdaCapture>``. The matcher originally accepted an inner matcher 271 of type ``Matcher<CXXThisExpr>`` or ``Matcher<VarDecl>``. 272 273clang-format 274------------ 275 276- Option ``AllowShortEnumsOnASingleLine: false`` has been improved, it now 277 correctly places the opening brace according to ``BraceWrapping.AfterEnum``. 278 279- Option ``QualifierAlignment`` has been added in order to auto-arrange the 280 positioning of specifiers/qualifiers 281 `const` `volatile` `static` `inline` `constexpr` `restrict` 282 in variable and parameter declarations to be either ``Right`` aligned 283 or ``Left`` aligned or ``Custom`` using ``QualifierOrder``. 284 285- Option ``QualifierOrder`` has been added to allow the order 286 `const` `volatile` `static` `inline` `constexpr` `restrict` 287 to be controlled relative to the `type`. 288 289- Add a ``Custom`` style to ``SpaceBeforeParens``, to better configure the 290 space before parentheses. The custom options can be set using 291 ``SpaceBeforeParensOptions``. 292 293- Improved C++20 Modules and Coroutines support. 294 295libclang 296-------- 297 298- ... 299 300Static Analyzer 301--------------- 302 303- ... 304 305.. _release-notes-ubsan: 306 307Undefined Behavior Sanitizer (UBSan) 308------------------------------------ 309 310Core Analysis Improvements 311========================== 312 313- ... 314 315New Issues Found 316================ 317 318- ... 319 320Python Binding Changes 321---------------------- 322 323The following methods have been added: 324 325- ... 326 327Significant Known Problems 328========================== 329 330Additional Information 331====================== 332 333A wide variety of additional information is available on the `Clang web 334page <https://clang.llvm.org/>`_. The web page contains versions of the 335API documentation which are up-to-date with the Git version of 336the source code. You can access versions of these documents specific to 337this release by going into the "``clang/docs/``" directory in the Clang 338tree. 339 340If you have any questions or comments about Clang, please feel free to 341contact us via the `mailing 342list <https://lists.llvm.org/mailman/listinfo/cfe-dev>`_. 343