Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def main():
parser.add_argument(
"-j",
type=int,
default=1,
default=0,
help="number of tidy instances to be run in parallel.",
)
parser.add_argument(
Expand Down Expand Up @@ -318,6 +318,7 @@ def main():
if max_task_count == 0:
max_task_count = multiprocessing.cpu_count()
max_task_count = min(len(lines_by_file), max_task_count)
print(f"Running clang-tidy in {max_task_count} threads...")

combine_fixes = False
export_fixes_dir = None
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 @@ -548,7 +548,7 @@ async def main() -> None:
files = {f for f in files if file_name_re.search(f)}

print(
"Running clang-tidy for",
f"Running clang-tidy in {max_task} threads for",
len(files),
"files out of",
number_files_in_database,
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ Improvements to clang-query
Improvements to clang-tidy
--------------------------

- The ``run-clang-tidy.py`` and ``clang-tidy-diff.py`` scripts now run checks in
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- The ``run-clang-tidy.py`` and ``clang-tidy-diff.py`` scripts now run checks in
- The :program:`run-clang-tidy.py` and :program:`clang-tidy-diff.py` scripts now run checks in

parallel by default using all available hardware threads. Both scripts now
display the number of threads being used in their output.

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
// REQUIRES: shell
// RUN: sed 's/placeholder_for_f/f/' %s > %t.cpp
// RUN: clang-tidy -checks=-*,modernize-use-override %t.cpp -- -std=c++11 | FileCheck -check-prefix=CHECK-SANITY %s
// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -- -std=c++11 2>&1 | FileCheck %s
// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -- -std=c++11 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-JMAX
// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -quiet -- -std=c++11 2>&1 | FileCheck -check-prefix=CHECK-QUIET %s
// RUN: mkdir -p %T/compilation-database-test/
// RUN: echo '[{"directory": "%T", "command": "clang++ -o test.o -std=c++11 %t.cpp", "file": "%t.cpp"}]' > %T/compilation-database-test/compile_commands.json
// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -path %T/compilation-database-test 2>&1 | FileCheck -check-prefix=CHECK %s

// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff -checks=-*,modernize-use-override -j 1 -- -std=c++11 2>&1 | FileCheck %s --check-prefix=CHECK-J1
// CHECK-J1: Running clang-tidy in 1 threads...
struct A {
virtual void f() {}
virtual void g() {}
};
// CHECK-JMAX: Running clang-tidy in {{[1-9][0-9]*}} threads...
// CHECK-NOT: warning:
// CHECK-QUIET-NOT: warning:
struct B : public A {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
// RUN: echo " modernize-use-auto.MinTypeNameLength: '0'" >> %t/.clang-tidy
// RUN: cp "%s" "%t/test.cpp"
// RUN: cd "%t"
// RUN: not %run_clang_tidy "test.cpp"
// RUN: not %run_clang_tidy "test.cpp" 2>&1 | FileCheck %s --check-prefix=CHECK-JMAX
// CHECK-JMAX: Running clang-tidy in {{[1-9][0-9]*}} threads for

// RUN: not %run_clang_tidy -j 1 "test.cpp" 2>&1 | FileCheck %s --check-prefix=CHECK-J1
// CHECK-J1: Running clang-tidy in 1 threads for

int main()
{
Expand Down
Loading