File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -100,19 +100,21 @@ static void walkForProfiling(ASTNode N, ASTWalker &Walker) {
100
100
}
101
101
}
102
102
103
+ // / Check that the input AST has at least been type-checked.
104
+ static bool hasASTBeenTypeChecked (ASTNode N) {
105
+ DeclContext *DC = N.getAsDeclContext ();
106
+ assert (DC && " Invalid AST node for profiling" );
107
+ SourceFile *SF = DC->getParentSourceFile ();
108
+ return !SF || SF->ASTStage >= SourceFile::TypeChecked;
109
+ }
110
+
103
111
SILProfiler *SILProfiler::create (SILModule &M, ForDefinition_t forDefinition,
104
112
ASTNode N) {
105
113
// Avoid generating profiling state for declarations.
106
114
if (!forDefinition)
107
115
return nullptr ;
108
116
109
- // Assert that the input AST has at least been type-checked.
110
- assert ([&] {
111
- DeclContext *DC = N.getAsDeclContext ();
112
- assert (DC && " Invalid AST node for profiling" );
113
- SourceFile *SF = DC->getParentSourceFile ();
114
- return !SF || SF->ASTStage >= SourceFile::TypeChecked;
115
- }() && " Cannot use this AST for code coverage" );
117
+ assert (hasASTBeenTypeChecked (N) && " Cannot use this AST for code coverage" );
116
118
117
119
if (auto *D = N.dyn_cast <Decl *>()) {
118
120
assert (isa<AbstractFunctionDecl>(D) ||
You can’t perform that action at this time.
0 commit comments