|
29 | 29 | #include "swift/AST/Module.h"
|
30 | 30 | #include "swift/AST/ParameterList.h"
|
31 | 31 | #include "swift/Basic/Defer.h"
|
| 32 | +#include "swift/Basic/Statistic.h" |
32 | 33 | #include "swift/Basic/StringExtras.h"
|
33 | 34 | #include "llvm/Support/Compiler.h"
|
34 | 35 | #include "llvm/Support/MemoryBuffer.h"
|
@@ -4146,10 +4147,14 @@ bool Parser::parseGetSetImpl(ParseDeclOptions Flags,
|
4146 | 4147 | SmallVector<ASTNode, 16> Entries;
|
4147 | 4148 | {
|
4148 | 4149 | llvm::SaveAndRestore<bool> T(IsParsingInterfaceTokens, false);
|
4149 |
| - if (!isDelayedParsingEnabled()) |
| 4150 | + if (!isDelayedParsingEnabled()) { |
| 4151 | + if (Context.Stats) |
| 4152 | + Context.Stats->getFrontendCounters().NumFunctionsParsed++; |
| 4153 | + |
4150 | 4154 | parseBraceItems(Entries);
|
4151 |
| - else |
| 4155 | + } else { |
4152 | 4156 | consumeGetSetBody(TheDecl, LBLoc);
|
| 4157 | + } |
4153 | 4158 | }
|
4154 | 4159 |
|
4155 | 4160 | SourceLoc RBLoc;
|
@@ -5193,6 +5198,9 @@ Parser::parseDeclFunc(SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
|
5193 | 5198 | diagnose(Tok, diag::protocol_method_with_body);
|
5194 | 5199 | skipUntilDeclRBrace();
|
5195 | 5200 | } else if (!isDelayedParsingEnabled()) {
|
| 5201 | + if (Context.Stats) |
| 5202 | + Context.Stats->getFrontendCounters().NumFunctionsParsed++; |
| 5203 | + |
5196 | 5204 | ParserResult<BraceStmt> Body =
|
5197 | 5205 | parseBraceItemList(diag::func_decl_without_brace);
|
5198 | 5206 | if (Body.isNull()) {
|
@@ -6063,6 +6071,9 @@ Parser::parseDeclInit(ParseDeclOptions Flags, DeclAttributes &Attributes) {
|
6063 | 6071 | ParseFunctionBody CC(*this, CD);
|
6064 | 6072 |
|
6065 | 6073 | if (!isDelayedParsingEnabled()) {
|
| 6074 | + if (Context.Stats) |
| 6075 | + Context.Stats->getFrontendCounters().NumFunctionsParsed++; |
| 6076 | + |
6066 | 6077 | ParserResult<BraceStmt> Body =
|
6067 | 6078 | parseBraceItemList(diag::invalid_diagnostic);
|
6068 | 6079 |
|
@@ -6131,7 +6142,11 @@ parseDeclDeinit(ParseDeclOptions Flags, DeclAttributes &Attributes) {
|
6131 | 6142 |
|
6132 | 6143 | ParseFunctionBody CC(*this, DD);
|
6133 | 6144 | if (!isDelayedParsingEnabled()) {
|
6134 |
| - ParserResult<BraceStmt> Body=parseBraceItemList(diag::invalid_diagnostic); |
| 6145 | + if (Context.Stats) |
| 6146 | + Context.Stats->getFrontendCounters().NumFunctionsParsed++; |
| 6147 | + |
| 6148 | + ParserResult<BraceStmt> Body = |
| 6149 | + parseBraceItemList(diag::invalid_diagnostic); |
6135 | 6150 |
|
6136 | 6151 | if (!Body.isNull())
|
6137 | 6152 | DD->setBody(Body.get());
|
|
0 commit comments