LCOV - code coverage report
Current view: top level - lib/DebugInfo - SyntaxHighlighting.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 8 15 53.3 %
Date: 2015-01-30 11:55:44 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- SyntaxHighlighting.cpp ----------------------------------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #include "SyntaxHighlighting.h"
      11             : #include "llvm/Support/CommandLine.h"
      12             : using namespace llvm;
      13             : using namespace dwarf;
      14             : using namespace syntax;
      15             : 
      16             : static cl::opt<cl::boolOrDefault>
      17       68832 :     UseColor("color",
      18             :              cl::desc("use colored syntax highlighting (default=autodetect)"),
      19       68832 :              cl::init(cl::BOU_UNSET));
      20             : 
      21       21195 : WithColor::WithColor(llvm::raw_ostream &OS, enum HighlightColor Type) : OS(OS) {
      22             :   // Detect color from terminal type unless the user passed the --color option.
      23       21195 :   if (UseColor == cl::BOU_UNSET ? OS.has_colors() : UseColor == cl::BOU_TRUE) {
      24           0 :     switch (Type) {
      25           0 :     case Address:    OS.changeColor(llvm::raw_ostream::YELLOW);  break;
      26           0 :     case String:     OS.changeColor(llvm::raw_ostream::GREEN);   break;
      27           0 :     case Tag:        OS.changeColor(llvm::raw_ostream::BLUE);    break;
      28           0 :     case Attribute:  OS.changeColor(llvm::raw_ostream::CYAN);    break;
      29           0 :     case Enumerator: OS.changeColor(llvm::raw_ostream::MAGENTA); break;
      30             :     }
      31             :   }
      32       21195 : }
      33             : 
      34       21195 : WithColor::~WithColor() {
      35       21195 :   if (UseColor == cl::BOU_UNSET ? OS.has_colors() : UseColor == cl::BOU_TRUE)
      36           0 :     OS.resetColor();
      37      124443 : }

Generated by: LCOV version 1.11