[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,
----------------
ilya-biryukov wrote:

Suggestion: removing these constructors and simply creating the `InProgressEntry` by hand would result in less code and less boilerplate (even though the usage will span more lines):
```
InProgressEntry E;
E.Event = make_unique<...>
```
Given that we only have two places where it's used, I think we're going to make things simpler.

(When LLVM switches to C++20 it would also be possible to use designated initializer syntax and actually get very readable code on a single line too, but that's a long time in the future).

However, this file already uses constructors, so this approach would be a little inconsistent.

Feel free to agree or ignore, just a suggestion.

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


More information about the cfe-commits mailing list