@@ -495,27 +495,17 @@ class llvm::TimerGlobals {
495495 TimerLock};
496496 SignpostEmitter Signposts;
497497
498- private:
499498 // Order of these members and initialization below is important. For example
500499 // the defaultTimerGroup uses the timerLock. Most of these also depend on the
501500 // options above.
502501 std::once_flag InitDeferredFlag;
503502 std::optional<Name2PairMap> NamedGroupedTimersPtr;
503+
504504 TimerGlobals &initDeferred () {
505505 std::call_once (InitDeferredFlag,
506506 [this ]() { NamedGroupedTimersPtr.emplace (); });
507507 return *this ;
508508 }
509-
510- public:
511- SignpostEmitter &signposts () { return Signposts; }
512- sys::SmartMutex<true > &timerLock () { return TimerLock; }
513- TimerGroup &defaultTimerGroup () { return DefaultTimerGroup; }
514- Name2PairMap &namedGroupedTimers () {
515- return *initDeferred ().NamedGroupedTimersPtr ;
516- }
517-
518- public:
519509 TimerGlobals ()
520510 : InfoOutputFilename(
521511 " info-output-file" , cl::value_desc(" filename" ),
@@ -540,15 +530,15 @@ static std::string &libSupportInfoOutputFilename() {
540530}
541531static bool trackSpace () { return ManagedTimerGlobals->TrackSpace ; }
542532static bool sortTimers () { return ManagedTimerGlobals->SortTimers ; }
543- static SignpostEmitter &signposts () { return ManagedTimerGlobals->signposts () ; }
533+ static SignpostEmitter &signposts () { return ManagedTimerGlobals->Signposts ; }
544534static sys::SmartMutex<true > &timerLock () {
545- return ManagedTimerGlobals->timerLock () ;
535+ return ManagedTimerGlobals->TimerLock ;
546536}
547537static TimerGroup &defaultTimerGroup () {
548- return ManagedTimerGlobals->defaultTimerGroup () ;
538+ return ManagedTimerGlobals->DefaultTimerGroup ;
549539}
550540static Name2PairMap &namedGroupedTimers () {
551- return ManagedTimerGlobals->namedGroupedTimers () ;
541+ return * ManagedTimerGlobals->initDeferred (). NamedGroupedTimersPtr ;
552542}
553543
554544void llvm::initTimerOptions () { *ManagedTimerGlobals; }
0 commit comments