[clang] [llvm] [llvm][NFC] Rework Timer.cpp globals to ensure valid lifetimes (PR #121663)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 09:29:40 PST 2025
================
@@ -115,22 +92,12 @@ std::unique_ptr<raw_ostream> llvm::CreateInfoOutputFile() {
return std::make_unique<raw_fd_ostream>(2, false); // stderr.
}
-namespace {
-struct CreateDefaultTimerGroup {
- static void *call() {
- return new TimerGroup("misc", "Miscellaneous Ungrouped Timers");
- }
-};
-} // namespace
-static ManagedStatic<TimerGroup, CreateDefaultTimerGroup> DefaultTimerGroup;
-static TimerGroup *getDefaultTimerGroup() { return &*DefaultTimerGroup; }
-
//===----------------------------------------------------------------------===//
// Timer Implementation
//===----------------------------------------------------------------------===//
void Timer::init(StringRef TimerName, StringRef TimerDescription) {
- init(TimerName, TimerDescription, *getDefaultTimerGroup());
----------------
MaskRay wrote:
I think we need to restore the access to ManagedStatic::claim. Done by #122429
https://github.com/llvm/llvm-project/pull/121663
More information about the llvm-commits
mailing list