Files
swift-mirror/lib/ASTGen/Package.swift
Doug Gregor 027ce8d21c [ASTGen/Macros] Introduce a Swift-side SourceManager into ASTGen.
Add SourceManager that can keep track of multiple source file syntax
nodes along with their external representations. The source manager can
emit diagnostics into any of those files, including tracking any
explicitly "detached" syntax nodes used for macro expansion.

Make sure we detach syntax nodes before passing them to macro
implementations, so they cannot see more of the source file than they
are permitted. We hadn't been doing this before (by accident), and
doing so motivated the introduction of the SourceManager.

Additionally, perform operator folding on macro arguments as part of
detaching them. Macro clients shouldn't have to do this, and moreover,
when clients do this, they lose the ability to easily emit diagnostics
on the now-folded nodes.
2023-01-28 22:23:52 -08:00

43 lines
1.3 KiB
Swift

// swift-tools-version: 5.6
// The CMake build system is the only one that's able to produce a working
// compiler. This Package.swift makes it easier to build and work with the
// swiftASTGen library within IDEs, but it's mainly there for editing---it
// won't create something that can be meaningfully executed. Most things with
// the new Swift parser are better implemented/tested within or on top of the
// swift-syntax package.
import PackageDescription
let package = Package(
name: "ASTGen",
platforms: [
.macOS(.v10_15)
],
products: [
.library(name: "swiftASTGen", targets: ["swiftASTGen"])
],
dependencies: [
.package(path: "../../../swift-syntax")
],
targets: [
.target(
name: "swiftASTGen",
dependencies: [
.product(name: "SwiftDiagnostics", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftOperators", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
],
path: ".",
exclude: ["CMakeLists.txt"],
swiftSettings: [
.unsafeFlags([
"-I", "../../include/swift/",
"-I", "../../include",
])
])
]
)