2017-03-01 01:14:23 +00:00
|
|
|
//===- SyntaxHighlighting.h -------------------------------------*- C++ -*-===//
|
2015-01-06 16:50:25 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_DEBUGINFO_SYNTAXHIGHLIGHTING_H
|
|
|
|
#define LLVM_LIB_DEBUGINFO_SYNTAXHIGHLIGHTING_H
|
|
|
|
|
|
|
|
namespace llvm {
|
2017-03-01 01:14:23 +00:00
|
|
|
|
|
|
|
class raw_ostream;
|
|
|
|
|
2015-01-06 16:50:25 +00:00
|
|
|
namespace dwarf {
|
|
|
|
namespace syntax {
|
|
|
|
|
|
|
|
// Symbolic names for various syntax elements.
|
2017-09-29 09:33:31 +00:00
|
|
|
enum HighlightColor {
|
|
|
|
Address,
|
|
|
|
String,
|
|
|
|
Tag,
|
|
|
|
Attribute,
|
|
|
|
Enumerator,
|
|
|
|
Macro,
|
|
|
|
Error,
|
|
|
|
Warning,
|
|
|
|
Note
|
|
|
|
};
|
2015-01-06 16:50:25 +00:00
|
|
|
|
|
|
|
/// An RAII object that temporarily switches an output stream to a
|
|
|
|
/// specific color.
|
|
|
|
class WithColor {
|
2017-03-01 01:14:23 +00:00
|
|
|
raw_ostream &OS;
|
2015-01-06 16:50:25 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/// To be used like this: WithColor(OS, syntax::String) << "text";
|
2017-03-01 01:14:23 +00:00
|
|
|
WithColor(raw_ostream &OS, enum HighlightColor Type);
|
2015-01-06 16:50:25 +00:00
|
|
|
~WithColor();
|
|
|
|
|
2017-09-29 09:33:31 +00:00
|
|
|
raw_ostream &get() { return OS; }
|
|
|
|
operator raw_ostream &() { return OS; }
|
2015-01-06 16:50:25 +00:00
|
|
|
};
|
|
|
|
|
2017-03-01 01:14:23 +00:00
|
|
|
} // end namespace syntax
|
|
|
|
} // end namespace dwarf
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif // LLVM_LIB_DEBUGINFO_SYNTAXHIGHLIGHTING_H
|