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.
These libraries are built statically for static linking. SPM currently
does not support libraries, and this will ensure that we properly build
the library target for consumption into the compiler.
As the headers are not part of the Swift package, the safe header search
option cannot be used. The use of the unsafe flags enables building the
package on Windows.
Use the `cxxSettings` to pass along header search paths. With those
removed, we are simply adding the interoperability mode and unsafe
flags, which we can inline. This simplifies the package definition a
bit.
Mark the Swift flags for interoperability mode rather than using the old
spelling for enabling C++ interoperability. This is important as it
allows the `cxxLanguageStandard` to flow through to the clang importer
which is required to enable the use of the C++ headers.
This will allow using Swift headers that include Clang headers from SwiftCompilerSources.
For example, some headers in `swift/Basic` include headers from `clang/Basic`. Currently adding those Swift headers to the modulemap causes a build error.
`Package.swift` in the build directory and symlinking Sources directory
wasn't great for source control and break points. Since C modules doesn't
need the generated headers at this point, make `Package.swift` static
again with a symlink to the string processing source directory.
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
We add a new flag to disable the implicit import of `_StringProcessing`, similar to `-disable-implicit-concurrency-module-import`. We need this to build `_RegexParser` when `-enable-experimental-string-processing` is enabled by default, because `_StringProcessing` currently imports `_RegexParser` publicly (non-implementation-only).
As the _MatchingEngine module no longer contains the matching engine, this patch renames this module to describe its role more accurately. Because this module primarily contains the AST and the regex parsing logic, I propose we rename it to "_RegexParser".
Also renames the ExperimentalRegex module in SwiftCompilerSources to _RegexParser for consistency. This would prevent errors if sources in _RegexParser used qualified lookup with the module name.