diff options
| author | Justin Bogner <mail@justinbogner.com> | 2015-03-19 04:45:16 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2015-03-19 04:45:16 +0000 |
| commit | 9deb1d406f5b47004f60d6ae3f5bd80299d6efc3 (patch) | |
| tree | eb2b141dd3256c49d5f82f7d43ec40e03b9520e6 /llvm/tools/llvm-cov/CodeCoverage.cpp | |
| parent | 61bff6192613038f721dccf52b0627b58354f9b0 (diff) | |
| download | llvm-9deb1d406f5b47004f60d6ae3f5bd80299d6efc3.zip llvm-9deb1d406f5b47004f60d6ae3f5bd80299d6efc3.tar.gz llvm-9deb1d406f5b47004f60d6ae3f5bd80299d6efc3.tar.bz2 | |
llvm-cov: Rename -color={always|never} to -use-color[=0]
This is an ugly hack to fix the configure --enable-shared build. It
turns out that *every cl::opt in LLVM* shows up in *every tool* in
that configuration, which is hopelessly broken. This skirts around the
issue by not colliding with another option's name, for now.
I've also simplified the option implementation - the other "color"
option used cl::boolOrDefault and was much nicer than what I'd written
before.
llvm-svn: 232704
Diffstat (limited to 'llvm/tools/llvm-cov/CodeCoverage.cpp')
| -rw-r--r-- | llvm/tools/llvm-cov/CodeCoverage.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp index 1582347..0331a02 100644 --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -228,10 +228,6 @@ std::unique_ptr<CoverageMapping> CodeCoverageTool::load() { return Coverage; } -namespace { -enum Colors { Auto, Always, Never }; -} - int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { // Print a stack trace if we signal out. sys::PrintStackTraceOnErrorSignal(); @@ -298,22 +294,18 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { "greater than the given threshold"), cl::cat(FilteringCategory)); - cl::opt<Colors> Color( - "color", cl::desc("Configure color output:"), cl::init(Colors::Auto), - cl::values(clEnumValN(Colors::Auto, "auto", - "Enable color if stdout seems to support it"), - clEnumValN(Colors::Always, "always", "Enable color"), - clEnumValN(Colors::Never, "never", "Disable color"), - clEnumValEnd)); + cl::opt<cl::boolOrDefault> UseColor( + "use-color", cl::desc("Emit colored output (default=autodetect)"), + cl::init(cl::BOU_UNSET)); auto commandLineParser = [&, this](int argc, const char **argv) -> int { cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n"); ViewOpts.Debug = DebugDump; CompareFilenamesOnly = FilenameEquivalence; - ViewOpts.Colors = - Color == Colors::Always || - (Color == Colors::Auto && sys::Process::StandardOutHasColors()); + ViewOpts.Colors = UseColor == cl::BOU_UNSET + ? sys::Process::StandardOutHasColors() + : UseColor == cl::BOU_TRUE; // Create the function filters if (!NameFilters.empty() || !NameRegexFilters.empty()) { |
