[ASTDumper] Respect function body skipping

Avoid parsing a body for e.g
`-experimental-skip-all-function-bodies`.
This commit is contained in:
Hamish Knight
2024-06-19 15:22:20 +01:00
parent d73e77fed2
commit 82cc2403d9
2 changed files with 8 additions and 1 deletions

View File

@@ -1561,7 +1561,8 @@ namespace {
});
}
if (auto Body = D->getBody(/*canSynthesize=*/ParseIfNeeded)) {
auto canParse = ParseIfNeeded && !D->isBodySkipped();
if (auto Body = D->getBody(canParse)) {
printRec(Body, &D->getASTContext());
}
}

View File

@@ -0,0 +1,6 @@
// RUN: %target-swift-frontend -dump-parse -experimental-skip-all-function-bodies %s | %FileCheck %s
func foo() {
print("hello")
}
// CHECK-NOT: brace_stmt