================
@@ -11003,8 +11003,9 @@ void ASTReader::diagnoseOdrViolations() {
 }
 
 void ASTReader::StartedDeserializing() {
-  if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get())
-    ReadTimer->startTimer();
+  if (llvm::Timer *T = ReadTimer.get();
----------------
ilya-biryukov wrote:

Suggestion: Could we use RAII to make it explicit when we own the Timer? The 
current code also works, 
- store `std::optional<TimeRegion>` in `ASTReader`.
- call `emplace()` in the first `StartedDeserializing`.
- call `reset()` in the matching `FinishedDeserializing`

https://github.com/llvm/llvm-project/pull/154231
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to