Skip to content

Commit 71ff168

Browse files
committed
Sema: Add a couple more counters
1 parent feb1401 commit 71ff168

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/swift/Basic/Statistics.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ FRONTEND_STATISTIC(Sema, NumDeclsDeserialized)
179179
/// Number of declarations validated.
180180
FRONTEND_STATISTIC(Sema, NumDeclsValidated)
181181

182+
/// Number of declarations type checked.
183+
FRONTEND_STATISTIC(Sema, NumDeclsTypechecked)
184+
185+
/// Number of declarations finalized.
186+
FRONTEND_STATISTIC(Sema, NumDeclsFinalized)
187+
182188
/// Number of full function bodies typechecked.
183189
FRONTEND_STATISTIC(Sema, NumFunctionsTypechecked)
184190

lib/Sema/TypeCheckDecl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,6 +2063,9 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
20632063
explicit DeclChecker(TypeChecker &TC) : TC(TC) {}
20642064

20652065
void visit(Decl *decl) {
2066+
if (TC.Context.Stats)
2067+
TC.Context.Stats->getFrontendCounters().NumDeclsTypechecked++;
2068+
20662069
FrontendStatsTracer StatsTracer(TC.Context.Stats, "typecheck-decl", decl);
20672070
PrettyStackTraceDecl StackTrace("type-checking", decl);
20682071

@@ -4413,6 +4416,9 @@ static void finalizeType(TypeChecker &TC, NominalTypeDecl *nominal) {
44134416
}
44144417

44154418
void TypeChecker::finalizeDecl(ValueDecl *decl) {
4419+
if (Context.Stats)
4420+
Context.Stats->getFrontendCounters().NumDeclsFinalized++;
4421+
44164422
validateDecl(decl);
44174423

44184424
if (auto nominal = dyn_cast<NominalTypeDecl>(decl)) {

0 commit comments

Comments
 (0)