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 @@ -451,6 +451,28 @@ class Verifier : public ASTWalker {
451
451
bool shouldVerifyChecked (Pattern *S) { return S->hasType (); }
452
452
bool shouldVerifyChecked (Decl *S) { return true ; }
453
453
454
+ // Only verify functions if they have bodies we can safely walk.
455
+ // FIXME: This is a bit of a hack; we should be able to check the
456
+ // invariants of a parsed body as well.
457
+ bool shouldVerify (AbstractFunctionDecl *afd) {
458
+ switch (afd->getBodyKind ()) {
459
+ case AbstractFunctionDecl::BodyKind::None:
460
+ case AbstractFunctionDecl::BodyKind::TypeChecked:
461
+ case AbstractFunctionDecl::BodyKind::Skipped:
462
+ case AbstractFunctionDecl::BodyKind::MemberwiseInitializer:
463
+ return true ;
464
+
465
+ case AbstractFunctionDecl::BodyKind::Unparsed:
466
+ case AbstractFunctionDecl::BodyKind::Parsed:
467
+ case AbstractFunctionDecl::BodyKind::Synthesize:
468
+ if (auto SF = dyn_cast<SourceFile>(afd->getModuleScopeContext ())) {
469
+ return SF->ASTStage < SourceFile::TypeChecked;
470
+ }
471
+
472
+ return false ;
473
+ }
474
+ }
475
+
454
476
// Default cases for cleaning up as we exit a node.
455
477
void cleanup (Expr *E) { }
456
478
void cleanup (Stmt *S) { }
You can’t perform that action at this time.
0 commit comments