mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
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
This commit is contained in:
@@ -633,6 +633,19 @@ 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user