1======================================== 2Clang 11.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 11 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 11.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 11.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- -Wpointer-to-int-cast is a new warning group. This group warns about C-style 55 casts of pointers to a integer type too small to hold all possible values. 56 57Non-comprehensive list of changes in this release 58------------------------------------------------- 59 60- For the ARM target, C-language intrinsics are now provided for the full Arm 61 v8.1-M MVE instruction set. ``<arm_mve.h>`` supports the complete API defined 62 in the Arm C Language Extensions. 63 64- For the ARM target, C-language intrinsics ``<arm_cde.h>`` for the CDE 65 instruction set are now provided. 66 67- clang adds support for a set of extended integer types (``_ExtInt(N)``) that 68 permit non-power of 2 integers, exposing the LLVM integer types. Since a major 69 motivating use case for these types is to limit 'bit' usage, these types don't 70 automatically promote to 'int' when operations are done between two ``ExtInt(N)`` 71 types, instead math occurs at the size of the largest ``ExtInt(N)`` type. 72 73- Users of UBSan, PGO, and coverage on Windows will now need to add clang's 74 library resource directory to their library search path. These features all 75 use runtime libraries, and Clang provides these libraries in its resource 76 directory. For example, if LLVM is installed in ``C:\Program Files\LLVM``, 77 then the profile runtime library will appear at 78 ``C:\Program Files\LLVM\lib\clang\11.0.0\lib\windows\clang_rt.profile-x86_64.lib``. 79 To ensure that the linker can find the appropriate library, users should pass 80 ``/LIBPATH:C:\Program Files\LLVM\lib\clang\11.0.0\lib\windows`` to the 81 linker. If the user links the program with the ``clang`` or ``clang-cl`` 82 drivers, the driver will pass this flag for them. 83 84 85New Compiler Flags 86------------------ 87 88 89- -fstack-clash-protection will provide a protection against the stack clash 90 attack for x86 architecture through automatic probing of each page of 91 allocated stack. 92 93- -ffp-exception-behavior={ignore,maytrap,strict} allows the user to specify 94 the floating-point exception behavior. The default setting is ``ignore``. 95 96- -ffp-model={precise,strict,fast} provides the user an umbrella option to 97 simplify access to the many single purpose floating point options. The default 98 setting is ``precise``. 99 100Deprecated Compiler Flags 101------------------------- 102 103The following options are deprecated and ignored. They will be removed in 104future versions of Clang. 105 106- ... 107 108Modified Compiler Flags 109----------------------- 110 111- -fno-common has been enabled as the default for all targets. Therefore, C 112 code that uses tentative definitions as definitions of a variable in multiple 113 translation units will trigger multiple-definition linker errors. Generally, 114 this occurs when the use of the ``extern`` keyword is neglected in the declaration 115 of a variable in a header file. In some cases, no specific translation unit 116 provides a definition of the variable. The previous behavior can be restored by 117 specifying ``-fcommon``. 118- -Wasm-ignored-qualifier (ex. `asm const ("")`) has been removed and replaced 119 with an error (this matches a recent change in GCC-9). 120- -Wasm-file-asm-volatile (ex. `asm volatile ("")` at global scope) has been 121 removed and replaced with an error (this matches GCC's behavior). 122- Duplicate qualifiers on asm statements (ex. `asm volatile volatile ("")`) no 123 longer produces a warning via -Wduplicate-decl-specifier, but now an error 124 (this matches GCC's behavior). 125- The deprecated argument ``-f[no-]sanitize-recover`` has changed to mean 126 ``-f[no-]sanitize-recover=all`` instead of 127 ``-f[no-]sanitize-recover=undefined,integer`` and is no longer deprecated. 128- The argument to ``-f[no-]sanitize-trap=...`` is now optional and defaults to 129 ``all``. 130- ``-fno-char8_t`` now disables the ``char8_t`` keyword, not just the use of 131 ``char8_t`` as the character type of ``u8`` literals. This restores the 132 Clang 8 behavior that regressed in Clang 9 and 10. 133 134New Pragmas in Clang 135-------------------- 136 137- ... 138 139Attribute Changes in Clang 140-------------------------- 141 142- Attributes can now be specified by clang plugins. See the 143 `Clang Plugins <ClangPlugins.html#defining-attributes>`_ documentation for 144 details. 145 146Windows Support 147--------------- 148 149C Language Changes in Clang 150--------------------------- 151 152- The default C language standard used when `-std=` is not specified has been 153 upgraded from gnu11 to gnu17. 154 155- Clang now supports the GNU C extension `asm inline`; it won't do anything 156 *yet*, but it will be parsed. 157 158- ... 159 160C++ Language Changes in Clang 161----------------------------- 162 163- Clang now implements a restriction on giving non-C-compatible anonymous 164 structs a typedef name for linkage purposes, as described in C++ committee 165 paper `P1766R1 <http://wg21.link/p1766r1>`. This paper was adopted by the 166 C++ committee as a Defect Report resolution, so it is applied retroactively 167 to all C++ standard versions. This affects code such as: 168 169 .. code-block:: c++ 170 171 typedef struct { 172 int f() { return 0; } 173 } S; 174 175 Previous versions of Clang rejected some constructs of this form 176 (specifically, where the linkage of the type happened to be computed 177 before the parser reached the typedef name); those cases are still rejected 178 in Clang 11. In addition, cases that previous versions of Clang did not 179 reject now produce an extension warning. This warning can be disabled with 180 the warning flag ``-Wno-non-c-typedef-for-linkage``. 181 182 Affected code should be updated to provide a tag name for the anonymous 183 struct: 184 185 .. code-block:: c++ 186 187 struct S { 188 int f() { return 0; } 189 }; 190 191 If the code is shared with a C compilation (for example, if the parts that 192 are not C-compatible are guarded with ``#ifdef __cplusplus``), the typedef 193 declaration should be retained, but a tag name should still be provided: 194 195 .. code-block:: c++ 196 197 typedef struct S { 198 int f() { return 0; } 199 } S; 200 201C++1z Feature Support 202^^^^^^^^^^^^^^^^^^^^^ 203 204... 205 206Objective-C Language Changes in Clang 207------------------------------------- 208 209 210OpenCL C Language Changes in Clang 211---------------------------------- 212 213... 214 215ABI Changes in Clang 216-------------------- 217 218 219OpenMP Support in Clang 220----------------------- 221 222- ... 223 224CUDA Support in Clang 225--------------------- 226 227- ... 228 229Internal API Changes 230-------------------- 231 232These are major API changes that have happened since the 10.0.0 release of 233Clang. If upgrading an external codebase that uses Clang as a library, 234this section should help get you past the largest hurdles of upgrading. 235 236 237Build System Changes 238-------------------- 239 240These are major changes to the build system that have happened since the 10.0.0 241release of Clang. Users of the build system should adjust accordingly. 242 243- ... 244 245AST Matchers 246------------ 247 248- ... 249 250clang-format 251------------ 252 253 254- Option ``IndentCaseBlocks`` has been added to support treating the block 255 following a switch case label as a scope block which gets indented itself. 256 It helps avoid having the closing bracket align with the switch statement's 257 closing bracket (when ``IndentCaseLabels`` is ``false``). 258 259- Option ``ObjCBreakBeforeNestedBlockParam`` has been added to optionally apply 260 linebreaks for function arguments declarations before nested blocks. 261 262 .. code-block:: c++ 263 264 switch (fool) { vs. switch (fool) { 265 case 1: case 1: { 266 { bar(); 267 bar(); } break; 268 } default: { 269 break; plop(); 270 default: } 271 { } 272 plop(); 273 } 274 } 275 276- Option ``InsertTrailingCommas`` can be set to ``TCS_Wrapped`` to insert 277 trailing commas in container literals (arrays and objects) that wrap across 278 multiple lines. It is currently only available for JavaScript and disabled by 279 default (``TCS_None``). 280 281- Option ``BraceWrapping.BeforeLambdaBody`` has been added to manage lambda 282 line break inside function parameter call in Allman style. 283 284 .. code-block:: c++ 285 286 true: 287 connect( 288 []() 289 { 290 foo(); 291 bar(); 292 }); 293 294 false: 295 connect([]() { 296 foo(); 297 bar(); 298 }); 299 300libclang 301-------- 302 303- ... 304 305Static Analyzer 306--------------- 307 308- ... 309 310.. _release-notes-ubsan: 311 312Undefined Behavior Sanitizer (UBSan) 313------------------------------------ 314 315 316Core Analysis Improvements 317========================== 318 319- ... 320 321New Issues Found 322================ 323 324- ... 325 326Python Binding Changes 327---------------------- 328 329The following methods have been added: 330 331- ... 332 333Significant Known Problems 334========================== 335 336Additional Information 337====================== 338 339A wide variety of additional information is available on the `Clang web 340page <https://clang.llvm.org/>`_. The web page contains versions of the 341API documentation which are up-to-date with the Git version of 342the source code. You can access versions of these documents specific to 343this release by going into the "``clang/docs/``" directory in the Clang 344tree. 345 346If you have any questions or comments about Clang, please feel free to 347contact us via the `mailing 348list <https://lists.llvm.org/mailman/listinfo/cfe-dev>`_. 349