X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FSupport%2FStatistic.cpp;h=e49d1cbe06377ee19e5fae846a7382fca4b9b419;hp=ee6c1305cdbe526473b0946c23168b6a6152b67a;hb=df7186636e51e63281bd318234b7d97f25efe491;hpb=411b15e22ebc30c3988d4dbf45a818eedf606cb4 diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp index ee6c1305cdb..e49d1cbe063 100644 --- a/lib/Support/Statistic.cpp +++ b/lib/Support/Statistic.cpp @@ -34,9 +34,6 @@ #include using namespace llvm; -// CreateInfoOutputFile - Return a file stream to print our output on. -namespace llvm { extern raw_ostream *CreateInfoOutputFile(); } - /// -stats - Command line option to cause transformations to emit stats about /// what they did. /// @@ -145,20 +142,18 @@ void llvm::PrintStatistics() { if (Stats.Stats.empty()) return; // Get the stream to write to. - raw_ostream &OutStream = *CreateInfoOutputFile(); - PrintStatistics(OutStream); - delete &OutStream; // Close the file. + std::unique_ptr OutStream = CreateInfoOutputFile(); + PrintStatistics(*OutStream); + #else // Check if the -stats option is set instead of checking // !Stats.Stats.empty(). In release builds, Statistics operators // do nothing, so stats are never Registered. if (Enabled) { // Get the stream to write to. - raw_ostream &OutStream = *CreateInfoOutputFile(); - OutStream << "Statistics are disabled. " - << "Build with asserts or with -DLLVM_ENABLE_STATS\n"; - OutStream.flush(); - delete &OutStream; // Close the file. + std::unique_ptr OutStream = CreateInfoOutputFile(); + (*OutStream) << "Statistics are disabled. " + << "Build with asserts or with -DLLVM_ENABLE_STATS\n"; } #endif }