[clang] [llvm] Use timeTraceAsyncProfilerBegin for Source span (PR #83961)

Zequan Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 11:43:45 PDT 2024


ZequanWu wrote:

> > > > IIUC, the approach you choose here is to let `SemaPPCallbacks` control the "entered file stack" and allow it to remove element (which is file) from middle of the internal stack in `TimeTraceProfiler`, but this creates async event which is not designed for this purpose.
> > > > Can we let `SemaPPCallbacks` track the last push file into the stack and when exit file, pop all the elements from the stack until we popped the last pushed file?
> > > 
> > > 
> > > As I wrote in [#56554 (comment)](https://github.com/llvm/llvm-project/issues/56554#issuecomment-1975812398), file level span and syntax tree level span should be handled asynchronously. So using such implementation produces incorrect trace in other edge cases.
> > 
> > 
> > Can we choose to expose a handle (maybe an unique id for each entry) from `TimeTraceProfiler` instead of exposing the internal entry?
> 
> I think pointer to `TimeTraceProfilerEntry` is already like handle as definition of the struct is not written in header file. Having another handle for that seems unnecessary indirection layer to me. Or better to change the name of struct?

Okay, make sense. Looks good for me.
Adding @MaskRay to review in case he has something to say.

https://github.com/llvm/llvm-project/pull/83961


More information about the cfe-commits mailing list