Skip to content

[ASTGen] Protect parseASTFromSyntaxTree for SWIFT_BUILD_SWIFT_SYNTAX #69858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/Parse/ParseBridging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ using ASTFromSyntaxTreeCallback = T *(void *sourceFile,
BridgedSourceLoc sourceLoc,
BridgedSourceLoc &endLoc);

#if SWIFT_BUILD_SWIFT_SYNTAX
/// Parse by constructing a C++ AST node from the Swift syntax tree via ASTGen.
template <typename T>
static ParserResult<T>
Expand Down Expand Up @@ -123,6 +124,7 @@ parseASTFromSyntaxTree(swift::Parser &P,

return makeParserResult(astNode);
}
#endif

ParserResult<TypeRepr> Parser::parseTypeReprFromSyntaxTree() {
#if SWIFT_BUILD_SWIFT_SYNTAX
Expand All @@ -133,7 +135,7 @@ ParserResult<TypeRepr> Parser::parseTypeReprFromSyntaxTree() {
CurDeclContext, Context, *this, &endLoc);
});
#else
llvm_unreachable("ASTGen is not supported")
llvm_unreachable("ASTGen is not supported");
#endif
}

Expand Down