@@ -135,6 +135,7 @@ namespace sema {
135135class SemaPPCallbacks : public PPCallbacks {
136136 Sema *S = nullptr ;
137137 llvm::SmallVector<SourceLocation, 8 > IncludeStack;
138+ llvm::SmallVector<llvm::TimeTraceProfilerEntry *, 8 > ProfilerStack;
138139
139140public:
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);
@@ -167,7 +168,7 @@ class SemaPPCallbacks : public PPCallbacks {
167168 case ExitFile:
168169 if (!IncludeStack.empty ()) {
169170 if (llvm::timeTraceProfilerEnabled ())
170- llvm::timeTraceProfilerEnd ();
171+ llvm::timeTraceProfilerEnd (ProfilerStack. pop_back_val () );
171172
172173 S->DiagnoseNonDefaultPragmaAlignPack (
173174 Sema::PragmaAlignPackDiagnoseKind::ChangedStateAtExit,
0 commit comments