From c9413c745bec9707064211bc5fd02cdfb153c92d Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 16 Apr 2012 07:59:39 +0000 Subject: [PATCH] Revert r154800 which breaks windows builders. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154802 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Process.h | 4 ---- include/llvm/Support/raw_ostream.h | 5 ----- lib/Support/Unix/Process.inc | 4 ---- lib/Support/Windows/Process.inc | 33 --------------------------------- lib/Support/raw_ostream.cpp | 13 ------------- 5 files changed, 59 deletions(-) diff --git a/include/llvm/Support/Process.h b/include/llvm/Support/Process.h index d796b7906d3..33799229ff3 100644 --- a/include/llvm/Support/Process.h +++ b/include/llvm/Support/Process.h @@ -136,10 +136,6 @@ 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 6c5d4787e0f..6bfae5e2982 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -222,9 +222,6 @@ 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. @@ -382,8 +379,6 @@ 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 diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index f640462a451..2d7fd384e8b 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -290,10 +290,6 @@ const char *Process::OutputBold(bool bg) { return "\033[1m"; } -const char *Process::OutputReverse() { - return "\033[7m"; -} - const char *Process::ResetColor() { return "\033[0m"; } diff --git a/lib/Support/Windows/Process.inc b/lib/Support/Windows/Process.inc index a61ce551706..913b0734ddc 100644 --- a/lib/Support/Windows/Process.inc +++ b/lib/Support/Windows/Process.inc @@ -215,39 +215,6 @@ const char *Process::OutputColor(char code, bool bold, bool bg) { return 0; } -WORD GetConsoleTextAttribute(__in HANDLE hConsoleOutput) -{ - CONSOLE_SCREEN_BUFFER_INFO info; - GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),&info); - return info.wAttributes; -} - -const char *Process::OutputReverse() { - const WORD attributes - = GetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE)); - - const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | - FOREGROUND_RED | FOREGROUND_INTENSITY; - const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | - BACKGROUND_RED | BACKGROUND_INTENSITY; - const WORD color_mask = foreground_mask | background_mask; - - WORD new_attributes = - ((attributes & FOREGROUND_BLUE )?BACKGROUND_BLUE :0) | - ((attributes & FOREGROUND_GREEN )?BACKGROUND_GREEN :0) | - ((attributes & FOREGROUND_RED )?BACKGROUND_RED :0) | - ((attributes & FOREGROUND_INTENSITY)?BACKGROUND_INTENSITY:0) | - ((attributes & BACKGROUND_BLUE )?FOREGROUND_BLUE :0) | - ((attributes & BACKGROUND_GREEN )?FOREGROUND_GREEN :0) | - ((attributes & BACKGROUND_RED )?FOREGROUND_RED :0) | - ((attributes & BACKGROUND_INTENSITY)?FOREGROUND_INTENSITY:0) | - 0; - new_attributes = (attributes & ~color_mask) | (new_attributes & color_mask); - - SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),new_attributes); - return 0; -} - const char *Process::ResetColor() { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), defaultColors()); return 0; diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 86cdca15727..72d3986f41d 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -633,19 +633,6 @@ raw_ostream &raw_fd_ostream::resetColor() { return *this; } -raw_ostream &raw_fd_ostream::reverseColor() { - if (sys::Process::ColorNeedsFlush()) - flush(); - const char *colorcode = sys::Process::OutputReverse(); - if (colorcode) { - size_t len = strlen(colorcode); - write(colorcode, len); - // don't account colors towards output characters - pos -= len; - } - return *this; -} - bool raw_fd_ostream::is_displayed() const { return sys::Process::FileDescriptorIsDisplayed(FD); } -- 2.11.0