Bug 1478644 - [Clang-Tidy] Synchronize run-clang-tidy output with the actual files that are being checked. r?sylvestre
MozReview-Commit-ID: LyfcV4oQwyw
--- a/build/build-clang/clang-tidy-linux64.json
+++ b/build/build-clang/clang-tidy-linux64.json
@@ -12,11 +12,12 @@
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_501/final",
"libcxxabi_repo": "https://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_501/final",
"python_path": "/usr/bin/python2.7",
"gcc_dir": "/builds/worker/workspace/build/src/gcc",
"cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
"cxx": "/builds/worker/workspace/build/src/gcc/bin/g++",
"as": "/builds/worker/workspace/build/src/gcc/bin/gcc",
"patches": [
- "clang-tidy-cxx14.patch"
+ "clang-tidy-cxx14.patch",
+ "clang-tidy-sync-output.patch"
]
}
--- a/build/build-clang/clang-tidy-macosx64.json
+++ b/build/build-clang/clang-tidy-macosx64.json
@@ -19,11 +19,12 @@
"as": "/builds/worker/workspace/build/src/clang/bin/clang",
"ar": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin11-ar",
"ranlib": "/builds/worker/workspace/build/src/cctools/bin/x86_64-apple-darwin11-ranlib",
"ld": "/builds/worker/workspace/build/src/clang/bin/clang",
"patches": [
"llvm-debug-frame-for-5.patch",
"compiler-rt-cross-compile.patch",
"compiler-rt-no-codesign.patch",
- "clang-tidy-cxx14.patch"
+ "clang-tidy-cxx14.patch",
+ "clang-tidy-sync-output.patch"
]
}
new file mode 100644
--- /dev/null
+++ b/build/build-clang/clang-tidy-sync-output.patch
@@ -0,0 +1,40 @@
+diff --git a/extra/clang-tidy/tool/run-clang-tidy.py b/extra/clang-tidy/tool/run-clang-tidy.py
+index d9d827b0..36ac4e38 100755
+--- a/extra/clang-tidy/tool/run-clang-tidy.py
++++ b/extra/clang-tidy/tool/run-clang-tidy.py
+@@ -111,7 +111,7 @@ def apply_fixes(args, tmpdir):
+ subprocess.call(invocation)
+
+
+-def run_tidy(args, tmpdir, build_path, queue):
++def run_tidy(args, tmpdir, build_path, queue, lock):
+ """Takes filenames out of queue and runs clang-tidy on them."""
+ while True:
+ name = queue.get()
+@@ -119,8 +119,12 @@ def run_tidy(args, tmpdir, build_path, queue):
+ tmpdir, build_path, args.header_filter,
+ args.extra_arg, args.extra_arg_before,
+ args.quiet)
+- sys.stdout.write(' '.join(invocation) + '\n')
+- subprocess.call(invocation)
++ proc = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
++ output, err = proc.communicate()
++ with lock:
++ sys.stdout.write(' '.join(invocation) + '\n' + output + '\n')
++ if len(err):
++ sys.stdout.write(err + '\n')
+ queue.task_done()
+
+
+@@ -204,9 +208,10 @@ def main():
+ try:
+ # Spin up a bunch of tidy-launching threads.
+ queue = Queue.Queue(max_task)
++ lock = threading.Lock()
+ for _ in range(max_task):
+ t = threading.Thread(target=run_tidy,
+- args=(args, tmpdir, build_path, queue))
++ args=(args, tmpdir, build_path, queue, lock))
+ t.daemon = True
+ t.start()
+
--- a/build/build-clang/clang-tidy-win32.json
+++ b/build/build-clang/clang-tidy-win32.json
@@ -9,11 +9,12 @@
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_501/final",
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_501/final",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_501/final",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
"python_path": "c:/mozilla-build/python/python.exe",
"cc": "cl.exe",
"cxx": "cl.exe",
"patches": [
- "clang-tidy-cxx14.patch"
+ "clang-tidy-cxx14.patch",
+ "clang-tidy-sync-output.patch"
]
}
--- a/build/build-clang/clang-tidy-win64.json
+++ b/build/build-clang/clang-tidy-win64.json
@@ -10,11 +10,12 @@
"extra_repo": "https://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_501/final",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_501/final",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
"python_path": "c:/mozilla-build/python/python.exe",
"cc": "cl.exe",
"cxx": "cl.exe",
"ml": "ml64.exe",
"patches": [
- "clang-tidy-cxx14.patch"
+ "clang-tidy-cxx14.patch",
+ "clang-tidy-sync-output.patch"
]
}