aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/docs
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/docs')
-rw-r--r--clang-tools-extra/docs/ReleaseNotes.rst32
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.rst5
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst194
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/readability/redundant-parentheses.rst13
-rw-r--r--clang-tools-extra/docs/clang-tidy/index.rst6
5 files changed, 246 insertions, 4 deletions
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 061fb114..6701bf2 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -70,6 +70,11 @@ Potentially Breaking Changes
:doc:`bugprone-signed-char-misuse
<clang-tidy/checks/bugprone/signed-char-misuse>`
+- :program:`clang-tidy` now displays warnings from all non-system headers by
+ default. Previously, users had to explicitly opt-in to header warnings using
+ `-header-filter='.*'`. To disable warnings from non-system, set `-header-filter`
+ to an empty string.
+
Improvements to clangd
----------------------
@@ -132,6 +137,11 @@ Improvements to clang-tidy
when run over C files. If ``-std`` is not specified, it defaults to
``c99-or-later``.
+- :program:`clang-tidy` now displays warnings from all non-system headers by
+ default. Previously, users had to explicitly opt-in to header warnings using
+ `-header-filter='.*'`. To disable warnings from non-system, set `-header-filter`
+ to an empty string.
+
- :program:`clang-tidy` no longer attempts to analyze code from system headers
by default, greatly improving performance. This behavior is disabled if the
`SystemHeaders` option is enabled.
@@ -321,10 +331,21 @@ Changes in existing checks
an additional matcher that generalizes the copy-and-swap idiom pattern
detection.
+- Improved :doc:`cppcoreguidelines-avoid-non-const-global-variables
+ <clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables>` check
+ by adding a new option `AllowThreadLocal` that suppresses warnings on
+ non-const global variables with thread-local storage duration.
+
- Improved :doc:`cppcoreguidelines-init-variables
<clang-tidy/checks/cppcoreguidelines/init-variables>` check by fixing the
insertion location for function pointers with multiple parameters.
+- Improved :doc:`cppcoreguidelines-macro-usage
+ <clang-tidy/checks/cppcoreguidelines/macro-usage>` check by excluding macro
+ bodies that starts with ``__attribute__((..))`` keyword.
+ Such a macro body is unlikely a proper expression and so suggesting users
+ an impossible rewrite into a template function should be avoided.
+
- Improved :doc:`cppcoreguidelines-prefer-member-initializer
<clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check to
avoid false positives on inherited members in class templates.
@@ -380,6 +401,11 @@ Changes in existing checks
on Windows when the check was enabled with a 32-bit :program:`clang-tidy`
binary.
+- Improved :doc:`modernize-use-scoped-lock
+ <clang-tidy/checks/modernize/use-scoped-lock>` check by fixing a crash
+ on malformed code (common when using :program:`clang-tidy` through
+ :program:`clangd`).
+
- Improved :doc:`modernize-use-std-format
<clang-tidy/checks/modernize/use-std-format>` check to correctly match
when the format string is converted to a different type by an implicit
@@ -396,7 +422,8 @@ Changes in existing checks
- Improved :doc:`performance-unnecessary-value-param
<clang-tidy/checks/performance/unnecessary-value-param>` by printing
- the type of the diagnosed variable.
+ the type of the diagnosed variable and correctly generating fix-it hints for
+ parameter-pack arguments.
- Improved :doc:`portability-template-virtual-member-function
<clang-tidy/checks/portability/template-virtual-member-function>` check to
@@ -416,7 +443,8 @@ Changes in existing checks
- Improved :doc:`readability-identifier-naming
<clang-tidy/checks/readability/identifier-naming>` check by ignoring
declarations and macros in system headers. The documentation is also improved
- to differentiate the general options from the specific ones.
+ to differentiate the general options from the specific ones. Options for
+ fine-grained control over ``constexpr`` variables were added.
- Improved :doc:`readability-implicit-bool-conversion
<clang-tidy/checks/readability/implicit-bool-conversion>` check by correctly
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.rst
index 8da284c..3d5fef3 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.rst
@@ -49,3 +49,8 @@ Options
When set to `true`, static non-const variables and variables in anonymous
namespaces will not generate a warning. The default value is `false`.
+
+.. option:: AllowThreadLocal
+
+ When set to `true`, non-const global variables with thread-local storage
+ duration will not generate a warning. The default value is `false`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst
index 0e031a1..6c4e0b7 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst
@@ -59,6 +59,7 @@ The available options are summarized below:
- :option:`AbstractClassCase`, :option:`AbstractClassPrefix`, :option:`AbstractClassSuffix`, :option:`AbstractClassIgnoredRegexp`, :option:`AbstractClassHungarianPrefix`
- :option:`ClassCase`, :option:`ClassPrefix`, :option:`ClassSuffix`, :option:`ClassIgnoredRegexp`, :option:`ClassHungarianPrefix`
+ - :option:`ClassConstexprCase`, :option:`ClassConstexprPrefix`, :option:`ClassConstexprSuffix`, :option:`ClassConstexprIgnoredRegexp`, :option:`ClassConstexprHungarianPrefix`
- :option:`ClassConstantCase`, :option:`ClassConstantPrefix`, :option:`ClassConstantSuffix`, :option:`ClassConstantIgnoredRegexp`, :option:`ClassConstantHungarianPrefix`
- :option:`ClassMemberCase`, :option:`ClassMemberPrefix`, :option:`ClassMemberSuffix`, :option:`ClassMemberIgnoredRegexp`, :option:`ClassMemberHungarianPrefix`
- :option:`ClassMethodCase`, :option:`ClassMethodPrefix`, :option:`ClassMethodSuffix`, :option:`ClassMethodIgnoredRegexp`
@@ -73,12 +74,14 @@ The available options are summarized below:
- :option:`EnumCase`, :option:`EnumPrefix`, :option:`EnumSuffix`, :option:`EnumIgnoredRegexp`
- :option:`EnumConstantCase`, :option:`EnumConstantPrefix`, :option:`EnumConstantSuffix`, :option:`EnumConstantIgnoredRegexp`, :option:`EnumConstantHungarianPrefix`
- :option:`FunctionCase`, :option:`FunctionPrefix`, :option:`FunctionSuffix`, :option:`FunctionIgnoredRegexp`
+ - :option:`GlobalConstexprVariableCase`, :option:`GlobalConstexprVariablePrefix`, :option:`GlobalConstexprVariableSuffix`, :option:`GlobalConstexprVariableIgnoredRegexp`, :option:`GlobalConstexprVariableHungarianPrefix`
- :option:`GlobalConstantCase`, :option:`GlobalConstantPrefix`, :option:`GlobalConstantSuffix`, :option:`GlobalConstantIgnoredRegexp`, :option:`GlobalConstantHungarianPrefix`
- :option:`GlobalConstantPointerCase`, :option:`GlobalConstantPointerPrefix`, :option:`GlobalConstantPointerSuffix`, :option:`GlobalConstantPointerIgnoredRegexp`, :option:`GlobalConstantPointerHungarianPrefix`
- :option:`GlobalFunctionCase`, :option:`GlobalFunctionPrefix`, :option:`GlobalFunctionSuffix`, :option:`GlobalFunctionIgnoredRegexp`
- :option:`GlobalPointerCase`, :option:`GlobalPointerPrefix`, :option:`GlobalPointerSuffix`, :option:`GlobalPointerIgnoredRegexp`, :option:`GlobalPointerHungarianPrefix`
- :option:`GlobalVariableCase`, :option:`GlobalVariablePrefix`, :option:`GlobalVariableSuffix`, :option:`GlobalVariableIgnoredRegexp`, :option:`GlobalVariableHungarianPrefix`
- :option:`InlineNamespaceCase`, :option:`InlineNamespacePrefix`, :option:`InlineNamespaceSuffix`, :option:`InlineNamespaceIgnoredRegexp`
+ - :option:`LocalConstexprVariableCase`, :option:`LocalConstexprVariablePrefix`, :option:`LocalConstexprVariableSuffix`, :option:`LocalConstexprVariableIgnoredRegexp`, :option:`LocalConstexprVariableHungarianPrefix`
- :option:`LocalConstantCase`, :option:`LocalConstantPrefix`, :option:`LocalConstantSuffix`, :option:`LocalConstantIgnoredRegexp`, :option:`LocalConstantHungarianPrefix`
- :option:`LocalConstantPointerCase`, :option:`LocalConstantPointerPrefix`, :option:`LocalConstantPointerSuffix`, :option:`LocalConstantPointerIgnoredRegexp`, :option:`LocalConstantPointerHungarianPrefix`
- :option:`LocalPointerCase`, :option:`LocalPointerPrefix`, :option:`LocalPointerSuffix`, :option:`LocalPointerIgnoredRegexp`, :option:`LocalPointerHungarianPrefix`
@@ -97,6 +100,7 @@ The available options are summarized below:
- :option:`PublicMemberCase`, :option:`PublicMemberPrefix`, :option:`PublicMemberSuffix`, :option:`PublicMemberIgnoredRegexp`, :option:`PublicMemberHungarianPrefix`
- :option:`PublicMethodCase`, :option:`PublicMethodPrefix`, :option:`PublicMethodSuffix`, :option:`PublicMethodIgnoredRegexp`
- :option:`ScopedEnumConstantCase`, :option:`ScopedEnumConstantPrefix`, :option:`ScopedEnumConstantSuffix`, :option:`ScopedEnumConstantIgnoredRegexp`
+ - :option:`StaticConstexprVariableCase`, :option:`StaticConstexprVariablePrefix`, :option:`StaticConstexprVariableSuffix`, :option:`StaticConstexprVariableIgnoredRegexp`, :option:`StaticConstexprVariableHungarianPrefix`
- :option:`StaticConstantCase`, :option:`StaticConstantPrefix`, :option:`StaticConstantSuffix`, :option:`StaticConstantIgnoredRegexp`, :option:`StaticConstantHungarianPrefix`
- :option:`StaticVariableCase`, :option:`StaticVariablePrefix`, :option:`StaticVariableSuffix`, :option:`StaticVariableIgnoredRegexp`, :option:`StaticVariableHungarianPrefix`
- :option:`StructCase`, :option:`StructPrefix`, :option:`StructSuffix`, :option:`StructIgnoredRegexp`
@@ -307,6 +311,58 @@ After:
~pre_foo_post();
};
+.. option:: ClassConstexprCase
+
+ When defined, the check will ensure class ``constexpr`` names conform to
+ the selected casing.
+
+.. option:: ClassConstexprPrefix
+
+ When defined, the check will ensure class ``constexpr`` names will add the
+ prefixed with the given value (regardless of casing).
+
+.. option:: ClassConstexprIgnoredRegexp
+
+ Identifier naming checks won't be enforced for class ``constexpr`` names
+ matching this regular expression.
+
+.. option:: ClassConstexprSuffix
+
+ When defined, the check will ensure class ``constexpr`` names will add the
+ suffix with the given value (regardless of casing).
+
+.. option:: ClassConstexprHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will have a
+ Hungarian notation prefix based on the declared type.
+
+For example using values of:
+
+ - ClassConstexprCase of ``lower_case``
+ - ClassConstexprPrefix of ``pre_``
+ - ClassConstexprSuffix of ``_post``
+ - ClassConstexprHungarianPrefix of ``On``
+
+Identifies and/or transforms class ``constexpr`` variable names as follows:
+
+Before:
+
+.. code-block:: c++
+
+ class FOO {
+ public:
+ static constexpr int CLASS_CONSTEXPR;
+ };
+
+After:
+
+.. code-block:: c++
+
+ class FOO {
+ public:
+ static const int pre_class_constexpr_post;
+ };
+
.. option:: ClassConstantCase
When defined, the check will ensure class constant names conform to the
@@ -950,6 +1006,52 @@ After:
different style.
Default value is `true`.
+.. option:: GlobalConstexprVariableCase
+
+ When defined, the check will ensure global ``constexpr`` variable names
+ conform to the selected casing.
+
+.. option:: GlobalConstexprVariablePrefix
+
+ When defined, the check will ensure global ``constexpr`` variable names
+ will add the prefixed with the given value (regardless of casing).
+
+.. option:: GlobalConstexprVariableIgnoredRegexp
+
+ Identifier naming checks won't be enforced for global ``constexpr``
+ variable names matching this regular expression.
+
+.. option:: GlobalConstexprVariableSuffix
+
+ When defined, the check will ensure global ``constexpr`` variable names
+ will add the suffix with the given value (regardless of casing).
+
+.. option:: GlobalConstexprVariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will have a
+ Hungarian notation prefix based on the declared type.
+
+For example using values of:
+
+ - GlobalConstexprVariableCase of ``lower_case``
+ - GlobalConstexprVariablePrefix of ``pre_``
+ - GlobalConstexprVariableSuffix of ``_post``
+ - GlobalConstexprVariableHungarianPrefix of ``On``
+
+Identifies and/or transforms global ``constexpr`` variable names as follows:
+
+Before:
+
+.. code-block:: c++
+
+ constexpr unsigned ImportantValue = 69;
+
+After:
+
+.. code-block:: c++
+
+ constexpr unsigned pre_important_value_post = 69;
+
.. option:: GlobalConstantCase
When defined, the check will ensure global constant names conform to the
@@ -1228,6 +1330,52 @@ After:
}
} // namespace FOO_NS
+.. option:: LocalConstexprVariableCase
+
+ When defined, the check will ensure local ``constexpr`` variable names
+ conform to the selected casing.
+
+.. option:: LocalConstexprVariablePrefix
+
+ When defined, the check will ensure local ``constexpr`` variable names will
+ add the prefixed with the given value (regardless of casing).
+
+.. option:: LocalConstexprVariableIgnoredRegexp
+
+ Identifier naming checks won't be enforced for local ``constexpr`` variable
+ names matching this regular expression.
+
+.. option:: LocalConstexprVariableSuffix
+
+ When defined, the check will ensure local ``constexpr`` variable names will
+ add the suffix with the given value (regardless of casing).
+
+.. option:: LocalConstexprVariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will have a
+ Hungarian notation prefix based on the declared type.
+
+For example using values of:
+
+ - LocalConstexprVariableCase of ``lower_case``
+ - LocalConstexprVariablePrefix of ``pre_``
+ - LocalConstexprVariableSuffix of ``_post``
+ - LocalConstexprVariableHungarianPrefix of ``On``
+
+Identifies and/or transforms local ``constexpr`` variable names as follows:
+
+Before:
+
+.. code-block:: c++
+
+ void foo() { int const local_Constexpr = 420; }
+
+After:
+
+.. code-block:: c++
+
+ void foo() { int const pre_local_constexpr_post = 420; }
+
.. option:: LocalConstantCase
When defined, the check will ensure local constant names conform to the
@@ -2077,6 +2225,52 @@ After:
enum class FOO { pre_One_post, pre_Two_post, pre_Three_post };
+.. option:: StaticConstexprVariableCase
+
+ When defined, the check will ensure static ``constexpr`` variable names
+ conform to the selected casing.
+
+.. option:: StaticConstexprVariablePrefix
+
+ When defined, the check will ensure static ``constexpr`` variable names
+ will add the prefixed with the given value (regardless of casing).
+
+.. option:: StaticConstexprVariableIgnoredRegexp
+
+ Identifier naming checks won't be enforced for static ``constexpr``
+ variable names matching this regular expression.
+
+.. option:: StaticConstexprVariableSuffix
+
+ When defined, the check will ensure static ``constexpr`` variable names
+ will add the suffix with the given value (regardless of casing).
+
+.. option:: StaticConstexprVariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will have a
+ Hungarian notation prefix based on the declared type.
+
+For example using values of:
+
+ - StaticConstexprVariableCase of ``lower_case``
+ - StaticConstexprVariablePrefix of ``pre_``
+ - StaticConstexprVariableSuffix of ``_post``
+ - StaticConstexprVariableHungarianPrefix of ``On``
+
+Identifies and/or transforms static ``constexpr`` variable names as follows:
+
+Before:
+
+.. code-block:: c++
+
+ static unsigned constexpr MyConstexprStatic_array[] = {1, 2, 3};
+
+After:
+
+.. code-block:: c++
+
+ static unsigned constexpr pre_my_constexpr_static_array_post[] = {1, 2, 3};
+
.. option:: StaticConstantCase
When defined, the check will ensure static constant names conform to the
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-parentheses.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-parentheses.rst
index 23d975e..20e3891 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-parentheses.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-parentheses.rst
@@ -27,3 +27,16 @@ affect the semantics.
.. code-block:: c++
int a = (1 * 2) + 3; // no warning
+
+Options
+-------
+
+.. option:: AllowedDecls
+
+ Semicolon-separated list of regular expressions matching names of declarations
+ to ignore when the parentheses are around. Declarations can include variables
+ or functions. The default is an `std::max;std::min`.
+
+ Some STL library functions may have the same name as widely used function-like
+ macro. For example, ``std::max`` and ``max`` macro. A workaround to distinguish
+ them is adding parentheses around functions to prevent function-like macro.
diff --git a/clang-tools-extra/docs/clang-tidy/index.rst b/clang-tools-extra/docs/clang-tidy/index.rst
index bd2c40e..6ff82bf 100644
--- a/clang-tools-extra/docs/clang-tidy/index.rst
+++ b/clang-tools-extra/docs/clang-tidy/index.rst
@@ -215,7 +215,9 @@ An overview of all the command-line options:
This option overrides the 'FormatStyle` option in
.clang-tidy file, if any.
--header-filter=<string> - Regular expression matching the names of the
- headers to output diagnostics from. Diagnostics
+ headers to output diagnostics from. The default
+ value is '.*', i.e. diagnostics from all non-system
+ headers are displayed by default. Diagnostics
from the main file of each translation unit are
always displayed.
Can be used together with -line-filter.
@@ -338,7 +340,7 @@ An overview of all the command-line options:
WarningsAsErrors: ''
HeaderFileExtensions: ['', 'h','hh','hpp','hxx']
ImplementationFileExtensions: ['c','cc','cpp','cxx']
- HeaderFilterRegex: ''
+ HeaderFilterRegex: '.*'
FormatStyle: none
InheritParentConfig: true
User: user