2019-07-18 19:51:05 +08:00
|
|
|
====================================================
|
2020-01-15 17:02:56 +08:00
|
|
|
Extra Clang Tools 11.0.0 (In-Progress) Release Notes
|
2019-07-18 19:51:05 +08:00
|
|
|
====================================================
|
2016-03-27 13:06:57 +08:00
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
2016-03-30 20:05:33 +08:00
|
|
|
:depth: 3
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2018-09-10 16:52:04 +08:00
|
|
|
Written by the `LLVM Team <https://llvm.org/>`_
|
2016-03-27 13:06:57 +08:00
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
2020-01-15 17:02:56 +08:00
|
|
|
These are in-progress notes for the upcoming Extra Clang Tools 11 release.
|
2017-02-10 07:25:52 +08:00
|
|
|
Release notes for previous releases can be found on
|
2018-09-10 16:52:04 +08:00
|
|
|
`the Download Page <https://releases.llvm.org/download.html>`_.
|
2016-03-27 13:06:57 +08:00
|
|
|
|
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
|
|
|
|
This document contains the release notes for the Extra Clang Tools, part of the
|
2020-01-15 17:02:56 +08:00
|
|
|
Clang release 11.0.0. Here we describe the status of the Extra Clang Tools in
|
2016-09-07 01:52:44 +08:00
|
|
|
some detail, including major improvements from the previous release and new
|
|
|
|
feature work. All LLVM releases may be downloaded from the `LLVM releases web
|
2018-09-10 16:52:04 +08:00
|
|
|
site <https://llvm.org/releases/>`_.
|
2016-03-27 13:06:57 +08:00
|
|
|
|
|
|
|
For more information about Clang or LLVM, including information about
|
2018-09-10 16:52:04 +08:00
|
|
|
the latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or
|
|
|
|
the `LLVM Web Site <https://llvm.org>`_.
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2020-01-15 17:02:56 +08:00
|
|
|
Note that if you are reading this file from a Git checkout or the
|
2016-03-27 13:06:57 +08:00
|
|
|
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
|
2018-09-10 16:52:04 +08:00
|
|
|
see the `releases page <https://llvm.org/releases/>`_.
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2020-01-15 17:02:56 +08:00
|
|
|
What's New in Extra Clang Tools 11.0.0?
|
2019-07-18 19:51:05 +08:00
|
|
|
=======================================
|
2016-03-27 13:06:57 +08:00
|
|
|
|
|
|
|
Some of the major new features and improvements to Extra Clang Tools are listed
|
|
|
|
here. Generic improvements to Extra Clang Tools as a whole or to its underlying
|
|
|
|
infrastructure are described first, followed by tool-specific sections.
|
|
|
|
|
|
|
|
Major New Features
|
|
|
|
------------------
|
|
|
|
|
2016-07-19 02:08:59 +08:00
|
|
|
...
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2018-10-12 05:40:32 +08:00
|
|
|
Improvements to clangd
|
|
|
|
----------------------
|
|
|
|
|
2019-08-27 14:58:05 +08:00
|
|
|
The improvements are...
|
2018-10-12 05:40:32 +08:00
|
|
|
|
|
|
|
Improvements to clang-doc
|
|
|
|
-------------------------
|
|
|
|
|
2020-01-15 17:02:56 +08:00
|
|
|
The improvements are...
|
2018-10-12 05:40:32 +08:00
|
|
|
|
2016-03-30 20:05:33 +08:00
|
|
|
Improvements to clang-query
|
|
|
|
---------------------------
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2019-07-18 15:12:47 +08:00
|
|
|
The improvements are...
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2016-03-30 20:05:33 +08:00
|
|
|
Improvements to clang-rename
|
|
|
|
----------------------------
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2017-01-13 05:58:40 +08:00
|
|
|
The improvements are...
|
2016-03-27 13:06:57 +08:00
|
|
|
|
2016-03-30 20:05:33 +08:00
|
|
|
Improvements to clang-tidy
|
|
|
|
--------------------------
|
2016-03-27 13:06:57 +08:00
|
|
|
|
[clang-tidy] Add module for llvm-libc and restrict-system-libc-header-check.
Summary: This adds a new module to enforce standards specific to the llvm-libc project. This change also adds the first check which restricts user from including system libc headers accidentally which can lead to subtle bugs that would be a challenge to detect.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: juliehockett, arphaman, jfb, abrachet, sivachandra, Eugene.Zelenko, njames93, mgorny, xazax.hun, MaskRay, cfe-commits
Tags: #clang-tools-extra, #libc-project, #clang
Differential Revision: https://reviews.llvm.org/D75332
2020-03-13 02:38:05 +08:00
|
|
|
New module
|
|
|
|
^^^^^^^^^^
|
|
|
|
- New module `llvmlibc`.
|
|
|
|
|
|
|
|
This module contains checks related to the LLVM-libc coding standards.
|
|
|
|
|
2020-01-10 16:19:58 +08:00
|
|
|
New checks
|
|
|
|
^^^^^^^^^^
|
2020-03-13 22:05:13 +08:00
|
|
|
- New :doc:`cppcoreguidelines-avoid-non-const-global-variables
|
|
|
|
<clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables>` check.
|
|
|
|
Finds non-const global variables as described in check I.2 of C++ Core
|
|
|
|
Guidelines.
|
2020-01-10 16:19:58 +08:00
|
|
|
|
2019-12-04 17:48:13 +08:00
|
|
|
- New :doc:`bugprone-misplaced-pointer-arithmetic-in-alloc
|
|
|
|
<clang-tidy/checks/bugprone-misplaced-pointer-arithmetic-in-alloc>` check.
|
|
|
|
|
|
|
|
Finds cases where an integer expression is added to or subtracted from the
|
|
|
|
result of a memory allocation function (``malloc()``, ``calloc()``,
|
|
|
|
``realloc()``, ``alloca()``) instead of its argument.
|
|
|
|
|
[clang-tidy] Add spuriously-wake-up-functions check
Summary:
According to
https://wiki.sei.cmu.edu/confluence/display/cplusplus/CON54-CPP.+Wrap+functions+that+can+spuriously+wake+up+in+a+loop
and
https://wiki.sei.cmu.edu/confluence/display/c/CON36-C.+Wrap+functions+that+can+spuriously+wake+up+in+a+loop
misc-spuriously-wake-up-functions check is created. The check finds
`cnd_wait` or `wait` function calls in an `IfStmt` and warns the user to
replace it with a `WhileStmt` or use it with a lambda parameter.
Reviewers: aaron.ballman, alexfh, hokein, jfb, Charusso
Reviewed By: aaron.ballman
Subscribers: sylvestre.ledru, whisperity, Eugene.Zelenko, mgorny, dexonsmith, cfe-commits, gerazo, xazax.hun, steakhal, Charusso
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D70876
2020-03-21 19:02:00 +08:00
|
|
|
- New :doc:`bugprone-spuriously-wake-up-functions
|
|
|
|
<clang-tidy/checks/bugprone-spuriously-wake-up-functions>` check.
|
|
|
|
|
|
|
|
Finds ``cnd_wait``, ``cnd_timedwait``, ``wait``, ``wait_for``, or
|
|
|
|
``wait_until`` function calls when the function is not invoked from a loop
|
|
|
|
that checks whether a condition predicate holds or the function has a
|
|
|
|
condition parameter.
|
|
|
|
|
2020-01-17 21:43:20 +08:00
|
|
|
- New :doc:`bugprone-reserved-identifier
|
|
|
|
<clang-tidy/checks/bugprone-reserved-identifier>` check.
|
|
|
|
|
|
|
|
Checks for usages of identifiers reserved for use by the implementation.
|
2020-02-08 07:08:17 +08:00
|
|
|
|
2020-03-10 22:34:34 +08:00
|
|
|
- New :doc:`bugprone-suspicious-include
|
|
|
|
<clang-tidy/checks/bugprone-suspicious-include>` check.
|
|
|
|
|
|
|
|
Finds cases where an include refers to what appears to be an implementation
|
|
|
|
file, which often leads to hard-to-track-down ODR violations, and diagnoses
|
|
|
|
them.
|
|
|
|
|
2020-01-17 23:33:48 +08:00
|
|
|
- New :doc:`cert-oop57-cpp
|
|
|
|
<clang-tidy/checks/cert-oop57-cpp>` check.
|
2020-02-08 07:08:17 +08:00
|
|
|
|
2020-01-17 23:33:48 +08:00
|
|
|
Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
|
|
|
|
``memcmp`` and similar derivatives on non-trivial types.
|
2020-01-10 16:19:58 +08:00
|
|
|
|
[clang-tidy] Add module for llvm-libc and restrict-system-libc-header-check.
Summary: This adds a new module to enforce standards specific to the llvm-libc project. This change also adds the first check which restricts user from including system libc headers accidentally which can lead to subtle bugs that would be a challenge to detect.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: juliehockett, arphaman, jfb, abrachet, sivachandra, Eugene.Zelenko, njames93, mgorny, xazax.hun, MaskRay, cfe-commits
Tags: #clang-tools-extra, #libc-project, #clang
Differential Revision: https://reviews.llvm.org/D75332
2020-03-13 02:38:05 +08:00
|
|
|
- New :doc:`llvmlibc-restrict-system-libc-headers
|
|
|
|
<clang-tidy/checks/llvmlibc-restrict-system-libc-headers>` check.
|
|
|
|
|
|
|
|
Finds includes of system libc headers not provided by the compiler within
|
|
|
|
llvm-libc implementations.
|
|
|
|
|
2020-02-08 07:08:17 +08:00
|
|
|
- New :doc:`objc-dealloc-in-category
|
|
|
|
<clang-tidy/checks/objc-dealloc-in-category>` check.
|
|
|
|
|
|
|
|
Finds implementations of -dealloc in Objective-C categories.
|
|
|
|
|
[clang-tidy] misc-no-recursion: a new check
Summary:
Recursion is a powerful tool, but like any tool
without care it can be dangerous. For example,
if the recursion is unbounded, you will
eventually run out of stack and crash.
You can of course track the recursion depth
but if it is hardcoded, there can always be some
other environment when that depth is too large,
so said magic number would need to be env-dependent.
But then your program's behavior is suddenly more env-dependent.
Also, recursion, while it does not outright stop optimization,
recursive calls are less great than normal calls,
for example they hinder inlining.
Recursion is banned in some coding guidelines:
* SEI CERT DCL56-CPP. Avoid cycles during initialization of static objects
* JPL 2.4 Do not use direct or indirect recursion.
* I'd say it is frowned upon in LLVM, although not banned
And is plain unsupported in some cases:
* OpenCL 1.2, 6.9 Restrictions: i. Recursion is not supported.
So there's clearly a lot of reasons why one might want to
avoid recursion, and replace it with worklist handling.
It would be great to have a enforcement for it though.
This implements such a check.
Here we detect both direct and indirect recursive calls,
although since clang-tidy (unlike clang static analyzer)
is CTU-unaware, if the recursion transcends a single standalone TU,
we will naturally not find it :/
The algorithm is pretty straight-forward:
1. Build call-graph for the entire TU.
For that, the existing `clang::CallGraph` is re-used,
although it had to be modified to also track the location of the call.
2. Then, the hard problem: how do we detect recursion?
Since we have a graph, let's just do the sane thing,
and look for Strongly Connected Function Declarations - widely known as `SCC`.
For that LLVM provides `llvm::scc_iterator`,
which is internally an Tarjan's DFS algorithm, and is used throught LLVM,
so this should be as performant as possible.
3. Now that we've got SCC's, we discard those that don't contain loops.
Note that there may be more than one loop in SCC!
4. For each loopy SCC, we call out each function, and print a single example
call graph that shows recursion -- it didn't seem worthwhile enumerating
every possible loop in SCC, although i suppose it could be implemented.
* To come up with that call graph cycle example, we start at first SCC node,
see which callee of the node is within SCC (and is thus known to be in cycle),
and recurse into it until we hit the callee that is already in call stack.
Reviewers: JonasToth, aaron.ballman, ffrankies, Eugene.Zelenko, erichkeane, NoQ
Reviewed By: aaron.ballman
Subscribers: Charusso, Naghasan, bader, riccibruno, mgorny, Anastasia, xazax.hun, cfe-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D72362
2020-02-14 04:34:13 +08:00
|
|
|
- New :doc:`misc-no-recursion
|
|
|
|
<clang-tidy/checks/misc-no-recursion>` check.
|
|
|
|
|
|
|
|
Finds recursive functions and diagnoses them.
|
|
|
|
|
2020-01-29 02:09:53 +08:00
|
|
|
New check aliases
|
|
|
|
^^^^^^^^^^^^^^^^^
|
2020-01-10 16:19:58 +08:00
|
|
|
|
[clang-tidy] Add spuriously-wake-up-functions check
Summary:
According to
https://wiki.sei.cmu.edu/confluence/display/cplusplus/CON54-CPP.+Wrap+functions+that+can+spuriously+wake+up+in+a+loop
and
https://wiki.sei.cmu.edu/confluence/display/c/CON36-C.+Wrap+functions+that+can+spuriously+wake+up+in+a+loop
misc-spuriously-wake-up-functions check is created. The check finds
`cnd_wait` or `wait` function calls in an `IfStmt` and warns the user to
replace it with a `WhileStmt` or use it with a lambda parameter.
Reviewers: aaron.ballman, alexfh, hokein, jfb, Charusso
Reviewed By: aaron.ballman
Subscribers: sylvestre.ledru, whisperity, Eugene.Zelenko, mgorny, dexonsmith, cfe-commits, gerazo, xazax.hun, steakhal, Charusso
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D70876
2020-03-21 19:02:00 +08:00
|
|
|
- New alias :doc:`cert-con36-c
|
|
|
|
<clang-tidy/checks/cert-con36-c>` to
|
|
|
|
:doc:`bugprone-spuriously-wake-up-functions
|
|
|
|
<clang-tidy/checks/bugprone-spuriously-wake-up-functions>` was added.
|
|
|
|
|
|
|
|
- New alias :doc:`cert-con54-cpp
|
|
|
|
<clang-tidy/checks/cert-con54-cpp>` to
|
|
|
|
:doc:`bugprone-spuriously-wake-up-functions
|
|
|
|
<clang-tidy/checks/bugprone-spuriously-wake-up-functions>` was added.
|
|
|
|
|
2020-01-17 21:43:20 +08:00
|
|
|
- New alias :doc:`cert-dcl37-c
|
|
|
|
<clang-tidy/checks/cert-dcl37-c>` to
|
|
|
|
:doc:`bugprone-reserved-identifier
|
|
|
|
<clang-tidy/checks/bugprone-reserved-identifier>` was added.
|
|
|
|
|
|
|
|
- New alias :doc:`cert-dcl51-cpp
|
|
|
|
<clang-tidy/checks/cert-dcl51-cpp>` to
|
|
|
|
:doc:`bugprone-reserved-identifier
|
|
|
|
<clang-tidy/checks/bugprone-reserved-identifier>` was added.
|
2020-01-15 03:05:45 +08:00
|
|
|
|
2020-01-10 16:19:58 +08:00
|
|
|
Changes in existing checks
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
[clang-tidy] modernize-use-using uses AST and now supports struct defintions and multiple types in a typedef
Summary:
It now handles `typedef`s that include comma-separated multiple types, and handles embedded struct definitions, which previously could not be automatically converted.
For example, with this patch `modernize-use-using` now can convert:
typedef struct { int a; } R_t, *R_p;
to:
using R_t = struct { int a; };
using R_p = R_t*;
`-ast-dump` showed that the `CXXRecordDecl` definitions and multiple `TypedefDecl`s come consecutively in the tree, so `check()` stores information between calls to determine when it is receiving a second or additional `TypedefDecl` within a single `typedef`, or when the current `TypedefDecl` refers to an embedded `CXXRecordDecl` like a `struct`.
Reviewers: alexfh, aaron.ballman
Patch by: poelmanc
Subscribers: riccibruno, sammccall, cfe-commits, aaron.ballman
Tags: clang-tools-extra, clang
Differential Revision: https://reviews.llvm.org/D70270
2020-01-08 02:49:55 +08:00
|
|
|
|
2020-02-03 05:27:04 +08:00
|
|
|
- Improved :doc:`readability-qualified-auto
|
2020-02-03 05:51:34 +08:00
|
|
|
<clang-tidy/checks/readability-qualified-auto>` check now supports a
|
2020-02-03 05:27:04 +08:00
|
|
|
`AddConstToQualified` to enable adding ``const`` qualifiers to variables
|
|
|
|
typed with ``auto *`` and ``auto &``.
|
|
|
|
|
2020-01-28 07:50:26 +08:00
|
|
|
- Improved :doc:`readability-redundant-string-init
|
|
|
|
<clang-tidy/checks/readability-redundant-string-init>` check now supports a
|
2020-02-08 07:08:17 +08:00
|
|
|
`StringNames` option enabling its application to custom string classes. The
|
|
|
|
check now detects in class initializers and constructor initializers which
|
2020-01-28 07:50:26 +08:00
|
|
|
are deemed to be redundant.
|
[clang-tidy] Give readability-redundant-string-init a customizable list of string types to fix
Summary:
This patch adds a feature requested in https://reviews.llvm.org/D69238 to enable `readability-redundant-string-init` to take a list of strings to apply the fix to rather than hard-coding `basic_string`. It adds a `StringNames` option of semicolon-delimited names of string classes to which to apply this fix. Tests ensure this works with test class out::TestString as well as std::string and std::wstring as before. It should be applicable to llvm::StringRef, QString, etc.
Note: This commit was previously reverted due to a failing unit test. That test has been fixed in this version.
Reviewers: MyDeveloperDay, aaron.ballman, hokein, alexfh, JonasToth, gribozavr2
Patch by: poelmanc
Subscribers: gribozavr2, xazax.hun, Eugene.Zelenko, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D69548
2019-11-16 07:09:27 +08:00
|
|
|
|
2020-03-05 00:55:03 +08:00
|
|
|
- Checks supporting the ``HeaderFileExtensions`` flag now support ``;`` as a
|
|
|
|
delimiter in addition to ``,``, with the latter being deprecated as of this
|
|
|
|
release. This simplifies how one specifies the options on the command line:
|
|
|
|
``--config="{CheckOptions: [{ key: HeaderFileExtensions, value: h;;hpp;hxx }]}"``
|
|
|
|
|
2020-01-10 16:19:58 +08:00
|
|
|
Renamed checks
|
|
|
|
^^^^^^^^^^^^^^
|
2019-11-21 03:27:14 +08:00
|
|
|
|
[clang-tidy] Move fuchsia-restrict-system-includes to portability module for general use.
Summary:
Created a general check for restrict-system-includes under portability as recommend in the comments under D75332. I also fleshed out the user facing documentation to show examples for common use-cases such as allow-list, block-list, and wild carding.
Removed fuchsia's check as per phosek sugguestion.
Reviewers: aaron.ballman, phosek, alexfh, hokein, njames93
Reviewed By: phosek
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, phosek, cfe-commits, MaskRay
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D75786
2020-03-11 01:28:23 +08:00
|
|
|
- The 'fuchsia-restrict-system-headers' check was renamed to :doc:`portability-restrict-system-includes
|
2020-03-11 05:01:23 +08:00
|
|
|
<clang-tidy/checks/portability-restrict-system-includes>`
|
[clang-tidy] Move fuchsia-restrict-system-includes to portability module for general use.
Summary:
Created a general check for restrict-system-includes under portability as recommend in the comments under D75332. I also fleshed out the user facing documentation to show examples for common use-cases such as allow-list, block-list, and wild carding.
Removed fuchsia's check as per phosek sugguestion.
Reviewers: aaron.ballman, phosek, alexfh, hokein, njames93
Reviewed By: phosek
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, phosek, cfe-commits, MaskRay
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D75786
2020-03-11 01:28:23 +08:00
|
|
|
|
2019-10-31 01:48:26 +08:00
|
|
|
Improvements to include-fixer
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
The improvements are...
|
|
|
|
|
2019-03-25 22:09:10 +08:00
|
|
|
Improvements to clang-include-fixer
|
2019-03-26 00:50:24 +08:00
|
|
|
-----------------------------------
|
2016-03-30 20:05:33 +08:00
|
|
|
|
2017-01-13 05:58:40 +08:00
|
|
|
The improvements are...
|
2016-03-30 20:05:33 +08:00
|
|
|
|
|
|
|
Improvements to modularize
|
|
|
|
--------------------------
|
2016-03-27 13:06:57 +08:00
|
|
|
|
|
|
|
The improvements are...
|
[pp-trace] Delete -ignore and add a new option -callbacks
Summary:
-ignore specifies a list of PP callbacks to ignore. It cannot express a
whitelist, which may be more useful than a blacklist.
Add a new option -callbacks to replace it.
-ignore= (default) => -callbacks='*' (default)
-ignore=FileChanged,FileSkipped => -callbacks='*,-FileChanged,-FileSkipped'
-callbacks='Macro*' : print only MacroDefined,MacroExpands,MacroUndefined,...
Reviewers: juliehockett, aaron.ballman, alexfh, ioeric
Reviewed By: aaron.ballman
Subscribers: nemanjai, kbarton, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59296
llvm-svn: 356366
2019-03-18 21:30:17 +08:00
|
|
|
|
|
|
|
Improvements to pp-trace
|
|
|
|
------------------------
|
|
|
|
|
2019-07-18 19:51:05 +08:00
|
|
|
The improvements are...
|
2019-08-28 02:36:08 +08:00
|
|
|
|
|
|
|
Clang-tidy visual studio plugin
|
|
|
|
-------------------------------
|
|
|
|
|