From: Douglas Gregor Date: Thu, 28 Jan 2010 06:42:08 +0000 (+0000) Subject: Add llvm::Program::ChangeStderrToBinary(). X-Git-Tag: android-x86-6.0-r1~1003^2~10425 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=21569cddc1a9df3bf4a3c9e06977273f1eba3e63;p=android-x86%2Fexternal-llvm.git Add llvm::Program::ChangeStderrToBinary(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94743 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/System/Program.h b/include/llvm/System/Program.h index 67995627260..69ce47892e1 100644 --- a/include/llvm/System/Program.h +++ b/include/llvm/System/Program.h @@ -120,10 +120,12 @@ namespace sys { /// @brief Construct a Program by finding it by name. static Path FindProgramByName(const std::string& name); - // These methods change the specified standard stream (stdin or stdout) to - // binary mode. They return true if an error occurred + // These methods change the specified standard stream (stdin, + // stdout, or stderr) to binary mode. They return true if an error + // occurred static bool ChangeStdinToBinary(); static bool ChangeStdoutToBinary(); + static bool ChangeStderrToBinary(); /// A convenience function equivalent to Program prg; prg.Execute(..); /// prg.Wait(..); diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 43c3606d983..e8c28062478 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -323,4 +323,9 @@ bool Program::ChangeStdoutToBinary(){ return false; } +bool Program::ChangeStderrToBinary(){ + // Do nothing, as Unix doesn't differentiate between text and binary. + return false; +} + } diff --git a/lib/System/Win32/Program.inc b/lib/System/Win32/Program.inc index a69826fdcef..a3b40d0e365 100644 --- a/lib/System/Win32/Program.inc +++ b/lib/System/Win32/Program.inc @@ -379,4 +379,9 @@ bool Program::ChangeStdoutToBinary(){ return result == -1; } +bool Program::ChangeStderrToBinary(){ + int result = _setmode( _fileno(stderr), _O_BINARY ); + return result == -1; +} + }