[clang] [llvm] Added instant events and marking defered templated instantiation. (PR #103039)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 29 09:46:29 PDT 2024
================
@@ -104,6 +105,23 @@ struct llvm::TimeTraceProfilerEntry {
}
};
+struct InProgressEntry {
+ std::unique_ptr<TimeTraceProfilerEntry> Event;
+ std::vector<TimeTraceProfilerEntry> InstantEvents;
+
+ InProgressEntry(TimePointType &&S, TimePointType &&E, std::string &&N,
+ std::string &&Dt, TimeTraceEventType Et)
+ : Event(std::make_unique<TimeTraceProfilerEntry>(
+ std::move(S), std::move(E), std::move(N), std::move(Dt), Et)),
+ InstantEvents() {}
+
+ InProgressEntry(TimePointType &&S, TimePointType &&E, std::string &&N,
----------------
ilya-biryukov wrote:
I suggested to remove the constructors completely, but also wanted to mention that it's better to accept by value in constructors, r-value references are almost always the wrong choice.
If the value is used, users still have a chance to `std::move()` into it to get efficiency; but they're also allowed to copy in cases where the type is const or a copy is actually needed.
See https://gcc.godbolt.org/z/9s3oo6xz8 for some examples.
https://github.com/llvm/llvm-project/pull/103039
More information about the cfe-commits
mailing list