summaryrefslogtreecommitdiff
path: root/docs/ReleaseNotes.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ReleaseNotes.rst')
-rw-r--r--docs/ReleaseNotes.rst428
1 files changed, 199 insertions, 229 deletions
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index 6e8b005e7cb12..8dce92341c3ba 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -1,6 +1,6 @@
-=========================
-Clang 5.0.0 Release Notes
-=========================
+=======================================
+Clang 6.0.0 (In-Progress) Release Notes
+=======================================
.. contents::
:local:
@@ -8,11 +8,17 @@ Clang 5.0.0 Release Notes
Written by the `LLVM Team <http://llvm.org/>`_
+.. warning::
+
+ These are in-progress notes for the upcoming Clang 6 release.
+ Release notes for previous releases can be found on
+ `the Download Page <http://releases.llvm.org/download.html>`_.
+
Introduction
============
This document contains the release notes for the Clang C/C++/Objective-C
-frontend, part of the LLVM Compiler Infrastructure, release 5.0.0. Here we
+frontend, part of the LLVM Compiler Infrastructure, release 6.0.0. 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
@@ -24,7 +30,12 @@ For more information about Clang or LLVM, including information about the
latest release, please see the `Clang Web Site <http://clang.llvm.org>`_ or the
`LLVM Web Site <http://llvm.org>`_.
-What's New in Clang 5.0.0?
+Note that if you are reading this file from a Subversion checkout or the
+main Clang web page, this document applies to the *next* release, not
+the current one. To see the release notes for a specific release, please
+see the `releases page <http://llvm.org/releases/>`_.
+
+What's New in Clang 6.0.0?
==========================
Some of the major new features and improvements to Clang are listed
@@ -35,48 +46,91 @@ sections with improvements to Clang's support for those languages.
Major New Features
------------------
-C++ coroutines
-^^^^^^^^^^^^^^
-`C++ coroutines TS
-<http://open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4680.pdf>`_
-implementation has landed. Use ``-fcoroutines-ts -stdlib=libc++`` to enable
-coroutine support. Here is `an example
-<https://wandbox.org/permlink/Dth1IO5q8Oe31ew2>`_ to get you started.
-
+- ...
Improvements to Clang's diagnostics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-- ``-Wcast-qual`` was implemented for C++. C-style casts are now properly
- diagnosed.
+- ``-Wpragma-pack`` is a new warning that warns in the following cases:
+
+ - When a translation unit is missing terminating ``#pragma pack (pop)``
+ directives.
+
+ - When leaving an included file that changes the current alignment value,
+ i.e. when the alignment before ``#include`` is different to the alignment
+ after ``#include``.
+
+ - ``-Wpragma-pack-suspicious-include`` (disabled by default) warns on an
+ ``#include`` when the included file contains structures or unions affected by
+ a non-default alignment that has been specified using a ``#pragma pack``
+ directive prior to the ``#include``.
+
+- ``-Wobjc-messaging-id`` is a new, non-default warning that warns about
+ message sends to unqualified ``id`` in Objective-C. This warning is useful
+ for projects that would like to avoid any potential future compiler
+ errors/warnings, as the system frameworks might add a method with the same
+ selector which could make the message send to ``id`` ambiguous.
+
+- ``-Wtautological-compare`` now warns when comparing an unsigned integer and 0
+ regardless of whether the constant is signed or unsigned."
+
+- ``-Wtautological-compare`` now warns about comparing a signed integer and 0
+ when the signed integer is coerced to an unsigned type for the comparison.
+ ``-Wsign-compare`` was adjusted not to warn in this case.
+
+- ``-Wtautological-constant-compare`` is a new warning that warns on
+ tautological comparisons between integer variable of the type ``T`` and the
+ largest/smallest possible integer constant of that same type.
+
+- For C code, ``-Wsign-compare``, ``-Wsign-conversion``,
+ ``-Wtautological-constant-compare`` and
+ ``-Wtautological-constant-out-of-range-compare`` were adjusted to use the
+ underlying datatype of ``enum``.
-- ``-Wunused-lambda-capture`` warns when a variable explicitly captured
- by a lambda is not used in the body of the lambda.
+- ``-Wnull-pointer-arithmetic`` now warns about performing pointer arithmetic
+ on a null pointer. Such pointer arithmetic has an undefined behavior if the
+ offset is nonzero. It also now warns about arithmetic on a null pointer
+ treated as a cast from integer to pointer (GNU extension).
-- ``-Wstrict-prototypes`` is a new warning that warns about non-prototype
- function and block declarations and types in C and Objective-C.
+- ``-Wzero-as-null-pointer-constant`` was adjusted not to warn on null pointer
+ constants that originate from system macros, except ``NULL`` macro.
-- ``-Wunguarded-availability`` is a new warning that warns about uses of new
- APIs that were introduced in a system whose version is newer than the
- deployment target version. A new Objective-C expression ``@available`` has
- been introduced to perform system version checking at runtime. This warning
- is off by default to prevent unexpected warnings in existing projects.
- However, its less strict sibling ``-Wunguarded-availability-new`` is on by
- default. It warns about unguarded uses of APIs only when they were introduced
- in or after macOS 10.13, iOS 11, tvOS 11 or watchOS 4.
+Non-comprehensive list of changes in this release
+-------------------------------------------------
-- The ``-Wdocumentation`` warning now allows the use of ``\param`` and
- ``\returns`` documentation directives in the documentation comments for
- declarations with a function or a block pointer type.
+- Bitrig OS was merged back into OpenBSD, so Bitrig support has been
+ removed from Clang/LLVM.
-- The compiler no longer warns about unreachable ``__builtin_unreachable``
- statements.
+- The default value of _MSC_VER was raised from 1800 to 1911, making it
+ compatible with the Visual Studio 2015 and 2017 C++ standard library headers.
+ Users should generally expect this to be regularly raised to match the most
+ recently released version of the Visual C++ compiler.
+
+- clang now defaults to ``.init_array`` if no gcc installation can be found.
+ If a gcc installation is found, it still prefers ``.ctors`` if the found
+ gcc is older than 4.7.0.
+
+- The new builtin preprocessor macros ``__is_target_arch``,
+ ``__is_target_vendor``, ``__is_target_os``, and ``__is_target_environment``
+ can be used to to examine the individual components of the target triple.
New Compiler Flags
------------------
-- ``--autocomplete`` was implemented to obtain a list of flags and its arguments.
- This is used for shell autocompletion.
+- --autocomplete was implemented to obtain a list of flags and its arguments. This is used for shell autocompletion.
+
+- The ``-fdouble-square-bracket-attributes`` and corresponding
+ ``-fno-double-square-bracket-attributes`` flags were added to enable or
+ disable [[]] attributes in any language mode. Currently, only a limited
+ number of attributes are supported outside of C++ mode. See the Clang
+ attribute documentation for more information about which attributes are
+ supported for each syntax.
+
+- Added the ``-std=c17``, ``-std=gnu17``, and ``-std=iso9899:2017`` language
+ mode flags for compatibility with GCC. This enables support for the next
+ version of the C standard, expected to be published by ISO in 2018. The only
+ difference between the ``-std=c17`` and ``-std=c11`` language modes is the
+ value of the ``__STDC_VERSION__`` macro, as C17 is a bug fix release.
Deprecated Compiler Flags
-------------------------
@@ -84,278 +138,194 @@ Deprecated Compiler Flags
The following options are deprecated and ignored. They will be removed in
future versions of Clang.
-- ``-fslp-vectorize-aggressive`` used to enable the BB vectorizing pass. They have been superseeded
- by the normal SLP vectorizer.
-- ``-fno-slp-vectorize-aggressive`` used to be the default behavior of clang.
+- ...
New Pragmas in Clang
-----------------------
-- Clang now supports the ``clang attribute`` pragma that allows users to apply
- an attribute to multiple declarations.
+Clang now supports the ...
-- ``pragma pack`` directives that are included in a precompiled header are now
- applied correctly to the declarations in the compilation unit that includes
- that precompiled header.
Attribute Changes in Clang
--------------------------
-- The ``overloadable`` attribute now allows at most one function with a given
- name to lack the ``overloadable`` attribute. This unmarked function will not
- have its name mangled.
-- The ``ms_abi`` attribute and the ``__builtin_ms_va_list`` types and builtins
- are now supported on AArch64.
-
-C Language Changes in Clang
----------------------------
+- Clang now supports the majority of its attributes under both the GNU-style
+ spelling (``__attribute((name))``) and the double square-bracket spelling
+ in the ``clang`` vendor namespace (``[[clang::name]]``). Attributes whose
+ syntax is specified by some other standard (such as CUDA and OpenCL
+ attributes) continue to follow their respective specification.
+
+- Added the ``__has_c_attribute()`` builtin preprocessor macro which allows
+ users to dynamically detect whether a double square-bracket attribute is
+ supported in C mode. This attribute syntax can be enabled with the
+ ``-fdouble-square-bracket-attributes`` flag.
+
+- The presence of __attribute__((availability(...))) on a declaration no longer
+ implies default visibility for that declaration on macOS.
-- Added near complete support for implicit scalar to vector conversion, a GNU
- C/C++ language extension. With this extension, the following code is
- considered valid:
+- ...
-.. code-block:: c
-
- typedef unsigned v4i32 __attribute__((vector_size(16)));
+Windows Support
+---------------
- v4i32 foo(v4i32 a) {
- // Here 5 is implicitly casted to an unsigned value and replicated into a
- // vector with as many elements as 'a'.
- return a + 5;
- }
+Clang's support for building native Windows programs ...
-The implicit conversion of a scalar value to a vector value--in the context of
-a vector expression--occurs when:
-- The type of the vector is that of a ``__attribute__((vector_size(size)))``
- vector, not an OpenCL ``__attribute__((ext_vector_type(size)))`` vector type.
+C Language Changes in Clang
+---------------------------
-- The scalar value can be casted to that of the vector element's type without
- the loss of precision based on the type of the scalar and the type of the
- vector's elements.
+- ...
-- For compile time constant values, the above rule is weakened to consider the
- value of the scalar constant rather than the constant's type. However,
- for compatibility with GCC, floating point constants with precise integral
- representations are not implicitly converted to integer values.
+...
-Currently the basic integer and floating point types with the following
-operators are supported: ``+``, ``/``, ``-``, ``*``, ``%``, ``>``, ``<``,
-``>=``, ``<=``, ``==``, ``!=``, ``&``, ``|``, ``^`` and the corresponding
-assignment operators where applicable.
+C11 Feature Support
+^^^^^^^^^^^^^^^^^^^
+...
C++ Language Changes in Clang
-----------------------------
-- We expect this to be the last Clang release that defaults to ``-std=gnu++98``
- when using the GCC-compatible ``clang++`` driver. From Clang 6 onwards we
- expect to use ``-std=gnu++14`` or a later standard by default, to match the
- behavior of recent GCC releases. Users are encouraged to change their build
- files to explicitly specify their desired C++ standard.
-
-- Support for the C++17 standard has been completed. This mode can be enabled
- using ``-std=c++17`` (the old flag ``-std=c++1z`` is still supported for
- compatibility).
+- Clang's default C++ dialect is now ``gnu++14`` instead of ``gnu++98``. This
+ means Clang will by default accept code using features from C++14 and
+ conforming GNU extensions. Projects incompatible with C++14 can add
+ ``-std=gnu++98`` to their build settings to restore the previous behaviour.
-- When targeting a platform that uses the Itanium C++ ABI, Clang implements a
- `recent change to the ABI`__ that passes objects of class type indirectly if they
- have a non-trivial move constructor. Previous versions of Clang only
- considered the copy constructor, resulting in an ABI change in rare cases,
- but GCC has already implemented this change for several releases.
- This affects all targets other than Windows and PS4. You can opt out of this
- ABI change with ``-fclang-abi-compat=4.0``.
+C++1z Feature Support
+^^^^^^^^^^^^^^^^^^^^^
-- As mentioned in `C Language Changes in Clang`_, Clang's support for
- implicit scalar to vector conversions also applies to C++. Additionally
- the following operators are also supported: ``&&`` and ``||``.
-
-.. __: https://github.com/itanium-cxx-abi/cxx-abi/commit/7099637aba11fed6bdad7ee65bf4fd3f97fbf076
+...
Objective-C Language Changes in Clang
-------------------------------------
-- Clang now guarantees that a ``readwrite`` property is synthesized when an
- ambiguous property (i.e. a property that's declared in multiple protocols)
- is synthesized. The ``-Wprotocol-property-synthesis-ambiguity`` warning that
- warns about incompatible property types is now promoted to an error when
- there's an ambiguity between ``readwrite`` and ``readonly`` properties.
-
-- Clang now prohibits synthesis of ambiguous properties with incompatible
- explicit property attributes. The following property attributes are
- checked for differences: ``copy``, ``retain``/``strong``, ``atomic``,
- ``getter`` and ``setter``.
+...
OpenCL C Language Changes in Clang
----------------------------------
-Various bug fixes and improvements:
-
-- Extended OpenCL-related Clang tests.
+...
-- Improved diagnostics across several areas: scoped address space
- qualified variables, function pointers, atomics, type rank for overloading,
- block captures, ``reserve_id_t``.
-
-- Several address space related fixes for constant address space function scope variables,
- IR generation, mangling of ``generic`` and alloca (post-fix from general Clang
- refactoring of address spaces).
+OpenMP Support in Clang
+----------------------------------
-- Several improvements in extensions: fixed OpenCL version for ``cl_khr_mipmap_image``,
- added missing ``cl_khr_3d_image_writes``.
+...
-- Improvements in ``enqueue_kernel``, especially the implementation of ``ndrange_t`` and blocks.
+Internal API Changes
+--------------------
-- OpenCL type related fixes: global samplers, the ``pipe_t`` size, internal type redefinition,
- and type compatibility checking in ternary and other operations.
+These are major API changes that have happened since the 4.0.0 release of
+Clang. If upgrading an external codebase that uses Clang as a library,
+this section should help get you past the largest hurdles of upgrading.
-- The OpenCL header has been extended with missing extension guards, and direct mapping of ``as_type``
- to ``__builtin_astype``.
+- ...
-- Fixed ``kernel_arg_type_qual`` and OpenCL/SPIR version in metadata.
+AST Matchers
+------------
-- Added proper use of the kernel calling convention to various targets.
+The hasDeclaration matcher now works the same for Type and QualType and only
+ever looks through one level of sugaring in a limited number of cases.
-The following new functionalities have been added:
+There are two main patterns affected by this:
-- Added documentation on OpenCL to Clang user manual.
+- qualType(hasDeclaration(recordDecl(...))): previously, we would look through
+ sugar like TypedefType to get at the underlying recordDecl; now, we need
+ to explicitly remove the sugaring:
+ qualType(hasUnqualifiedDesugaredType(hasDeclaration(recordDecl(...))))
-- Extended Clang builtins with required ``cl_khr_subgroups`` support.
+- hasType(recordDecl(...)): hasType internally uses hasDeclaration; previously,
+ this matcher used to match for example TypedefTypes of the RecordType, but
+ after the change they don't; to fix, use:
-- Add ``intel_reqd_sub_group_size`` attribute support.
+::
+ hasType(hasUnqualifiedDesugaredType(
+ recordType(hasDeclaration(recordDecl(...)))))
-- Added OpenCL types to ``CIndex``.
+- templateSpecializationType(hasDeclaration(classTemplateDecl(...))):
+ previously, we would directly match the underlying ClassTemplateDecl;
+ now, we can explicitly match the ClassTemplateSpecializationDecl, but that
+ requires to explicitly get the ClassTemplateDecl:
+::
+ templateSpecializationType(hasDeclaration(
+ classTemplateSpecializationDecl(
+ hasSpecializedTemplate(classTemplateDecl(...)))))
clang-format
------------
-* Option **BreakBeforeInheritanceComma** added to break before ``:`` and ``,`` in case of
- multiple inheritance in a class declaration. Enabled by default in the Mozilla coding style.
+* Option *IndentPPDirectives* added to indent preprocessor directives on
+ conditionals.
- +---------------------+----------------------------------------+
- | true | false |
- +=====================+========================================+
- | .. code-block:: c++ | .. code-block:: c++ |
- | | |
- | class MyClass | class MyClass : public X, public Y { |
- | : public X | }; |
- | , public Y { | |
- | }; | |
- +---------------------+----------------------------------------+
+ +----------------------+----------------------+
+ | Before | After |
+ +======================+======================+
+ | .. code-block:: c++ | .. code-block:: c++ |
+ | | |
+ | #if FOO | #if FOO |
+ | #if BAR | # if BAR |
+ | #include <foo> | # include <foo> |
+ | #endif | # endif |
+ | #endif | #endif |
+ +----------------------+----------------------+
-* Align block comment decorations.
+* Option -verbose added to the command line.
+ Shows the list of processed files.
- +----------------------+---------------------+
- | Before | After |
- +======================+=====================+
- | .. code-block:: c++ | .. code-block:: c++ |
- | | |
- | /* line 1 | /* line 1 |
- | * line 2 | * line 2 |
- | */ | */ |
- +----------------------+---------------------+
+* Option *IncludeBlocks* added to merge and regroup multiple ``#include`` blocks during sorting.
-* The :doc:`ClangFormatStyleOptions` documentation provides detailed examples for most options.
-
-* Namespace end comments are now added or updated automatically.
-
- +---------------------+---------------------+
- | Before | After |
- +=====================+=====================+
- | .. code-block:: c++ | .. code-block:: c++ |
- | | |
- | namespace A { | namespace A { |
- | int i; | int i; |
- | int j; | int j; |
- | } | } // namespace A |
- +---------------------+---------------------+
-
-* Comment reflow support added. Overly long comment lines will now be reflown with the rest of
- the paragraph instead of just broken. Option **ReflowComments** added and enabled by default.
+ +-------------------------+-------------------------+-------------------------+
+ | Before (Preserve) | Merge | Regroup |
+ +=========================+=========================+=========================+
+ | .. code-block:: c++ | .. code-block:: c++ | .. code-block:: c++ |
+ | | | |
+ | #include "b.h" | #include "a.h" | #include "a.h" |
+ | | #include "b.h" | #include "b.h" |
+ | #include "a.b" | #include <lib/main.h> | |
+ | #include <lib/main.h> | | #include <lib/main.h> |
+ +-------------------------+-------------------------+-------------------------+
libclang
--------
-- Libclang now provides code-completion results for more C++ constructs
- and keywords. The following keywords/identifiers are now included in the
- code-completion results: ``static_assert``, ``alignas``, ``constexpr``,
- ``final``, ``noexcept``, ``override`` and ``thread_local``.
-
-- Libclang now provides code-completion results for members from dependent
- classes. For example:
-
- .. code-block:: c++
-
- template<typename T>
- void appendValue(std::vector<T> &dest, const T &value) {
- dest. // Relevant completion results are now shown after '.'
- }
+...
- Note that code-completion results are still not provided when the member
- expression includes a dependent base expression. For example:
-
- .. code-block:: c++
-
- template<typename T>
- void appendValue(std::vector<std::vector<T>> &dest, const T &value) {
- dest.at(0). // Libclang fails to provide completion results after '.'
- }
Static Analyzer
---------------
-- The static analyzer now supports using the
- `z3 theorem prover <https://github.com/z3prover/z3>`_ from Microsoft Research
- as an external constraint solver. This allows reasoning over more complex
- queries, but performance is ~15x slower than the default range-based
- constraint solver. To enable the z3 solver backend, clang must be built with
- the ``CLANG_ANALYZER_BUILD_Z3=ON`` option, and the
- ``-Xanalyzer -analyzer-constraints=z3`` arguments passed at runtime.
+- Static Analyzer can now properly detect and diagnose unary pre-/post-
+ increment/decrement on an uninitialized value.
+
+...
Undefined Behavior Sanitizer (UBSan)
------------------------------------
-- The Undefined Behavior Sanitizer has a new check for pointer overflow. This
- check is on by default. The flag to control this functionality is
- ``-fsanitize=pointer-overflow``.
+* A minimal runtime is now available. It is suitable for use in production
+ environments, and has a small attack surface. It only provides very basic
+ issue logging and deduplication, and does not support ``-fsanitize=vptr``
+ checking.
- Pointer overflow is an indicator of undefined behavior: when a pointer
- indexing expression wraps around the address space, or produces other
- unexpected results, its result may not point to a valid object.
-
-- UBSan has several new checks which detect violations of nullability
- annotations. These checks are off by default. The flag to control this group
- of checks is ``-fsanitize=nullability``. The checks can be individially enabled
- by ``-fsanitize=nullability-arg`` (which checks calls),
- ``-fsanitize=nullability-assign`` (which checks assignments), and
- ``-fsanitize=nullability-return`` (which checks return statements).
+Core Analysis Improvements
+==========================
-- UBSan can now detect invalid loads from bitfields and from ObjC BOOLs.
+- ...
-- UBSan can now avoid emitting unnecessary type checks in C++ class methods and
- in several other cases where the result is known at compile-time. UBSan can
- also avoid emitting unnecessary overflow checks in arithmetic expressions
- with promoted integer operands.
+New Issues Found
+================
+- ...
Python Binding Changes
----------------------
-Python bindings now support both Python 2 and Python 3.
-
The following methods have been added:
-- ``is_scoped_enum`` has been added to ``Cursor``.
-
-- ``exception_specification_kind`` has been added to ``Cursor``.
-
-- ``get_address_space`` has been added to ``Type``.
-
-- ``get_typedef_name`` has been added to ``Type``.
-
-- ``get_exception_specification_kind`` has been added to ``Type``.
+- ...
+Significant Known Problems
+==========================
Additional Information
======================