Skip to content

Commit 7159e72

Browse files
committed
Move regex literal parsing logic from SwiftCompilerSources to ASTGen
ASTGen always builds with the host Swift compiler, without requiring bootstrapping, and is enabled in more places. Move the regex literal parsing logic there so it is enabled in more host environments, and makes use of CMake's Swift support. Enable all of the regex literal tests when ASTGen is built, to ensure everything is working. Remove the "AST" and "Parse" Swift modules from SwiftCompilerSources, because they are no longer needed.
1 parent bc7139b commit 7159e72

Some content is hidden

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

53 files changed

+155
-500
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,9 @@ else()
241241
#include \"Basic/BasicBridging.h\"
242242
#include \"Basic/SourceLoc.h\"
243243
244-
#include \"AST/ASTBridging.h\"
245-
#include \"AST/DiagnosticEngine.h\"
246-
#include \"AST/DiagnosticConsumer.h\"
247-
248244
#include \"SIL/SILBridging.h\"
249245
250246
#include \"SILOptimizer/OptimizerBridging.h\"
251-
252-
#include \"Parse/RegexParserBridging.h\"
253247
")
254248
add_custom_command(
255249
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/HeaderDependencies.cpp"

SwiftCompilerSources/Package.swift

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,22 @@ let package = Package(
4848
.library(
4949
name: "swiftCompilerModules",
5050
type: .static,
51-
targets: ["Basic", "AST", "Parse", "SIL", "Optimizer", "_CompilerRegexParser"]),
51+
targets: ["Basic", "SIL", "Optimizer"]),
5252
],
5353
dependencies: [
5454
],
5555
// Note that targets and their dependencies must align with
5656
// 'SwiftCompilerSources/Sources/CMakeLists.txt'
5757
targets: [
58-
.compilerModuleTarget(
59-
name: "_CompilerRegexParser",
60-
dependencies: [],
61-
path: "_RegexParser_Sources",
62-
swiftSettings: [
63-
// Workaround until `_CompilerRegexParser` is imported as implementation-only
64-
// by `_StringProcessing`.
65-
.unsafeFlags([
66-
"-Xfrontend",
67-
"-disable-implicit-string-processing-module-import"
68-
])]),
6958
.compilerModuleTarget(
7059
name: "Basic",
7160
dependencies: []),
72-
.compilerModuleTarget(
73-
name: "AST",
74-
dependencies: ["Basic"]),
75-
.compilerModuleTarget(
76-
name: "Parse",
77-
dependencies: ["Basic", "AST", "_CompilerRegexParser"]),
7861
.compilerModuleTarget(
7962
name: "SIL",
8063
dependencies: ["Basic"]),
8164
.compilerModuleTarget(
8265
name: "Optimizer",
83-
dependencies: ["Basic", "SIL", "Parse"]),
66+
dependencies: ["Basic", "SIL"]),
8467
],
8568
cxxLanguageStandard: .cxx17
8669
)

SwiftCompilerSources/Sources/AST/CMakeLists.txt

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

SwiftCompilerSources/Sources/AST/DiagnosticEngine.swift

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

SwiftCompilerSources/Sources/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
# NOTE: Subdirectories must be added in dependency order.
1010

11-
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
12-
add_subdirectory(_RegexParser)
13-
endif()
1411
add_subdirectory(Basic)
15-
add_subdirectory(AST)
16-
add_subdirectory(Parse)
1712
add_subdirectory(SIL)
1813
add_subdirectory(Optimizer)

SwiftCompilerSources/Sources/Optimizer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
88

99
set(dependencies)
10-
list(APPEND dependencies Basic SIL Parse)
10+
list(APPEND dependencies Basic SIL)
1111

1212
add_swift_compiler_module(Optimizer DEPENDS ${dependencies})
1313

SwiftCompilerSources/Sources/Optimizer/PassManager/PassRegistration.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212

1313
import SIL
1414
import OptimizerBridging
15-
import Parse
1615

1716
@_cdecl("initializeSwiftModules")
1817
public func initializeSwiftModules() {
1918
registerSILClasses()
2019
registerSwiftAnalyses()
2120
registerSwiftPasses()
22-
initializeSwiftParseModules()
2321
}
2422

2523
private func registerPass(

SwiftCompilerSources/Sources/Parse/CMakeLists.txt

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

SwiftCompilerSources/Sources/Parse/Parse.swift

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

SwiftCompilerSources/Sources/_RegexParser/CMakeLists.txt

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

SwiftCompilerSources/_RegexParser_Sources

Lines changed: 0 additions & 1 deletion
This file was deleted.

SwiftCompilerSources/stubs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
extern "C" {
1414

1515
void initializeSwiftModules();
16-
void initializeSwiftParseModules();
1716

1817
}
1918

2019
void initializeSwiftModules() {}
21-
void initializeSwiftParseModules() {}

include/module.modulemap

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ module CBasicBridging {
1212

1313
module ASTBridging {
1414
header "swift/AST/AnyFunctionRef.h"
15-
header "swift/AST/ASTBridging.h"
1615
header "swift/AST/Builtins.h"
17-
header "swift/AST/DiagnosticEngine.h"
18-
header "swift/AST/DiagnosticConsumer.h"
1916
header "swift/AST/ForeignAsyncConvention.h"
2017
header "swift/AST/ForeignErrorConvention.h"
2118
header "swift/AST/SubstitutionMap.h"
@@ -41,8 +38,3 @@ module OptimizerBridging {
4138
header "swift/SILOptimizer/OptimizerBridging.h"
4239
export *
4340
}
44-
45-
module _RegexParserBridging {
46-
header "swift/Parse/RegexParserBridging.h"
47-
export *
48-
}

include/swift/AST/ASTBridging.h

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

0 commit comments

Comments
 (0)