[clang] [clang][timers][modules] Fix a timer being started when it's running (PR #154231)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 19 01:31:34 PDT 2025
================
@@ -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
More information about the cfe-commits
mailing list