File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -463,6 +463,28 @@ class Verifier : public ASTWalker {
463
463
bool shouldVerifyChecked (Pattern *S) { return S->hasType (); }
464
464
bool shouldVerifyChecked (Decl *S) { return true ; }
465
465
466
+ // Only verify functions if they have bodies we can safely walk.
467
+ // FIXME: This is a bit of a hack; we should be able to check the
468
+ // invariants of a parsed body as well.
469
+ bool shouldVerify (AbstractFunctionDecl *afd) {
470
+ switch (afd->getBodyKind ()) {
471
+ case AbstractFunctionDecl::BodyKind::None:
472
+ case AbstractFunctionDecl::BodyKind::TypeChecked:
473
+ case AbstractFunctionDecl::BodyKind::Skipped:
474
+ case AbstractFunctionDecl::BodyKind::MemberwiseInitializer:
475
+ return true ;
476
+
477
+ case AbstractFunctionDecl::BodyKind::Unparsed:
478
+ case AbstractFunctionDecl::BodyKind::Parsed:
479
+ case AbstractFunctionDecl::BodyKind::Synthesize:
480
+ if (auto SF = dyn_cast<SourceFile>(afd->getModuleScopeContext ())) {
481
+ return SF->ASTStage < SourceFile::TypeChecked;
482
+ }
483
+
484
+ return false ;
485
+ }
486
+ }
487
+
466
488
// Default cases for cleaning up as we exit a node.
467
489
void cleanup (Expr *E) { }
468
490
void cleanup (Stmt *S) { }
You can’t perform that action at this time.
0 commit comments