Skip to content

Commit e61cf0e

Browse files
committed
Use timeTraceAsyncProfilerBegin for Source span
1 parent 631248d commit e61cf0e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang/lib/Sema/Sema.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ namespace sema {
135135
class SemaPPCallbacks : public PPCallbacks {
136136
Sema *S = nullptr;
137137
llvm::SmallVector<SourceLocation, 8> IncludeStack;
138+
llvm::SmallVector<llvm::TimeTraceProfilerEntry *, 8> ProfilerStack;
138139

139140
public:
140141
void set(Sema &S) { this->S = &S; }
@@ -153,8 +154,8 @@ class SemaPPCallbacks : public PPCallbacks {
153154
if (IncludeLoc.isValid()) {
154155
if (llvm::timeTraceProfilerEnabled()) {
155156
OptionalFileEntryRef FE = SM.getFileEntryRefForID(SM.getFileID(Loc));
156-
llvm::timeTraceProfilerBegin("Source", FE ? FE->getName()
157-
: StringRef("<unknown>"));
157+
ProfilerStack.push_back(llvm::timeTraceAsyncProfilerBegin(
158+
"Source", FE ? FE->getName() : StringRef("<unknown>")));
158159
}
159160

160161
IncludeStack.push_back(IncludeLoc);
@@ -166,8 +167,9 @@ class SemaPPCallbacks : public PPCallbacks {
166167
}
167168
case ExitFile:
168169
if (!IncludeStack.empty()) {
169-
if (llvm::timeTraceProfilerEnabled())
170-
llvm::timeTraceProfilerEnd();
170+
if (llvm::timeTraceProfilerEnabled()) {
171+
llvm::timeTraceProfilerEnd(ProfilerStack.pop_back_val());
172+
}
171173

172174
S->DiagnoseNonDefaultPragmaAlignPack(
173175
Sema::PragmaAlignPackDiagnoseKind::ChangedStateAtExit,

0 commit comments

Comments
 (0)