[clang-tools-extra] r360869 - [clang-tidy] Do not list enabled checks when -quiet is given to run-clang-tidy.

Jonas Toth via cfe-commits cfe-commits at lists.llvm.org
Thu May 16 02:22:39 PDT 2019


Author: jonastoth
Date: Thu May 16 02:22:39 2019
New Revision: 360869

URL: http://llvm.org/viewvc/llvm-project?rev=360869&view=rev
Log:
[clang-tidy] Do not list enabled checks when -quiet is given to run-clang-tidy.

Summary: When run-clang-tidy is given the -quiet flag, do not output the potentially hundreds of enabled check names at the beginning.

Patch by svenpanne.

Reviewers: alexfh, JonasToth

Reviewed By: JonasToth

Subscribers: JonasToth, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D61849

Modified:
    clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py

Modified: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py?rev=360869&r1=360868&r2=360869&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py Thu May 16 02:22:39 2019
@@ -245,7 +245,12 @@ def main():
     if args.checks:
       invocation.append('-checks=' + args.checks)
     invocation.append('-')
-    subprocess.check_call(invocation)
+    if args.quiet:
+      # Even with -quiet we still want to check if we can call clang-tidy.
+      with open(os.devnull, 'w') as dev_null:
+        subprocess.check_call(invocation, stdout=dev_null)
+    else:
+      subprocess.check_call(invocation)
   except:
     print("Unable to run clang-tidy.", file=sys.stderr)
     sys.exit(1)




More information about the cfe-commits mailing list