[PATCH] D61849: Do not list enabled checks when -quiet is given to clang-tidy.

Sven Panne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 03:28:15 PDT 2019


svenpanne created this revision.
svenpanne added a reviewer: alexfh.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D61849

Files:
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -245,7 +245,12 @@
     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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61849.199229.patch
Type: text/x-patch
Size: 739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190513/f7a59994/attachment.bin>


More information about the cfe-commits mailing list