Skip to content

Adopt new SwiftCompilerSupport header and enumerator names. #61179

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
Show file tree
Hide file tree
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: 4 additions & 0 deletions include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ EXPERIMENTAL_FEATURE(ParserRoundTrip)
/// Swift parser.
EXPERIMENTAL_FEATURE(ParserValidation)

/// Whether to fold sequence expressions in the syntax tree produced by the
/// Swift Swift parser.
EXPERIMENTAL_FEATURE(ParserSequenceFolding)

#undef EXPERIMENTAL_FEATURE
#undef UPCOMING_FEATURE
#undef SUPPRESSIBLE_LANGUAGE_FEATURE
Expand Down
4 changes: 4 additions & 0 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2945,6 +2945,10 @@ static bool usesFeatureParserValidation(Decl *decl) {
return false;
}

static bool usesFeatureParserSequenceFolding(Decl *decl) {
return false;
}

static void suppressingFeatureSpecializeAttributeWithAvailability(
PrintOptions &options,
llvm::function_ref<void()> action) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Parse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if (SWIFT_SWIFT_PARSER)

target_include_directories(swiftParse
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../../swift-syntax/Sources/SwiftParser
${CMAKE_CURRENT_SOURCE_DIR}/../../../swift-syntax/Sources/SwiftCompilerSupport
)

target_compile_definitions(swiftParse
Expand Down
9 changes: 6 additions & 3 deletions lib/Parse/ParseRequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "swift/SyntaxParse/SyntaxTreeCreator.h"

#ifdef SWIFT_SWIFT_PARSER
#include "SwiftParserCompilerSupport.h"
#include "SwiftCompilerSupport.h"
#endif

using namespace swift;
Expand Down Expand Up @@ -202,11 +202,14 @@ SourceFileParsingResult ParseSourceFileRequest::evaluate(Evaluator &evaluator,
unsigned int flags = 0;

if (ctx.LangOpts.hasFeature(Feature::ParserRoundTrip))
flags |= SPCC_RoundTrip;
flags |= SCC_RoundTrip;

if (!ctx.Diags.hadAnyError() &&
ctx.LangOpts.hasFeature(Feature::ParserValidation))
flags |= SPCC_ParseDiagnostics;
flags |= SCC_ParseDiagnostics;

if (ctx.LangOpts.hasFeature(Feature::ParserSequenceFolding))
flags |= SCC_FoldSequences;

int roundTripResult =
swift_parser_consistencyCheck(
Expand Down