From 5391ffb671d16003d8efb0a65b4a8f156f9f02bc Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 27 Sep 2016 19:38:55 +0000 Subject: Statistic: Bring back printing on exit by default Turns out several external projects relied on llvm printing statistics on exit. Let's go back to this behaviour by default and have an optional parameter to disable it. llvm-svn: 282532 --- llvm/lib/Support/Statistic.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/Statistic.cpp') diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp index 774778143c2..d299bfcae46 100644 --- a/llvm/lib/Support/Statistic.cpp +++ b/llvm/lib/Support/Statistic.cpp @@ -45,6 +45,7 @@ static cl::opt StatsAsJSON("stats-json", cl::desc("Display statistics as json data")); static bool Enabled; +static bool PrintOnExit; namespace { /// StatisticInfo - This class is used in a ManagedStatic so that it is created @@ -91,12 +92,13 @@ void Statistic::RegisterStatistic() { // Print information when destroyed, iff command line option is specified. StatisticInfo::~StatisticInfo() { - if (::Stats) + if (::Stats || PrintOnExit) llvm::PrintStatistics(); } -void llvm::EnableStatistics() { +void llvm::EnableStatistics(bool PrintOnExit) { Enabled = true; + ::PrintOnExit = PrintOnExit; } bool llvm::AreStatisticsEnabled() { -- cgit v1.2.3