Skip to content
Merged
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
13 changes: 9 additions & 4 deletions clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,19 @@ in .clang-tidy file, if any.
cl::init(false), cl::cat(ClangTidyCategory));

static cl::opt<std::string> LineFilter("line-filter", desc(R"(
List of files with line ranges to filter the
warnings. Can be used together with
-header-filter. The format of the list is a
JSON array of objects:
List of files and line ranges to output diagnostics from.
The range is inclusive on both ends. Can be used together
with -header-filter. The format of the list is a JSON
array of objects. For example:

[
{"name":"file1.cpp","lines":[[1,3],[5,7]]},
{"name":"file2.h"}
]

This will output diagnostics from 'file1.cpp' only for
the line ranges [1,3] and [5,7], as well as all from the
entire 'file2.h'.
)"),
cl::init(""),
cl::cat(ClangTidyCategory));
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ async def main() -> None:
parser.add_argument(
"-line-filter",
default=None,
help="List of files with line ranges to filter the warnings.",
help="List of files and line ranges to output diagnostics from.",
)
if yaml:
parser.add_argument(
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ Improvements to clang-tidy
`enable-check-profile` to enable per-check timing profiles and print a
report based on all analyzed files.

- Improved documentation of the `-line-filter` command-line flag of
:program:`clang-tidy` and :program:`run-clang-tidy.py`.

New checks
^^^^^^^^^^

Expand Down
13 changes: 9 additions & 4 deletions clang-tools-extra/docs/clang-tidy/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,19 @@ An overview of all the command-line options:
Can be used together with -line-filter.
This option overrides the 'HeaderFilterRegex'
option in .clang-tidy file, if any.
--line-filter=<string> - List of files with line ranges to filter the
warnings. Can be used together with
-header-filter. The format of the list is a
JSON array of objects:
--line-filter=<string> - List of files and line ranges to output diagnostics from.
The range is inclusive on both ends. Can be used together
with -header-filter. The format of the list is a JSON
array of objects. For example:

[
{"name":"file1.cpp","lines":[[1,3],[5,7]]},
{"name":"file2.h"}
]

This will output diagnostics from 'file1.cpp' only for
the line ranges [1,3] and [5,7], as well as all from the
entire 'file2.h'.
--list-checks - List all enabled checks and exit. Use with
-checks=* to list all available checks.
--load=<pluginfilename> - Load the specified plugin
Expand Down