@@ -185,25 +185,17 @@ class TimeTraceScope {
185
185
TimeTraceScope (TimeTraceScope &&) = delete ;
186
186
TimeTraceScope &operator =(TimeTraceScope &&) = delete ;
187
187
188
- TimeTraceScope (StringRef Name) {
189
- if (getTimeTraceProfilerInstance () != nullptr )
190
- Entry = timeTraceProfilerBegin (Name, StringRef (" " ));
191
- }
192
- TimeTraceScope (StringRef Name, StringRef Detail) {
193
- if (getTimeTraceProfilerInstance () != nullptr )
194
- Entry = timeTraceProfilerBegin (Name, Detail);
195
- }
196
- TimeTraceScope (StringRef Name, llvm::function_ref<std::string()> Detail) {
197
- if (getTimeTraceProfilerInstance () != nullptr )
198
- Entry = timeTraceProfilerBegin (Name, Detail);
199
- }
188
+ TimeTraceScope (StringRef Name)
189
+ : Entry(timeTraceProfilerBegin(Name, StringRef())) {}
190
+ TimeTraceScope (StringRef Name, StringRef Detail)
191
+ : Entry(timeTraceProfilerBegin(Name, Detail)) {}
192
+ TimeTraceScope (StringRef Name, llvm::function_ref<std::string()> Detail)
193
+ : Entry(timeTraceProfilerBegin(Name, Detail)) {}
200
194
TimeTraceScope (StringRef Name,
201
- llvm::function_ref<TimeTraceMetadata()> Metadata) {
202
- if (getTimeTraceProfilerInstance () != nullptr )
203
- Entry = timeTraceProfilerBegin (Name, Metadata);
204
- }
195
+ llvm::function_ref<TimeTraceMetadata()> Metadata)
196
+ : Entry(timeTraceProfilerBegin(Name, Metadata)) {}
205
197
~TimeTraceScope () {
206
- if (getTimeTraceProfilerInstance () != nullptr )
198
+ if (Entry )
207
199
timeTraceProfilerEnd (Entry);
208
200
}
209
201
0 commit comments