5 //===----------------------------------------------------------------------===//
7 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8 // See https://llvm.org/LICENSE.txt for license information.
9 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //===----------------------------------------------------------------------===//
30 inline std::ostream
&operator<<(std::ostream
&os
, Code code
) {
31 return os
<< "\033[" << static_cast<int>(code
) << "m";
33 } // namespace GdbColor
41 ColorOut(std::ostream
&_out
, GdbColor::Code _color
)
42 : out(_out
), color(_color
) {}
43 template <typename T
> const ColorOut
&operator<<(const T
&val
) const {
44 out
<< color
<< val
<< GdbColor::FG_DEFAULT
;
47 const ColorOut
&operator<<(std::ostream
&(*pf
)(std::ostream
&)) const {
48 out
<< color
<< pf
<< GdbColor::FG_DEFAULT
;
53 static ColorOut
dout(std::cout
, GdbColor::FG_RED
);
54 static ColorOut
sout(std::cout
, GdbColor::FG_GREEN
);
55 static ColorOut
hout(std::cout
, GdbColor::FG_BLUE
);
57 #endif /*GDB_DEBUG_H_*/