diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-08-22 19:00:43 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-11-13 20:39:49 +0000 |
| commit | fe6060f10f634930ff71b7c50291ddc610da2475 (patch) | |
| tree | 1483580c790bd4d27b6500a7542b5ee00534d3cc /contrib/llvm-project/llvm/lib/Support/Statistic.cpp | |
| parent | b61bce17f346d79cecfd8f195a64b10f77be43b1 (diff) | |
| parent | 344a3780b2e33f6ca763666c380202b18aab72a3 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/Statistic.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Support/Statistic.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/Statistic.cpp b/contrib/llvm-project/llvm/lib/Support/Statistic.cpp index e9308ab575ab..d95c8642c16e 100644 --- a/contrib/llvm-project/llvm/lib/Support/Statistic.cpp +++ b/contrib/llvm-project/llvm/lib/Support/Statistic.cpp @@ -21,6 +21,9 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/Statistic.h" + +#include "DebugOptions.h" + #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" @@ -38,18 +41,22 @@ using namespace llvm; /// -stats - Command line option to cause transformations to emit stats about /// what they did. /// -static cl::opt<bool> EnableStats( - "stats", - cl::desc("Enable statistics output from program (available with Asserts)"), - cl::Hidden); - -static cl::opt<bool> StatsAsJSON("stats-json", - cl::desc("Display statistics as json data"), - cl::Hidden); - +static bool EnableStats; +static bool StatsAsJSON; static bool Enabled; static bool PrintOnExit; +void llvm::initStatisticOptions() { + static cl::opt<bool, true> registerEnableStats{ + "stats", + cl::desc( + "Enable statistics output from program (available with Asserts)"), + cl::location(EnableStats), cl::Hidden}; + static cl::opt<bool, true> registerStatsAsJson{ + "stats-json", cl::desc("Display statistics as json data"), + cl::location(StatsAsJSON), cl::Hidden}; +} + namespace { /// This class is used in a ManagedStatic so that it is created on demand (when /// the first statistic is bumped) and destroyed only when llvm_shutdown is @@ -128,9 +135,7 @@ void llvm::EnableStatistics(bool DoPrintOnExit) { PrintOnExit = DoPrintOnExit; } -bool llvm::AreStatisticsEnabled() { - return Enabled || EnableStats; -} +bool llvm::AreStatisticsEnabled() { return Enabled || EnableStats; } void StatisticInfo::sort() { llvm::stable_sort( |
