diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-30 05:01:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-30 05:01:08 +0000 |
commit | 49a2bb23d1391c8be45985518d4c5e99ff11b864 (patch) | |
tree | 4d82da3bf6130ae2a0bd7ca077e4db5fcfce1f40 /lib/Support/Timer.cpp | |
parent | 9f9f6d19dd67926446fb89a7b2dc0bda6353645b (diff) |
rename GetLibSupportInfoOutputFile -> CreateInfoOutputFile and
have it always return a new stream to simplify clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99874 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Timer.cpp')
-rw-r--r-- | lib/Support/Timer.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp index daafd63dd2..c0bc750d59 100644 --- a/lib/Support/Timer.cpp +++ b/lib/Support/Timer.cpp @@ -22,8 +22,8 @@ #include "llvm/ADT/StringMap.h" using namespace llvm; -// GetLibSupportInfoOutputFile - Return a file stream to print our output on. -namespace llvm { extern raw_ostream *GetLibSupportInfoOutputFile(); } +// CreateInfoOutputFile - Return a file stream to print our output on. +namespace llvm { extern raw_ostream *CreateInfoOutputFile(); } // getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy // of constructor/destructor ordering being unspecified by C++. Basically the @@ -52,13 +52,13 @@ namespace { cl::Hidden, cl::location(getLibSupportInfoOutputFilename())); } -// GetLibSupportInfoOutputFile - Return a file stream to print our output on. -raw_ostream *llvm::GetLibSupportInfoOutputFile() { +// CreateInfoOutputFile - Return a file stream to print our output on. +raw_ostream *llvm::CreateInfoOutputFile() { std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename(); if (LibSupportInfoOutputFilename.empty()) - return &errs(); + return new raw_fd_ostream(2, false); // stderr. if (LibSupportInfoOutputFilename == "-") - return &outs(); + return new raw_fd_ostream(1, false); // stdout. std::string Error; raw_ostream *Result = new raw_fd_ostream(LibSupportInfoOutputFilename.c_str(), @@ -69,7 +69,7 @@ raw_ostream *llvm::GetLibSupportInfoOutputFile() { errs() << "Error opening info-output-file '" << LibSupportInfoOutputFilename << " for appending!\n"; delete Result; - return &errs(); + return new raw_fd_ostream(2, false); // stderr. } @@ -264,12 +264,9 @@ void TimerGroup::removeTimer(Timer &T) { if (FirstTimer != 0 || TimersToPrint.empty()) return; - raw_ostream *OutStream = GetLibSupportInfoOutputFile(); - + raw_ostream *OutStream = CreateInfoOutputFile(); PrintQueuedTimers(*OutStream); - - if (OutStream != &errs() && OutStream != &outs()) - delete OutStream; // Close the file. + delete OutStream; // Close the file. } void TimerGroup::addTimer(Timer &T) { |