Skip to content

Commit 094e9ab

Browse files
authored
[ASTGen] Protect parseASTFromSyntaxTree for SWIFT_BUILD_SWIFT_SYNTAX (#69858)
The field `IsForASTGen` only exists when `SWIFT_BUILD_SWIFT_SYNTAX` is defined, but the usage was unprotected. The whole function can be inside the protected block because it only seems to be invoked from inside blocks already protected by `SWIFT_BUILD_SWIFT_SYNTAX`. Fix for #69761
1 parent 9ccb2ef commit 094e9ab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Parse/ParseBridging.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ using ASTFromSyntaxTreeCallback = T *(void *sourceFile,
9696
BridgedSourceLoc sourceLoc,
9797
BridgedSourceLoc &endLoc);
9898

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

124125
return makeParserResult(astNode);
125126
}
127+
#endif
126128

127129
ParserResult<TypeRepr> Parser::parseTypeReprFromSyntaxTree() {
128130
#if SWIFT_BUILD_SWIFT_SYNTAX
@@ -133,7 +135,7 @@ ParserResult<TypeRepr> Parser::parseTypeReprFromSyntaxTree() {
133135
CurDeclContext, Context, *this, &endLoc);
134136
});
135137
#else
136-
llvm_unreachable("ASTGen is not supported")
138+
llvm_unreachable("ASTGen is not supported");
137139
#endif
138140
}
139141

0 commit comments

Comments
 (0)