[SwiftCompiler/Regex] Use bridged DiagnosticEngine for error reporting

This fixes:
 * An issue where the diagnostic messages were leaked
 * Diagnose at correct position inside the regex literal

To do this:
 * Introduce 'Parse' SwiftCompiler module that is a bridging layer
   between '_CompilerRegexParser' and C++ libParse
 * Move libswiftParseRegexLiteral and libswiftLexRegexLiteral to 'Parse'

Also this change makes 'SwiftCompilerSources/Package.swift' be configured
by CMake so it can actually be built with 'swift-build'.

rdar://92187284
This commit is contained in:
Rintaro Ishizaki
2022-04-07 14:13:46 -07:00
parent 35aa7f893a
commit d292a95296
21 changed files with 377 additions and 141 deletions

View File

@@ -1,51 +0,0 @@
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "SwiftCompilerSources",
platforms: [
.macOS("10.9"),
],
products: [
.library(
name: "Swift",
type: .static,
targets: ["SIL", "Optimizer", "_CompilerRegexParser"]),
],
dependencies: [
],
// Note that all modules must be added to LIBSWIFT_MODULES in the top-level
// CMakeLists.txt file to get debugging working.
targets: [
.target(
name: "SIL",
dependencies: [],
swiftSettings: [SwiftSetting.unsafeFlags([
"-I", "../include/swift",
"-cross-module-optimization"
])]),
.target(
name: "_CompilerRegexParser",
dependencies: [],
path: "_RegexParser",
swiftSettings: [
.unsafeFlags([
"-I", "../include/swift",
"-cross-module-optimization",
]),
// Workaround until `_RegexParser` is imported as implementation-only
// by `_StringProcessing`.
.unsafeFlags([
"-Xfrontend",
"-disable-implicit-string-processing-module-import"
])]),
.target(
name: "Optimizer",
dependencies: ["SIL", "_CompilerRegexParser"],
swiftSettings: [SwiftSetting.unsafeFlags([
"-I", "../include/swift",
"-cross-module-optimization"
])]),
]
)