summaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/raw_ostream.h
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-06 08:20:29 +0000
committered <ed@FreeBSD.org>2009-06-06 08:20:29 +0000
commit2361a5c2bfbaef476824e51fa72712e334219c7b (patch)
tree8a1bbd1a5b838080d31e5c93a1817006b8c62318 /include/llvm/Support/raw_ostream.h
parent1941b8772a36a33c7b86cb67163cd735b3d57221 (diff)
downloadFreeBSD-src-2361a5c2bfbaef476824e51fa72712e334219c7b.zip
FreeBSD-src-2361a5c2bfbaef476824e51fa72712e334219c7b.tar.gz
Import LLVM, at r72995.
We should now have support for #pragma weak.
Diffstat (limited to 'include/llvm/Support/raw_ostream.h')
-rw-r--r--include/llvm/Support/raw_ostream.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
index b67d126..8242f04 100644
--- a/include/llvm/Support/raw_ostream.h
+++ b/include/llvm/Support/raw_ostream.h
@@ -45,6 +45,19 @@ private:
bool Unbuffered;
public:
+ // color order matches ANSI escape sequence, don't change
+ enum Colors {
+ BLACK=0,
+ RED,
+ GREEN,
+ YELLOW,
+ BLUE,
+ MAGENTA,
+ CYAN,
+ WHITE,
+ SAVEDCOLOR
+ };
+
explicit raw_ostream(bool unbuffered=false) : Unbuffered(unbuffered) {
// Start out ready to flush.
OutBufStart = OutBufEnd = OutBufCur = 0;
@@ -167,6 +180,20 @@ public:
// Formatted output, see the format() function in Support/Format.h.
raw_ostream &operator<<(const format_object_base &Fmt);
+ /// Changes the foreground color of text that will be output from this point
+ /// forward.
+ /// @param colors ANSI color to use, the special SAVEDCOLOR can be used to
+ /// change only the bold attribute, and keep colors untouched
+ /// @param bold bold/brighter text, default false
+ /// @param bg if true change the background, default: change foreground
+ /// @returns itself so it can be used within << invocations
+ virtual raw_ostream &changeColor(enum Colors colors, bool bold=false,
+ bool bg=false) { return *this; }
+
+ /// Resets the colors to terminal defaults. Call this when you are done
+ /// outputting colored text, or before program exit.
+ virtual raw_ostream &resetColor() { return *this; }
+
//===--------------------------------------------------------------------===//
// Subclass Interface
//===--------------------------------------------------------------------===//
@@ -243,6 +270,10 @@ public:
/// seek - Flushes the stream and repositions the underlying file descriptor
/// positition to the offset specified from the beginning of the file.
uint64_t seek(uint64_t off);
+
+ virtual raw_ostream &changeColor(enum Colors colors, bool bold=false,
+ bool bg=false);
+ virtual raw_ostream &resetColor();
};
/// raw_stdout_ostream - This is a stream that always prints to stdout.
OpenPOWER on IntegriCloud