diff options
author | Mehdi Amini <joker.eph@gmail.com> | 2021-07-16 03:46:22 +0000 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2021-07-16 03:46:53 +0000 |
commit | 16b5e9d6a269913e8da0fa037e8af32eaf304c8f (patch) | |
tree | 2029314f1156239954ae10c5eb6748a303fdfc14 /llvm/lib/Support/Timer.cpp | |
parent | 42f588f39c5ce6f521e3709b8871d1fdd076292f (diff) | |
download | llvm-16b5e9d6a269913e8da0fa037e8af32eaf304c8f.zip llvm-16b5e9d6a269913e8da0fa037e8af32eaf304c8f.tar.gz llvm-16b5e9d6a269913e8da0fa037e8af32eaf304c8f.tar.bz2 |
Revert "Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer"
This reverts commit 42f588f39c5ce6f521e3709b8871d1fdd076292f.
Broke some buildbots
Diffstat (limited to 'llvm/lib/Support/Timer.cpp')
-rw-r--r-- | llvm/lib/Support/Timer.cpp | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp index f025ecd..8d421db 100644 --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -11,9 +11,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Timer.h" - -#include "DebugOptions.h" - #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringMap.h" #include "llvm/Config/config.h" @@ -56,41 +53,20 @@ static ManagedStatic<sys::SmartMutex<true> > TimerLock; static ManagedStatic<SignpostEmitter> Signposts; namespace { -struct CreateTrackSpace { - static void *call() { - return new cl::opt<bool>("track-memory", - cl::desc("Enable -time-passes memory " + static cl::opt<bool> + TrackSpace("track-memory", cl::desc("Enable -time-passes memory " "tracking (this may be slow)"), - cl::Hidden); - } -}; -static ManagedStatic<cl::opt<bool>, CreateTrackSpace> TrackSpace; -struct CreateInfoOutputFilename { - static void *call() { - return new cl::opt<std::string, true>( - "info-output-file", cl::value_desc("filename"), - cl::desc("File to append -stats and -timer output to"), cl::Hidden, - cl::location(getLibSupportInfoOutputFilename())); - } -}; -static ManagedStatic<cl::opt<std::string, true>, CreateInfoOutputFilename> - InfoOutputFilename; -struct CreateSortTimers { - static void *call() { - return new cl::opt<bool>( - "sort-timers", - cl::desc("In the report, sort the timers in each group " - "in wall clock time order"), - cl::init(true), cl::Hidden); - } -}; -ManagedStatic<cl::opt<bool>, CreateSortTimers> SortTimers; -} // namespace + cl::Hidden); + + static cl::opt<std::string, true> + InfoOutputFilename("info-output-file", cl::value_desc("filename"), + cl::desc("File to append -stats and -timer output to"), + cl::Hidden, cl::location(getLibSupportInfoOutputFilename())); -void llvm::initTimerOptions() { - *TrackSpace; - *InfoOutputFilename; - *SortTimers; + static cl::opt<bool> + SortTimers("sort-timers", cl::desc("In the report, sort the timers in each group " + "in wall clock time order"), + cl::init(true), cl::Hidden); } std::unique_ptr<raw_fd_ostream> llvm::CreateInfoOutputFile() { @@ -149,8 +125,7 @@ Timer::~Timer() { } static inline size_t getMemUsage() { - if (!*TrackSpace) - return 0; + if (!TrackSpace) return 0; return sys::Process::GetMallocUsage(); } @@ -356,7 +331,7 @@ void TimerGroup::addTimer(Timer &T) { void TimerGroup::PrintQueuedTimers(raw_ostream &OS) { // Perhaps sort the timers in descending order by amount of time taken. - if (*SortTimers) + if (SortTimers) llvm::sort(TimersToPrint); TimeRecord Total; |