Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions clang-tools-extra/docs/clang-tidy/GlobalOptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
==============
Global Options
==============

Some options apply to multiple checks. This page lists all the available
globally options.

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.

.. option:: IgnoreMacros
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one should not be global. The same is done for clang warnings. Sometimes it may make sense to ignore macros, sometimes not, depending on the check.

Copy link
Contributor Author

@HerrCai0907 HerrCai0907 Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to current implement of clangtidy, lots of checks will read ignores macros from global scope. i don't think it is a good idea to change lots of checks behavior.

maybe i can notices something in this file to explain global option doesn't apply for every check?


If set to `true`, the check will not give warnings inside macros. Default
is `true`.

.. option:: StrictMode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option does not have any meaning in this context. Therefore I believe it should be kept local.


When `true`, some checkers will be more stringent. The default value depends
on the checks.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: AbseilStringsMatchHeader

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: AbseilStringsMatchHeader

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IncludeBoostSystem

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Options

.. option:: IgnoreMacros

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I don't see much benefit in this change, it makes the documentation harder to read as one has to go back and forth. I don't see the trouble with this duplication, since it's not really a problem if the sentences don't match exactly with each other - it does not add maintenance cost.

Sometimes DRY can cause more trouble that it's worth - a bit of duplication makes sense in benefit of usability and readability.

Ignore the check when analyzing macros. This is useful for safely defining function-like macros:
See :doc:`global options <../../GlobalOptions>`.
This is useful for safely defining function-like macros:

.. code-block:: c++

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: MathHeader

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ lives.

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

Limitations
-----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IgnoreDefaultInitialization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IgnoreDefaultInitialization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IgnoreNonTrivialTypes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: ValuesOnly

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,4 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Options

.. option:: IgnoreMacros

If `true` don't diagnose traits defined in macros.
See :doc:`global options <../../GlobalOptions>`.

Note: Fixes will never be emitted for code inside of macros.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ Options

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,4 @@ Options

.. option:: IgnoreMacros

If this option is set to `true` (default is `true`), the check will not warn
about members declared inside macros.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Options

.. option:: IgnoreMacros

See :doc:`global options <../../GlobalOptions>`.
If set to `true`, the check will not give warnings inside macros and will
ignore special members with bodies contain macros or preprocessor directives.
Default is `true`.
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ for manually relocating functions to the ``public`` section.

.. option:: IgnoreMacros

If this option is set to `true` (default is `true`), the check will not warn
about functions declared inside macros.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: UseReversePipe

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ Options

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IgnoreExternC

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ Options

.. option:: IncludeStyle

A string specifying which include-style is used, `llvm` or `google`. Default
is `llvm`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: AllowedTypes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ Options

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ Options

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ Options

.. option:: IgnoreMacros

If set to `true`, the check will ignore code inside macros. Note, that also
any macro arguments are ignored, even if they should count to the complexity.
See :doc:`global options <../../GlobalOptions>`.
Note, that also any macro arguments are ignored, even if they should count
to the complexity.
As this might change in the future, this option isn't guaranteed to be
forward-compatible. Default is `false`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ the definition or the first declaration seen in a translation unit.

.. option:: IgnoreMacros

If this option is set to `true` (default is `true`), the check will not warn
about names declared inside macros.
See :doc:`global options <../../GlobalOptions>`.

.. option:: Strict

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ Options

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: IgnoreTypeAliases

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ Options

.. option:: IgnoreMacros

If set to `true`, the check will not give warnings inside macros. Default
is `true`.
See :doc:`global options <../../GlobalOptions>`.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Examples:

.. option:: IgnoreMacros

If this option is set to `true` (default is `true`), the check will not warn
about calls inside macros.
See :doc:`global options <../../GlobalOptions>`.

Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ Options

.. option:: IgnoreMacros

If `true`, ignore boolean expressions originating from expanded macros.
Default is `false`.
See :doc:`global options <../../GlobalOptions>`.

.. option:: ChainedConditionalReturn

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ Given a list `L;uL`:

.. option:: IgnoreMacros

If this option is set to `true` (default is `true`), the check will not warn
about literal suffixes inside macros.
See :doc:`global options <../../GlobalOptions>`.
1 change: 1 addition & 0 deletions clang-tools-extra/docs/clang-tidy/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ See also:
:maxdepth: 1

The list of clang-tidy checks <checks/list>
The list of clang-tidy global options <GlobalOptions>
Clang-tidy IDE/Editor Integrations <Integrations>
Getting Involved <Contributing>
External Clang-Tidy Examples <ExternalClang-TidyExamples>
Comment on lines 12 to 16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a drive-by comment, noticed this list sometimes uses clang-tidy, sometimes Clang-Tidy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the root cause is the style of titles. Some titles uppercase each word some not.
It looks like in clang/docs, most of rst files' titles use uppercase each word.

Expand Down
Loading