1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[Support] Add color cl category.

This commit adds a color category so tools can document this option and
enables it for dwarfdump and dsymuttil.

rdar://problem/40498996

llvm-svn: 333176
This commit is contained in:
Jonas Devlieghere 2018-05-24 11:36:57 +00:00
parent d810290dd0
commit b1ad6ad40e
6 changed files with 13 additions and 4 deletions

View File

@ -14,6 +14,8 @@
namespace llvm {
extern cl::OptionCategory ColorCategory;
class raw_ostream;
// Symbolic names for various syntax elements.

View File

@ -13,9 +13,11 @@
using namespace llvm;
cl::OptionCategory llvm::ColorCategory("Color Options");
static cl::opt<cl::boolOrDefault>
UseColor("color",
cl::desc("use colored syntax highlighting (default=autodetect)"),
UseColor("color", cl::cat(ColorCategory),
cl::desc("Use colors in output (default=autodetect)"),
cl::init(cl::BOU_UNSET));
bool WithColor::colorsEnabled(raw_ostream &OS) {

View File

@ -2,6 +2,8 @@ RUN: dsymutil -help 2>&1 | FileCheck --check-prefix=HELP %s
HELP: OVERVIEW: manipulate archived DWARF debug symbol files.
HELP: USAGE: dsymutil{{[^ ]*}} [options] <input files>
HELP-NOT: -reverse-iterate
HELP: Color Options
HELP: -color
HELP: Specific Options:
HELP: -arch=<arch>
HELP: -dump-debug-map

View File

@ -2,6 +2,8 @@ RUN: llvm-dwarfdump -h 2>&1 | FileCheck --check-prefix=HELP %s
RUN: llvm-dwarfdump --help 2>&1 | FileCheck --check-prefix=HELP %s
HELP: USAGE: llvm-dwarfdump{{[^ ]*}} [options] <input object files or .dSYM bundles>
HELP-NOT: -reverse-iterate
HELP: Color Options
HELP: -color
HELP: Section-specific Dump Options
HELP: -debug-info - Dump the .debug_info section
HELP: -eh-frame

View File

@ -393,7 +393,7 @@ int main(int argc, char **argv) {
std::string SDKPath = llvm::sys::fs::getMainExecutable(argv[0], P);
SDKPath = llvm::sys::path::parent_path(SDKPath);
HideUnrelatedOptions(DsymCategory);
HideUnrelatedOptions({&DsymCategory, &ColorCategory});
llvm::cl::ParseCommandLineOptions(
argc, argv,
"manipulate archived DWARF debug symbol files.\n\n"

View File

@ -28,6 +28,7 @@
#include "llvm/Support/Regex.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@ -513,7 +514,7 @@ int main(int argc, char **argv) {
llvm::InitializeAllTargetInfos();
llvm::InitializeAllTargetMCs();
HideUnrelatedOptions({&DwarfDumpCategory, &SectionCategory});
HideUnrelatedOptions({&DwarfDumpCategory, &SectionCategory, &ColorCategory});
cl::ParseCommandLineOptions(
argc, argv,
"pretty-print DWARF debug information in object files"