[PATCH] D41720: [clang-tidy] Add a -show-color flag.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 11:07:16 PST 2018

aaron.ballman added a comment.

This patch is missing test coverage.

Comment at: clang-tidy/ClangTidy.cpp:99-103
+    if (Context.getOptions().ShowColor.hasValue()) {
+      DiagOpts->ShowColors = Context.getOptions().ShowColor.getValue();
+    } else {
+      DiagOpts->ShowColors = llvm::sys::Process::StandardOutHasColors();
+    }
I think this can be simplified to:
DiagOpts->ShowColors = Context.getOptions().ShowColor.getValueOr(llvm::sys::Process::StandardOutHasColors());

Comment at: clang-tidy/tool/ClangTidyMain.cpp:150-152
+Show color diagnostics. If not specified,
+defaults to on when a color-capable terminal
+is detected.)"),
I think this raw string can be reflowed a bit?

Instead of "defaults to on", how about "Defaults to true when a color-capable terminal is detected."?



More information about the cfe-commits mailing list