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

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


================
@@ -102,23 +104,24 @@ struct llvm::TimeTraceProfiler {
     llvm::get_thread_name(ThreadName);
   }
 
-  void begin(std::string Name, llvm::function_ref<std::string()> Detail) {
-    Stack.emplace_back(ClockType::now(), TimePointType(), std::move(Name),
-                       Detail());
+  TimeTraceProfilerEntry *begin(std::string Name,
+                                llvm::function_ref<std::string()> Detail,
+                                bool AsyncEvent = false) {
+    Stack.emplace_back(std::make_unique<TimeTraceProfilerEntry>(
+        ClockType::now(), TimePointType(), std::move(Name), Detail(),
+        AsyncEvent));
+    return Stack.back().get();
   }
 
   void end() {
+    TimeTraceProfilerEntry *E = Stack.back().get();
----------------
ZequanWu wrote:

If we extract end(TimeTraceProfilerEntry &E) to a separate function, probably want to move the assertion to here as well

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


More information about the cfe-commits mailing list