Commit Graph

10 Commits

Author SHA1 Message Date
Xi Ge
50cde06cf0 Revert "SwiftSyntax: Teach SwiftSyntax to use SourceKitd to serialize syntax trees. (#14424)" 2018-02-06 23:20:42 -08:00
Xi Ge
871c9dac2a SwiftSyntax: Teach SwiftSyntax to use SourceKitd to serialize syntax trees. (#14424)
When using SwiftSyntax as a standalone tool, we invoke Swiftc
internally to get serialized syntax trees. This is not ideal for
several reasons: (1) we have to hard-code the relative path of swiftc
to invoke it; (2) we have to rely on standard input/output to pass the
tree across the process boundaries; and (3) we have to maintain two
different ways to get syntax tree (swiftc and sourcekitd).

This patch attempts to teach SwiftSyntax to use SourceKitd to get the
tree just like other clients. We first add a SourceKitd client library
written in Swift; and next teach SwiftSyntax to adopt this SourceKitd
client-side library. For platforms other than MacOS, we still use Swiftc
to get syntax trees. This client library also allows us to add 
SourceKitd tests in Swift.

This patch also re-enables several flaky tests.
2018-02-06 19:40:16 -08:00
Xi Ge
1b5306158d [test] libSyntax: add a test to ensure the client side decodes syntax tree properly. NFC (#14203)
We need to expose a SwiftSyntax API to encode a source file into Json
format.
2018-01-26 16:53:20 -08:00
Xi Ge
d13f83df14 SwiftSyntax: Factor out an API to decode serialized SourceFileSyntax. NFC (#14164)
Since our recent integration with SourceKit, clients may get a SourceFileSyntax
in a serialized form from SourceKit response.  We need an API in the
SwiftSyntax framework to decode this form. This'll be a more common
pattern to get a Swift side syntax tree than invoking swiftc internally.
2018-01-25 13:40:42 -08:00
Harlan
a339c82c1e [SwiftSyntax] Make Syntax nodes structs instead of classes (#14122)
* [Experiment] Make Syntax nodes structs instead of classes

* [Experiment] Add Hashable conformance to concrete types

* Fix pep8 violation

* Remove AnySyntax, explicitly specialize SyntaxCollection nodes

* Refine the comment for SyntaxCollection nodes
2018-01-24 23:17:25 -05:00
Rintaro Ishizaki
9c4d6f4893 Revert "[SwiftSyntax] Add debug print when the JSONDecoder fails to decode JSON (#14056)" (#14101)
This reverts commit 840166c3ea.
2018-01-24 10:01:43 +09:00
Rintaro Ishizaki
840166c3ea [SwiftSyntax] Add debug print when the JSONDecoder fails to decode JSON (#14056)
from the compiler's '-emit-syntax'.

Investigating: rdar://problem/36379512
2018-01-22 23:44:18 +09:00
Harlan
2cc756414b [SwiftSyntax] Swift Diagnostics API (#11511)
This patch provides an API and Serialization for clang-style diagnostics
from within Swift. Libraries can use this API to pop their own custom
diagnostics that can be serialized to JSON.
2017-12-12 15:55:22 -05:00
Harlan
f552f55969 Update SwiftSyntax's expectations now that -emit-syntax is emitting a SourceFileSyntax (#12860) 2017-11-10 15:48:13 -08:00
Harlan
ade67ca899 [Syntax] Swift libSyntax API (#11320)
* Create Swift libSyntax API

This patch is an initial implementation of the Swift libSyntax API. It
aims to provide all features of the C++ API but exposed to Swift.

It currently resides in SwiftExperimental and will likely exist in a
molten state for a while.

* Only build SwiftSyntax on macOS
2017-08-14 16:47:48 -07:00