Skip to content

Commit 4500df2

Browse files
committed
[llvm][NFC] Rework Timer.cpp globals to ensure valid lifetimes
1 parent c19e0d6 commit 4500df2

File tree

2 files changed

+166
-88
lines changed

2 files changed

+166
-88
lines changed

llvm/include/llvm/Support/Timer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
#include "llvm/ADT/StringMap.h"
1313
#include "llvm/ADT/StringRef.h"
1414
#include "llvm/Support/DataTypes.h"
15+
#include "llvm/Support/Mutex.h"
1516
#include <cassert>
1617
#include <memory>
1718
#include <string>
1819
#include <vector>
1920

2021
namespace llvm {
2122

23+
class TimerGlobals;
2224
class TimerGroup;
2325
class raw_ostream;
2426

@@ -196,6 +198,10 @@ class TimerGroup {
196198
TimerGroup(const TimerGroup &TG) = delete;
197199
void operator=(const TimerGroup &TG) = delete;
198200

201+
friend class TimerGlobals;
202+
explicit TimerGroup(StringRef Name, StringRef Description,
203+
sys::SmartMutex<true> &lock);
204+
199205
public:
200206
explicit TimerGroup(StringRef Name, StringRef Description);
201207

0 commit comments

Comments
 (0)