mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
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
This commit is contained in:
parent
9f9f6d19dd
commit
49a2bb23d1
@ -32,8 +32,8 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
|
// CreateInfoOutputFile - Return a file stream to print our output on.
|
||||||
namespace llvm { extern raw_ostream *GetLibSupportInfoOutputFile(); }
|
namespace llvm { extern raw_ostream *CreateInfoOutputFile(); }
|
||||||
|
|
||||||
/// -stats - Command line option to cause transformations to emit stats about
|
/// -stats - Command line option to cause transformations to emit stats about
|
||||||
/// what they did.
|
/// what they did.
|
||||||
@ -96,7 +96,7 @@ StatisticInfo::~StatisticInfo() {
|
|||||||
if (Stats.empty()) return;
|
if (Stats.empty()) return;
|
||||||
|
|
||||||
// Get the stream to write to.
|
// Get the stream to write to.
|
||||||
raw_ostream &OutStream = *GetLibSupportInfoOutputFile();
|
raw_ostream &OutStream = *CreateInfoOutputFile();
|
||||||
|
|
||||||
// Figure out how long the biggest Value and Name fields are.
|
// Figure out how long the biggest Value and Name fields are.
|
||||||
unsigned MaxNameLen = 0, MaxValLen = 0;
|
unsigned MaxNameLen = 0, MaxValLen = 0;
|
||||||
@ -125,9 +125,8 @@ StatisticInfo::~StatisticInfo() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStream << '\n'; // Flush the output stream...
|
OutStream << '\n'; // Flush the output stream.
|
||||||
OutStream.flush();
|
OutStream.flush();
|
||||||
|
|
||||||
if (&OutStream != &outs() && &OutStream != &errs())
|
delete &OutStream; // Close the file.
|
||||||
delete &OutStream; // Close the file.
|
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include "llvm/ADT/StringMap.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
|
// CreateInfoOutputFile - Return a file stream to print our output on.
|
||||||
namespace llvm { extern raw_ostream *GetLibSupportInfoOutputFile(); }
|
namespace llvm { extern raw_ostream *CreateInfoOutputFile(); }
|
||||||
|
|
||||||
// getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy
|
// getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy
|
||||||
// of constructor/destructor ordering being unspecified by C++. Basically the
|
// of constructor/destructor ordering being unspecified by C++. Basically the
|
||||||
@ -52,13 +52,13 @@ namespace {
|
|||||||
cl::Hidden, cl::location(getLibSupportInfoOutputFilename()));
|
cl::Hidden, cl::location(getLibSupportInfoOutputFilename()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLibSupportInfoOutputFile - Return a file stream to print our output on.
|
// CreateInfoOutputFile - Return a file stream to print our output on.
|
||||||
raw_ostream *llvm::GetLibSupportInfoOutputFile() {
|
raw_ostream *llvm::CreateInfoOutputFile() {
|
||||||
std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
|
std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
|
||||||
if (LibSupportInfoOutputFilename.empty())
|
if (LibSupportInfoOutputFilename.empty())
|
||||||
return &errs();
|
return new raw_fd_ostream(2, false); // stderr.
|
||||||
if (LibSupportInfoOutputFilename == "-")
|
if (LibSupportInfoOutputFilename == "-")
|
||||||
return &outs();
|
return new raw_fd_ostream(1, false); // stdout.
|
||||||
|
|
||||||
std::string Error;
|
std::string Error;
|
||||||
raw_ostream *Result = new raw_fd_ostream(LibSupportInfoOutputFilename.c_str(),
|
raw_ostream *Result = new raw_fd_ostream(LibSupportInfoOutputFilename.c_str(),
|
||||||
@ -69,7 +69,7 @@ raw_ostream *llvm::GetLibSupportInfoOutputFile() {
|
|||||||
errs() << "Error opening info-output-file '"
|
errs() << "Error opening info-output-file '"
|
||||||
<< LibSupportInfoOutputFilename << " for appending!\n";
|
<< LibSupportInfoOutputFilename << " for appending!\n";
|
||||||
delete Result;
|
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())
|
if (FirstTimer != 0 || TimersToPrint.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
raw_ostream *OutStream = GetLibSupportInfoOutputFile();
|
raw_ostream *OutStream = CreateInfoOutputFile();
|
||||||
|
|
||||||
PrintQueuedTimers(*OutStream);
|
PrintQueuedTimers(*OutStream);
|
||||||
|
delete OutStream; // Close the file.
|
||||||
if (OutStream != &errs() && OutStream != &outs())
|
|
||||||
delete OutStream; // Close the file.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimerGroup::addTimer(Timer &T) {
|
void TimerGroup::addTimer(Timer &T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user