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/DebugCounter.cpp | |
parent | b61bce17f346d79cecfd8f195a64b10f77be43b1 (diff) | |
parent | 344a3780b2e33f6ca763666c380202b18aab72a3 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/DebugCounter.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Support/DebugCounter.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/DebugCounter.cpp b/contrib/llvm-project/llvm/lib/Support/DebugCounter.cpp index 7bb231c79239..f553463be8df 100644 --- a/contrib/llvm-project/llvm/lib/Support/DebugCounter.cpp +++ b/contrib/llvm-project/llvm/lib/Support/DebugCounter.cpp @@ -1,4 +1,7 @@ #include "llvm/Support/DebugCounter.h" + +#include "DebugOptions.h" + #include "llvm/Support/CommandLine.h" #include "llvm/Support/Format.h" #include "llvm/Support/ManagedStatic.h" @@ -40,17 +43,29 @@ private: } } }; + +struct CreateDebugCounterOption { + static void *call() { + return new DebugCounterList( + "debug-counter", cl::Hidden, + cl::desc("Comma separated list of debug counter skip and count"), + cl::CommaSeparated, cl::ZeroOrMore, + cl::location(DebugCounter::instance())); + } +}; } // namespace -// Create our command line option. -static DebugCounterList DebugCounterOption( - "debug-counter", cl::Hidden, - cl::desc("Comma separated list of debug counter skip and count"), - cl::CommaSeparated, cl::ZeroOrMore, cl::location(DebugCounter::instance())); +static ManagedStatic<DebugCounterList, CreateDebugCounterOption> + DebugCounterOption; +static bool PrintDebugCounter; -static cl::opt<bool> PrintDebugCounter( - "print-debug-counter", cl::Hidden, cl::init(false), cl::Optional, - cl::desc("Print out debug counter info after all counters accumulated")); +void llvm::initDebugCounterOptions() { + *DebugCounterOption; + static cl::opt<bool, true> RegisterPrintDebugCounter( + "print-debug-counter", cl::Hidden, cl::location(PrintDebugCounter), + cl::init(false), cl::Optional, + cl::desc("Print out debug counter info after all counters accumulated")); +} static ManagedStatic<DebugCounter> DC; |