diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h --- a/llvm/include/llvm/Support/Timer.h +++ b/llvm/include/llvm/Support/Timer.h @@ -231,10 +231,10 @@ /// Prints all timers as JSON key/value pairs. static const char *printAllJSONValues(raw_ostream &OS, const char *delim); - /// Ensure global timer group lists are initialized. This function is mostly - /// used by the Statistic code to influence the construction and destruction - /// order of the global timer lists. - static void ConstructTimerLists(); + /// Ensure global objects required for statistics printing are initialized. + /// This function is used by the Statistic code to ensure correct order of + /// global constructors and destructors. + static void constructForStatistics(); /// This makes the default group unmanaged, and lets the user manage the /// group's lifetime. diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp --- a/llvm/lib/Support/Statistic.cpp +++ b/llvm/lib/Support/Statistic.cpp @@ -120,8 +120,9 @@ } StatisticInfo::StatisticInfo() { - // Ensure timergroup lists are created first so they are destructed after us. - TimerGroup::ConstructTimerLists(); + // Ensure that necessary timer global objects are created first so they are + // destructed after us. + TimerGroup::constructForStatistics(); } // Print information when destroyed, iff command line option is specified. diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -499,7 +499,8 @@ return delim; } -void TimerGroup::ConstructTimerLists() { +void TimerGroup::constructForStatistics() { + (void)getLibSupportInfoOutputFilename(); (void)*NamedGroupedTimers; }