Skip to content

Commit d6cffbb

Browse files
authored
Merge pull request #62145 from CodaFi/synfonia
Delete libSyntax
2 parents 4e3a4ff + 37e7052 commit d6cffbb

File tree

218 files changed

+232
-19467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+232
-19467
lines changed

include/swift/AST/ASTContext.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ namespace rewriting {
144144
class RewriteContext;
145145
}
146146

147-
namespace syntax {
148-
class SyntaxArena;
149-
}
150-
151147
namespace ide {
152148
class TypeCheckCompletionCallback;
153149
}
@@ -498,9 +494,6 @@ class ASTContext final {
498494
setVector.size());
499495
}
500496

501-
/// Retrieve the syntax node memory manager for this context.
502-
llvm::IntrusiveRefCntPtr<syntax::SyntaxArena> getSyntaxArena() const;
503-
504497
/// Set a new stats reporter.
505498
void setStatsReporter(UnifiedStatsReporter *stats);
506499

include/swift/AST/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ else()
55
endif()
66

77
set(generated_include_sources
8-
Attr.def.gyb)
8+
Attr.def.gyb
9+
TokenKinds.def.gyb)
910

1011
add_gyb_target(swift-ast-generated-headers
1112
"${generated_include_sources}")

include/swift/AST/Decl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6769,8 +6769,7 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
67696769
// FIXME: Remove 'Parsed' from this list once we can always delay
67706770
// parsing bodies. The -experimental-skip-*-function-bodies options
67716771
// do currently skip parsing, unless disabled through other means in
6772-
// SourceFile::hasDelayedBodyParsing (eg. needing to build the full
6773-
// syntax tree due to -verify-syntax-tree).
6772+
// SourceFile::hasDelayedBodyParsing.
67746773
assert(getBodyKind() == BodyKind::None ||
67756774
getBodyKind() == BodyKind::Unparsed ||
67766775
getBodyKind() == BodyKind::Parsed);

include/swift/AST/Expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ class ObjectLiteralExpr final : public LiteralExpr {
11081108
/// The kind of object literal.
11091109
enum LiteralKind : unsigned {
11101110
#define POUND_OBJECT_LITERAL(Name, Desc, Proto) Name,
1111-
#include "swift/Syntax/TokenKinds.def"
1111+
#include "swift/AST/TokenKinds.def"
11121112
};
11131113

11141114
private:

include/swift/AST/Module.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,9 @@ namespace swift {
7575
class ValueDecl;
7676
class VarDecl;
7777
class VisibleDeclConsumer;
78-
class SyntaxParsingCache;
7978
class ASTScope;
8079
class SourceLookupCache;
8180

82-
namespace syntax {
83-
class SourceFileSyntax;
84-
}
8581
namespace ast_scope {
8682
class ASTSourceFileScope;
8783
}

include/swift/AST/ParseRequests.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "swift/AST/SimpleRequest.h"
2222
#include "swift/Basic/Fingerprint.h"
2323
#include "swift/Parse/Token.h"
24-
#include "swift/Syntax/SyntaxNodes.h"
2524

2625
namespace swift {
2726

@@ -90,7 +89,6 @@ struct SourceFileParsingResult {
9089
ArrayRef<ASTNode> TopLevelItems;
9190
Optional<ArrayRef<Token>> CollectedTokens;
9291
Optional<StableHasher> InterfaceHasher;
93-
Optional<syntax::SourceFileSyntax> SyntaxRoot;
9492
};
9593

9694
/// Parse the top-level items of a SourceFile.

include/swift/AST/SourceFile.h

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,15 @@ class SourceFile final : public FileUnit {
7878
/// and the associated language option.
7979
DisablePoundIfEvaluation = 1 << 1,
8080

81-
/// Whether to build a syntax tree.
82-
BuildSyntaxTree = 1 << 2,
83-
8481
/// Whether to save the file's parsed tokens.
85-
CollectParsedTokens = 1 << 3,
82+
CollectParsedTokens = 1 << 2,
8683

8784
/// Whether to compute the interface hash of the file.
88-
EnableInterfaceHash = 1 << 4,
85+
EnableInterfaceHash = 1 << 3,
8986

9087
/// Whether to suppress warnings when parsing. This is set for secondary
9188
/// files, as they get parsed multiple times.
92-
SuppressWarnings = 1 << 5,
89+
SuppressWarnings = 1 << 4,
9390
};
9491
using ParsingOptions = OptionSet<ParsingFlags>;
9592

@@ -248,10 +245,6 @@ class SourceFile final : public FileUnit {
248245
/// code for it. Note this method returns \c false in WMO.
249246
bool isPrimary() const { return IsPrimary; }
250247

251-
/// A cache of syntax nodes that can be reused when creating the syntax tree
252-
/// for this file.
253-
swift::SyntaxParsingCache *SyntaxParsingCache = nullptr;
254-
255248
/// The list of local type declarations in the source file.
256249
llvm::SetVector<TypeDecl *> LocalTypeDecls;
257250

@@ -633,14 +626,10 @@ class SourceFile final : public FileUnit {
633626
/// them to be accessed from \c getAllTokens.
634627
bool shouldCollectTokens() const;
635628

636-
bool shouldBuildSyntaxTree() const;
637-
638629
/// Whether the bodies of types and functions within this file can be lazily
639630
/// parsed.
640631
bool hasDelayedBodyParsing() const;
641632

642-
syntax::SourceFileSyntax getSyntaxRoot() const;
643-
644633
OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName) override;
645634

646635
/// Do not call when inside an inactive clause (\c
@@ -660,9 +649,6 @@ class SourceFile final : public FileUnit {
660649
/// If not \c None, the underlying vector contains the parsed tokens of this
661650
/// source file.
662651
Optional<ArrayRef<Token>> AllCollectedTokens;
663-
664-
/// The root of the syntax tree representing the source file.
665-
std::unique_ptr<syntax::SourceFileSyntax> SyntaxRoot;
666652
};
667653

668654
inline SourceFile::ParsingOptions operator|(SourceFile::ParsingFlags lhs,

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/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@ if(SWIFT_INCLUDE_TOOLS)
99
ESCAPE_QUOTES @ONLY)
1010
add_subdirectory(AST)
1111
add_subdirectory(Option)
12-
add_subdirectory(Parse)
13-
add_subdirectory(Syntax)
1412
endif()
1513

0 commit comments

Comments
 (0)