LLVM  6.0.0svn
SyntaxHighlighting.h
Go to the documentation of this file.
1 //===- SyntaxHighlighting.h -------------------------------------*- 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 #ifndef LLVM_LIB_DEBUGINFO_SYNTAXHIGHLIGHTING_H
11 #define LLVM_LIB_DEBUGINFO_SYNTAXHIGHLIGHTING_H
12 
13 namespace llvm {
14 
15 class raw_ostream;
16 
17 namespace dwarf {
18 namespace syntax {
19 
20 // Symbolic names for various syntax elements.
24  Tag,
31 };
32 
33 /// An RAII object that temporarily switches an output stream to a
34 /// specific color.
35 class WithColor {
36  raw_ostream &OS;
37 
38 public:
39  /// To be used like this: WithColor(OS, syntax::String) << "text";
41  ~WithColor();
42 
43  raw_ostream &get() { return OS; }
44  operator raw_ostream &() { return OS; }
45 };
46 
47 } // end namespace syntax
48 } // end namespace dwarf
49 
50 } // end namespace llvm
51 
52 #endif // LLVM_LIB_DEBUGINFO_SYNTAXHIGHLIGHTING_H
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
WithColor(raw_ostream &OS, enum HighlightColor Type)
To be used like this: WithColor(OS, syntax::String) << "text";.
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
An RAII object that temporarily switches an output stream to a specific color.