[PATCH] D49851: [clang-tidy] run-clang-tidy add synchronisation to the output
Andi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 10 04:51:28 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL339427: [clang-tidy] run-clang-tidy.py - add synchronisation to the output (authored by Abpostelnicu, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D49851?vs=159511&id=160090#toc
Repository:
rL LLVM
https://reviews.llvm.org/D49851
Files:
clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -153,18 +153,23 @@
subprocess.call(invocation)
-def run_tidy(args, tmpdir, build_path, queue, failed_files):
+def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
"""Takes filenames out of queue and runs clang-tidy on them."""
while True:
name = queue.get()
invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
tmpdir, build_path, args.header_filter,
args.extra_arg, args.extra_arg_before,
args.quiet, args.config)
- sys.stdout.write(' '.join(invocation) + '\n')
- return_code = subprocess.call(invocation)
- if return_code != 0:
+
+ proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ output, err = proc.communicate()
+ if proc.returncode != 0:
failed_files.append(name)
+ with lock:
+ sys.stdout.write(' '.join(invocation) + '\n' + output + '\n')
+ if err > 0:
+ sys.stderr.write(err + '\n')
queue.task_done()
@@ -263,9 +268,10 @@
task_queue = queue.Queue(max_task)
# List of files with a non-zero return code.
failed_files = []
+ lock = threading.Lock()
for _ in range(max_task):
t = threading.Thread(target=run_tidy,
- args=(args, tmpdir, build_path, task_queue, failed_files))
+ args=(args, tmpdir, build_path, task_queue, lock, failed_files))
t.daemon = True
t.start()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49851.160090.patch
Type: text/x-patch
Size: 1795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180810/8c615381/attachment.bin>
More information about the llvm-commits
mailing list