summaryrefslogtreecommitdiff
path: root/include/llvm/System/Process.h
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-06-04 07:09:50 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-06-04 07:09:50 +0000
commite8ebb0fe1bba0fdff7475d98e1f8a04804b0b056 (patch)
treee95ec82d472d32e37882e836f167990a044b8bbd /include/llvm/System/Process.h
parentbccf4b3050907b61b9d5349601269a0474b4c0fd (diff)
downloadllvm-e8ebb0fe1bba0fdff7475d98e1f8a04804b0b056.tar.gz
llvm-e8ebb0fe1bba0fdff7475d98e1f8a04804b0b056.tar.bz2
llvm-e8ebb0fe1bba0fdff7475d98e1f8a04804b0b056.tar.xz
Add support for outputting ANSI colors to raw_fd_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72854 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/System/Process.h')
-rw-r--r--include/llvm/System/Process.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/llvm/System/Process.h b/include/llvm/System/Process.h
index ce19eb2981..adc1f03deb 100644
--- a/include/llvm/System/Process.h
+++ b/include/llvm/System/Process.h
@@ -107,6 +107,35 @@ namespace sys {
/// console, or if the number of columns cannot be determined,
/// this routine returns zero.
static unsigned StandardErrColumns();
+
+ /// This function determines whether the terminal connected to standard
+ /// output supports colors. If standard output is not connected to a
+ /// terminal, this function returns false.
+ static bool StandardOutHasColors();
+
+ /// This function determines whether the terminal connected to standard
+ /// error supports colors. If standard error is not connected to a
+ /// terminal, this function returns false.
+ static bool StandardErrHasColors();
+
+ /// Whether changing colors requires the output to be flushed.
+ /// This is needed on systems that don't support escape sequences for
+ /// changing colors.
+ static bool ColorNeedsFlush();
+
+ /// This function returns the colorcode escape sequences, and sets Len to
+ /// the length of the escape sequence.
+ /// If ColorNeedsFlush() is true then this function will change the colors
+ /// and return an empty escape sequence. In that case it is the
+ /// responsibility of the client to flush the output stream prior to
+ /// calling this function.
+ static const char *OutputColor(char c, bool bold, bool bg);
+
+ /// Same as OutputColor, but only enables the bold attribute.
+ static const char *OutputBold(bool bg);
+
+ /// Resets the terminals colors, or returns an escape sequence to do so.
+ static const char *ResetColor();
/// @}
};
}