Skip to content

Commit a970d13

Browse files
committed
SyntaxParser: avoid evaluating pound conditions in the new in-process parser.
1 parent d01e80d commit a970d13

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/libSwiftSyntaxParser/libSwiftSyntaxParser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ swiftparse_client_node_t SynParser::parse(const char *source) {
284284
ParserUnit PU(SM, SourceFileKind::Main, bufID, langOpts,
285285
"syntax_parse_module", std::move(parseActions),
286286
/*SyntaxCache=*/nullptr);
287+
// Evaluating pound conditions may lead to unknown syntax.
288+
PU.getParser().State->PerformConditionEvaluation = false;
287289
std::unique_ptr<SynParserDiagConsumer> pConsumer;
288290
if (DiagHandler) {
289291
pConsumer = llvm::make_unique<SynParserDiagConsumer>(*this, bufID);

0 commit comments

Comments
 (0)