Skip to content

Commit 437ff8c

Browse files
committed
Remove -emit-syntax and -verify-syntax-tree
1 parent 8b9e8dd commit 437ff8c

22 files changed

+12
-143
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -420,19 +420,6 @@ namespace swift {
420420
/// Whether collect tokens during parsing for syntax coloring.
421421
bool CollectParsedToken = false;
422422

423-
/// Whether to parse syntax tree. If the syntax tree is built, the generated
424-
/// AST may not be correct when syntax nodes are reused as part of
425-
/// incrementals parsing.
426-
bool BuildSyntaxTree = false;
427-
428-
/// Whether parsing is occurring for creation of syntax tree only, and no typechecking will occur after
429-
/// parsing e.g. when parsing for SwiftSyntax. This is intended to affect parsing, e.g. disable
430-
/// unnecessary name lookups that are not useful for pure syntactic parsing.
431-
bool ParseForSyntaxTreeOnly = false;
432-
433-
/// Whether to verify the parsed syntax tree and emit related diagnostics.
434-
bool VerifySyntaxTree = false;
435-
436423
/// Whether to disable the evaluation of '#if' decls, such that the bodies
437424
/// of active clauses aren't hoisted into the enclosing scope.
438425
bool DisablePoundIfEvaluation = false;

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ class FrontendOptions {
126126
Typecheck, ///< Parse and type-check only
127127
DumpParse, ///< Parse only and dump AST
128128
DumpInterfaceHash, ///< Parse and dump the interface token hash.
129-
EmitSyntax, ///< Parse and dump Syntax tree as JSON
130129
DumpAST, ///< Parse, type-check, and dump AST
131130
PrintAST, ///< Parse, type-check, and pretty-print AST
132131
PrintASTDecl, ///< Parse, type-check, and pretty-print AST declarations

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ def verify_generic_signatures : Separate<["-"], "verify-generic-signatures">,
119119
MetaVarName<"<module-name>">,
120120
HelpText<"Verify the generic signatures in the given module">;
121121

122-
def verify_syntax_tree : Flag<["-"], "verify-syntax-tree">,
123-
HelpText<"Verify that no unknown nodes exist in the libSyntax tree">;
124-
125122
def show_diagnostics_after_fatal : Flag<["-"], "show-diagnostics-after-fatal">,
126123
HelpText<"Keep emitting subsequent diagnostics after a fatal error">;
127124

@@ -835,9 +832,6 @@ def emit_sorted_sil : Flag<["-"], "emit-sorted-sil">,
835832
HelpText<"When printing SIL, print out all sil entities sorted by name to "
836833
"ease diffing">;
837834

838-
def emit_syntax : Flag<["-"], "emit-syntax">,
839-
HelpText<"Parse input file(s) and emit the Syntax tree(s) as JSON">, ModeOpt;
840-
841835
def cxx_interop_getters_setters_as_properties :
842836
Flag<["-"], "cxx-interop-getters-setters-as-properties">,
843837
HelpText<"Import getters and setters as computed properties in Swift">,

lib/AST/RawComment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static RawComment toRawComment(ASTContext &Context, CharSourceRange Range) {
8383
LangOptions FakeLangOpts;
8484
Lexer L(FakeLangOpts, SM, BufferID, nullptr, LexerMode::Swift,
8585
HashbangMode::Disallowed, CommentRetentionMode::ReturnAsTokens,
86-
TriviaRetentionMode::WithoutTrivia, Offset, EndOffset);
86+
Offset, EndOffset);
8787

8888
SmallVector<SingleRawComment, 16> Comments;
8989
Token Tok;

lib/Driver/Driver.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,6 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
16021602
case options::OPT_resolve_imports:
16031603
case options::OPT_typecheck:
16041604
case options::OPT_dump_parse:
1605-
case options::OPT_emit_syntax:
16061605
case options::OPT_print_ast:
16071606
case options::OPT_dump_type_refinement_contexts:
16081607
case options::OPT_dump_scope_maps:

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,6 @@ ArgsToFrontendOptionsConverter::determineRequestedAction(const ArgList &args) {
488488
return FrontendOptions::ActionType::DumpParse;
489489
if (Opt.matches(OPT_dump_ast))
490490
return FrontendOptions::ActionType::DumpAST;
491-
if (Opt.matches(OPT_emit_syntax))
492-
return FrontendOptions::ActionType::EmitSyntax;
493491
if (Opt.matches(OPT_merge_modules))
494492
return FrontendOptions::ActionType::MergeModules;
495493
if (Opt.matches(OPT_dump_scope_maps))

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,11 +572,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
572572

573573
Opts.NamedLazyMemberLoading &= !Args.hasArg(OPT_disable_named_lazy_member_loading);
574574

575-
if (Args.hasArg(OPT_verify_syntax_tree)) {
576-
Opts.BuildSyntaxTree = true;
577-
Opts.VerifySyntaxTree = true;
578-
}
579-
580575
if (Args.hasArg(OPT_emit_fine_grained_dependency_sourcefile_dot_files))
581576
Opts.EmitFineGrainedDependencySourcefileDotFiles = true;
582577

@@ -985,11 +980,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
985980
Opts.entryPointFunctionName = A->getValue();
986981
}
987982

988-
if (FrontendOpts.RequestedAction == FrontendOptions::ActionType::EmitSyntax) {
989-
Opts.BuildSyntaxTree = true;
990-
Opts.VerifySyntaxTree = true;
991-
}
992-
993983
// Configure lexing to parse and remember comments if:
994984
// - Emitting a swiftdoc/swiftsourceinfo
995985
// - Performing index-while-building

lib/Frontend/FrontendOptions.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ bool FrontendOptions::needsProperModuleName(ActionType action) {
3636
case ActionType::Typecheck:
3737
case ActionType::DumpParse:
3838
case ActionType::DumpAST:
39-
case ActionType::EmitSyntax:
4039
case ActionType::DumpInterfaceHash:
4140
case ActionType::PrintAST:
4241
case ActionType::PrintASTDecl:
@@ -77,7 +76,6 @@ bool FrontendOptions::shouldActionOnlyParse(ActionType action) {
7776
switch (action) {
7877
case ActionType::Parse:
7978
case ActionType::DumpParse:
80-
case ActionType::EmitSyntax:
8179
case ActionType::DumpInterfaceHash:
8280
case ActionType::EmitImportedModules:
8381
case ActionType::ScanDependencies:
@@ -94,7 +92,6 @@ bool FrontendOptions::doesActionRequireSwiftStandardLibrary(ActionType action) {
9492
case ActionType::NoneAction:
9593
case ActionType::Parse:
9694
case ActionType::DumpParse:
97-
case ActionType::EmitSyntax:
9895
case ActionType::DumpInterfaceHash:
9996
case ActionType::EmitImportedModules:
10097
case ActionType::ScanDependencies:
@@ -143,7 +140,6 @@ bool FrontendOptions::doesActionRequireInputs(ActionType action) {
143140
case ActionType::REPL:
144141
case ActionType::Parse:
145142
case ActionType::DumpParse:
146-
case ActionType::EmitSyntax:
147143
case ActionType::DumpInterfaceHash:
148144
case ActionType::EmitImportedModules:
149145
case ActionType::ScanDependencies:
@@ -189,7 +185,6 @@ bool FrontendOptions::doesActionPerformEndOfPipelineActions(ActionType action) {
189185
case ActionType::REPL:
190186
case ActionType::Parse:
191187
case ActionType::DumpParse:
192-
case ActionType::EmitSyntax:
193188
case ActionType::DumpInterfaceHash:
194189
case ActionType::EmitImportedModules:
195190
case ActionType::ScanDependencies:
@@ -256,7 +251,6 @@ FrontendOptions::formatForPrincipalOutputFileForAction(ActionType action) {
256251
case ActionType::DumpParse:
257252
case ActionType::DumpInterfaceHash:
258253
case ActionType::DumpAST:
259-
case ActionType::EmitSyntax:
260254
case ActionType::PrintAST:
261255
case ActionType::PrintASTDecl:
262256
case ActionType::DumpScopeMaps:
@@ -325,7 +319,6 @@ bool FrontendOptions::canActionEmitDependencies(ActionType action) {
325319
case ActionType::DumpParse:
326320
case ActionType::DumpInterfaceHash:
327321
case ActionType::DumpAST:
328-
case ActionType::EmitSyntax:
329322
case ActionType::PrintAST:
330323
case ActionType::PrintASTDecl:
331324
case ActionType::DumpScopeMaps:
@@ -369,7 +362,6 @@ bool FrontendOptions::canActionEmitReferenceDependencies(ActionType action) {
369362
case ActionType::DumpParse:
370363
case ActionType::DumpInterfaceHash:
371364
case ActionType::DumpAST:
372-
case ActionType::EmitSyntax:
373365
case ActionType::PrintAST:
374366
case ActionType::PrintASTDecl:
375367
case ActionType::DumpScopeMaps:
@@ -412,7 +404,6 @@ bool FrontendOptions::canActionEmitModuleSummary(ActionType action) {
412404
case ActionType::DumpParse:
413405
case ActionType::DumpInterfaceHash:
414406
case ActionType::DumpAST:
415-
case ActionType::EmitSyntax:
416407
case ActionType::PrintAST:
417408
case ActionType::PrintASTDecl:
418409
case ActionType::EmitImportedModules:
@@ -455,7 +446,6 @@ bool FrontendOptions::canActionEmitClangHeader(ActionType action) {
455446
case ActionType::DumpParse:
456447
case ActionType::DumpInterfaceHash:
457448
case ActionType::DumpAST:
458-
case ActionType::EmitSyntax:
459449
case ActionType::PrintAST:
460450
case ActionType::PrintASTDecl:
461451
case ActionType::EmitPCH:
@@ -497,7 +487,6 @@ bool FrontendOptions::canActionEmitLoadedModuleTrace(ActionType action) {
497487
case ActionType::DumpParse:
498488
case ActionType::DumpInterfaceHash:
499489
case ActionType::DumpAST:
500-
case ActionType::EmitSyntax:
501490
case ActionType::PrintAST:
502491
case ActionType::PrintASTDecl:
503492
case ActionType::DumpScopeMaps:
@@ -546,7 +535,6 @@ bool FrontendOptions::canActionEmitModuleSemanticInfo(ActionType action) {
546535
case ActionType::DumpParse:
547536
case ActionType::DumpInterfaceHash:
548537
case ActionType::DumpAST:
549-
case ActionType::EmitSyntax:
550538
case ActionType::PrintAST:
551539
case ActionType::PrintASTDecl:
552540
case ActionType::EmitPCH:
@@ -590,7 +578,6 @@ bool FrontendOptions::canActionEmitConstValues(ActionType action) {
590578
case ActionType::DumpParse:
591579
case ActionType::DumpInterfaceHash:
592580
case ActionType::DumpAST:
593-
case ActionType::EmitSyntax:
594581
case ActionType::PrintAST:
595582
case ActionType::PrintASTDecl:
596583
case ActionType::DumpScopeMaps:
@@ -633,7 +620,6 @@ bool FrontendOptions::canActionEmitModule(ActionType action) {
633620
case ActionType::DumpParse:
634621
case ActionType::DumpInterfaceHash:
635622
case ActionType::DumpAST:
636-
case ActionType::EmitSyntax:
637623
case ActionType::PrintAST:
638624
case ActionType::PrintASTDecl:
639625
case ActionType::EmitPCH:
@@ -679,7 +665,6 @@ bool FrontendOptions::canActionEmitInterface(ActionType action) {
679665
case ActionType::DumpParse:
680666
case ActionType::DumpInterfaceHash:
681667
case ActionType::DumpAST:
682-
case ActionType::EmitSyntax:
683668
case ActionType::PrintAST:
684669
case ActionType::PrintASTDecl:
685670
case ActionType::EmitImportedModules:
@@ -721,7 +706,6 @@ bool FrontendOptions::doesActionProduceOutput(ActionType action) {
721706
case ActionType::Typecheck:
722707
case ActionType::DumpParse:
723708
case ActionType::DumpAST:
724-
case ActionType::EmitSyntax:
725709
case ActionType::DumpInterfaceHash:
726710
case ActionType::PrintAST:
727711
case ActionType::PrintASTDecl:
@@ -781,7 +765,6 @@ bool FrontendOptions::doesActionProduceTextualOutput(ActionType action) {
781765
case ActionType::DumpParse:
782766
case ActionType::DumpInterfaceHash:
783767
case ActionType::DumpAST:
784-
case ActionType::EmitSyntax:
785768
case ActionType::PrintAST:
786769
case ActionType::PrintASTDecl:
787770
case ActionType::DumpScopeMaps:
@@ -810,7 +793,6 @@ bool FrontendOptions::doesActionGenerateSIL(ActionType action) {
810793
case ActionType::Typecheck:
811794
case ActionType::DumpParse:
812795
case ActionType::DumpInterfaceHash:
813-
case ActionType::EmitSyntax:
814796
case ActionType::DumpAST:
815797
case ActionType::PrintAST:
816798
case ActionType::PrintASTDecl:
@@ -852,7 +834,6 @@ bool FrontendOptions::doesActionGenerateIR(ActionType action) {
852834
case ActionType::DumpParse:
853835
case ActionType::DumpInterfaceHash:
854836
case ActionType::DumpAST:
855-
case ActionType::EmitSyntax:
856837
case ActionType::PrintAST:
857838
case ActionType::PrintASTDecl:
858839
case ActionType::DumpScopeMaps:

lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@
6868
#include "swift/Serialization/SerializedModuleLoader.h"
6969
#include "swift/Subsystems.h"
7070
#include "swift/SymbolGraphGen/SymbolGraphOptions.h"
71-
#include "swift/Syntax/Serialization/SyntaxSerialization.h"
72-
#include "swift/Syntax/SyntaxNodes.h"
7371

7472
#include "llvm/ADT/Statistic.h"
7573
#include "llvm/ADT/StringMap.h"
@@ -139,18 +137,6 @@ getFileOutputStream(StringRef OutputFilename, ASTContext &Ctx) {
139137
return os;
140138
}
141139

142-
/// Writes the Syntax tree to the given file
143-
static bool emitSyntax(const SourceFile &SF, StringRef OutputFilename) {
144-
auto os = getFileOutputStream(OutputFilename, SF.getASTContext());
145-
if (!os) return true;
146-
147-
json::Output jsonOut(*os, /*UserInfo=*/{}, /*PrettyPrint=*/false);
148-
auto Root = SF.getSyntaxRoot().getRaw();
149-
jsonOut << *Root;
150-
*os << "\n";
151-
return false;
152-
}
153-
154140
/// Writes SIL out to the given file.
155141
static bool writeSIL(SILModule &SM, ModuleDecl *M, const SILOptions &Opts,
156142
StringRef OutputFilename) {
@@ -1344,9 +1330,6 @@ static bool performAction(CompilerInstance &Instance,
13441330
case FrontendOptions::ActionType::DumpInterfaceHash:
13451331
getPrimaryOrMainSourceFile(Instance).dumpInterfaceHash(llvm::errs());
13461332
return Context.hadError();
1347-
case FrontendOptions::ActionType::EmitSyntax:
1348-
return emitSyntax(getPrimaryOrMainSourceFile(Instance),
1349-
opts.InputsAndOutputs.getSingleOutputFilename());
13501333
case FrontendOptions::ActionType::EmitImportedModules:
13511334
return emitImportedModules(Instance.getMainModule(), opts);
13521335

stdlib/public/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ if(SWIFT_RUNTIME_USE_SANITIZERS)
1515
endif()
1616
endif()
1717

18-
list(APPEND SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS "-Xfrontend" "-verify-syntax-tree")
19-
2018
if(SWIFT_STDLIB_SIL_DEBUGGING)
2119
list(APPEND SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS "-Xfrontend" "-sil-based-debuginfo")
2220
endif()

test/Concurrency/Runtime/reasync.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -emit-module-path %t/reasync.swiftmodule %S/Inputs/reasync.swift -enable-experimental-concurrency -disable-availability-checking -verify-syntax-tree
2+
// RUN: %target-swift-frontend -emit-module-path %t/reasync.swiftmodule %S/Inputs/reasync.swift -enable-experimental-concurrency -disable-availability-checking
33
// RUN: %target-build-swift %s -I %t -o %t/main -module-name main
44
// RUN: %target-codesign %t/main
55
// RUN: %target-run %t/main

test/Frontend/emit-syntax.swift

Lines changed: 0 additions & 60 deletions
This file was deleted.

test/Parse/alwaysEmitConformanceMetadata_attr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -parse -parse-stdlib -verify-syntax-tree
1+
// RUN: %target-typecheck-verify-swift -parse -parse-stdlib
22

33
import Swift
44

test/Parse/async-syntax.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -disable-availability-checking -verify-syntax-tree
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking
22

33
// REQUIRES: concurrency
44

test/Parse/noimplicitcopy_attr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
f// RUN: %target-typecheck-verify-swift -parse -parse-stdlib -disable-availability-checking -verify-syntax-tree
1+
f// RUN: %target-typecheck-verify-swift -parse -parse-stdlib -disable-availability-checking
22

33
import Swift
44

test/SILGen/noimplicitcopy_attr_arg_generic_users_banned.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-emit-sil -enable-experimental-move-only -parse-stdlib -disable-availability-checking -verify-syntax-tree -verify %s
1+
// RUN: %target-swift-emit-sil -enable-experimental-move-only -parse-stdlib -disable-availability-checking -verify %s
22

33
import Swift
44

test/Sema/alwaysEmitConformanceMetadata_attr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -parse-stdlib -verify-syntax-tree
1+
// RUN: %target-typecheck-verify-swift -parse-stdlib
22

33
import Swift
44

0 commit comments

Comments
 (0)