File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
include/clang/Serialization Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -526,6 +526,9 @@ class ASTReader
526526 // / A timer used to track the time spent deserializing.
527527 std::unique_ptr<llvm::Timer> ReadTimer;
528528
529+ // A TimeRegion used to start and stop ReadTimer via RAII.
530+ std::optional<llvm::TimeRegion> ReadTimeRegion;
531+
529532 // / The location where the module file will be considered as
530533 // / imported from. For non-module AST types it should be invalid.
531534 SourceLocation CurrentImportLoc;
Original file line number Diff line number Diff line change @@ -11008,8 +11008,9 @@ void ASTReader::diagnoseOdrViolations() {
1100811008}
1100911009
1101011010void ASTReader::StartedDeserializing () {
11011- if (++NumCurrentElementsDeserializing == 1 && ReadTimer.get ())
11012- ReadTimer->startTimer ();
11011+ if (llvm::Timer *T = ReadTimer.get ();
11012+ ++NumCurrentElementsDeserializing == 1 && T)
11013+ ReadTimeRegion.emplace (T);
1101311014}
1101411015
1101511016void ASTReader::FinishedDeserializing () {
@@ -11067,8 +11068,7 @@ void ASTReader::FinishedDeserializing() {
1106711068 (void )UndeducedFD->getMostRecentDecl ();
1106811069 }
1106911070
11070- if (ReadTimer)
11071- ReadTimer->stopTimer ();
11071+ ReadTimeRegion.reset ();
1107211072
1107311073 diagnoseOdrViolations ();
1107411074 }
You can’t perform that action at this time.
0 commit comments