From 246de858e37a989a9cdf9b80d7434453b2c52e70 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 16 Apr 2012 08:56:50 +0000 Subject: Reapply 'Add reverseColor to raw_ostream'. To be used in printing unprintable source in clang diagnostics. Patch by Seth Cantrell, with a minor fix for mingw by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154805 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Process.h | 4 ++++ include/llvm/Support/raw_ostream.h | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'include/llvm') diff --git a/include/llvm/Support/Process.h b/include/llvm/Support/Process.h index 3379922..d796b79 100644 --- a/include/llvm/Support/Process.h +++ b/include/llvm/Support/Process.h @@ -136,6 +136,10 @@ namespace sys { /// Same as OutputColor, but only enables the bold attribute. static const char *OutputBold(bool bg); + /// This function returns the escape sequence to reverse forground and + /// background colors. + static const char *OutputReverse(); + /// Resets the terminals colors, or returns an escape sequence to do so. static const char *ResetColor(); /// @} diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index 6bfae5e..6c5d478 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -222,6 +222,9 @@ public: /// outputting colored text, or before program exit. virtual raw_ostream &resetColor() { return *this; } + /// Reverses the forground and background colors. + virtual raw_ostream &reverseColor() { return *this; } + /// This function determines if this stream is connected to a "tty" or /// "console" window. That is, the output would be displayed to the user /// rather than being put on a pipe or stored in a file. @@ -379,6 +382,8 @@ public: bool bg=false); virtual raw_ostream &resetColor(); + virtual raw_ostream &reverseColor(); + virtual bool is_displayed() const; /// has_error - Return the value of the flag in this raw_fd_ostream indicating -- cgit v1.1