[Macros] In-process plugin server

Separate swift-syntax libs for the compiler and for the library plugins.
Compiler communicates with library plugins using serialized messages
just like executable plugins.

* `lib/swift/host/compiler/lib_Compiler*.dylib`(`lib/CompilerSwiftSyntax`):
  swift-syntax libraries for compiler. Library evolution is disabled.
* Compiler (`ASTGen` and `swiftIDEUtilsBridging`) only depends on
  `lib/swift/host/compiler` libraries.
* `SwiftInProcPluginServer`: In-process plugin server shared library.
  This has one `swift_inproc_plugins_handle_message` entry point that
  receives a message and return the response.
* In the compiler
  * Add `-in-process-plugin-server-path` front-end option, which specifies
    the `SwiftInProcPluginServer` shared library path.
  * Remove `LoadedLibraryPlugin`, because all library plugins are managed
    by `SwiftInProcPluginServer`
  * Introduce abstract `CompilerPlugin` class that has 2 subclasses:
    * `LoadedExecutablePlugin` existing class that represents an
      executable plugin
    * `InProcessPlugins` wraps `dlopen`ed `SwiftInProcPluginServer`
  * Unified the code path in `TypeCheckMacros.cpp` and `ASTGen`, the
    difference between executable plugins and library plugins are now
    abstracted by `CompilerPlugin`
This commit is contained in:
Rintaro Ishizaki
2024-05-21 12:56:52 -07:00
parent af1d6017f9
commit 2f7aa428db
42 changed files with 699 additions and 893 deletions

View File

@@ -1983,6 +1983,9 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
}
Opts.setFrameworkSearchPaths(FrameworkSearchPaths);
if (const Arg *A = Args.getLastArg(OPT_in_process_plugin_server_path))
Opts.InProcessPluginServerPath = A->getValue();
// All plugin search options, i.e. '-load-plugin-library',
// '-load-plugin-executable', '-plugin-path', and '-external-plugin-path'
// are grouped, and plugins are searched by the order of these options.