1 //===- WithColor.h ----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_SUPPORT_WITHCOLOR_H
11 #define LLVM_SUPPORT_WITHCOLOR_H
17 // Symbolic names for various syntax elements.
18 enum class HighlightColor {
30 /// An RAII object that temporarily switches an output stream to a specific
34 /// Determine whether colors should be displayed.
35 bool colorsEnabled(raw_ostream &OS);
38 /// To be used like this: WithColor(OS, HighlightColor::String) << "text";
39 WithColor(raw_ostream &OS, HighlightColor S);
42 raw_ostream &get() { return OS; }
43 operator raw_ostream &() { return OS; }
45 /// Convenience method for printing "error: " to stderr.
46 static raw_ostream &error();
48 /// Convenience method for printing "warning: " to stderr.
49 static raw_ostream &warning();
51 /// Convenience method for printing "note: " to stderr.
52 static raw_ostream ¬e();
55 } // end namespace llvm
57 #endif // LLVM_LIB_DEBUGINFO_WITHCOLOR_H