1515
1616#include " swift/Basic/ArrayRefView.h"
1717#include " swift/Basic/PathRemapper.h"
18+ #include " swift/Basic/TaggedUnion.h"
1819#include " llvm/ADT/Hashing.h"
1920#include " llvm/ADT/IntrusiveRefCntPtr.h"
2021#include " llvm/ADT/StringMap.h"
@@ -34,7 +35,6 @@ enum class ModuleSearchPathKind {
3435 Framework,
3536 DarwinImplicitFramework,
3637 RuntimeLibrary,
37- CompilerPlugin,
3838};
3939
4040// / A single module search path that can come from different sources, e.g.
@@ -187,6 +187,26 @@ struct ExternalPluginSearchPathAndServerPath {
187187 std::string ServerPath;
188188};
189189
190+ namespace PluginSearchOption {
191+ struct LoadPluginLibrary {
192+ std::string LibraryPath;
193+ };
194+ struct LoadPluginExecutable {
195+ std::string ExecutablePath;
196+ std::vector<std::string> ModuleNames;
197+ };
198+ struct PluginPath {
199+ std::string SearchPath;
200+ };
201+ struct ExternalPluginPath {
202+ std::string SearchPath;
203+ std::string ServerPath;
204+ };
205+
206+ using Value = TaggedUnion<LoadPluginLibrary, LoadPluginExecutable, PluginPath,
207+ ExternalPluginPath>;
208+ } // namespace PluginSearchOption
209+
190210// / Options for controlling search path behavior.
191211class SearchPathOptions {
192212 // / To call \c addImportSearchPath and \c addFrameworkSearchPath from
@@ -259,14 +279,6 @@ class SearchPathOptions {
259279 ImportSearchPaths.size () - 1 );
260280 }
261281
262- void addCompilerPluginLibraryPath (StringRef Path, llvm::vfs::FileSystem *FS) {
263- CompilerPluginLibraryPaths.push_back (Path.str ());
264- Lookup.searchPathAdded (FS, CompilerPluginLibraryPaths.back (),
265- ModuleSearchPathKind::CompilerPlugin,
266- /* isSystem=*/ false ,
267- CompilerPluginLibraryPaths.size () - 1 );
268- }
269-
270282 // / Add a single framework search path. Must only be called from
271283 // / \c ASTContext::addSearchPath.
272284 void addFrameworkSearchPath (FrameworkSearchPath NewPath,
@@ -355,27 +367,6 @@ class SearchPathOptions {
355367 Lookup.searchPathsDidChange ();
356368 }
357369
358- void setCompilerPluginLibraryPaths (
359- std::vector<std::string> NewCompilerPluginLibraryPaths) {
360- CompilerPluginLibraryPaths = NewCompilerPluginLibraryPaths;
361- Lookup.searchPathsDidChange ();
362- }
363-
364- ArrayRef<std::string> getCompilerPluginLibraryPaths () const {
365- return CompilerPluginLibraryPaths;
366- }
367-
368- void setCompilerPluginExecutablePaths (
369- std::vector<PluginExecutablePathAndModuleNames> &&newValue) {
370- CompilerPluginExecutablePaths = std::move (newValue);
371- Lookup.searchPathsDidChange ();
372- }
373-
374- ArrayRef<PluginExecutablePathAndModuleNames>
375- getCompilerPluginExecutablePaths () const {
376- return CompilerPluginExecutablePaths;
377- }
378-
379370 // / Path(s) to virtual filesystem overlay YAML files.
380371 std::vector<std::string> VFSOverlayFiles;
381372
@@ -391,15 +382,8 @@ class SearchPathOptions {
391382 // / preference.
392383 std::vector<std::string> RuntimeLibraryPaths;
393384
394- // / Paths that contain compiler plugins loaded on demand for, e.g.,
395- // / macro implementations.
396- std::vector<std::string> PluginSearchPaths;
397-
398- // / Pairs of external compiler plugin search paths and the corresponding
399- // / plugin server executables.
400- // / e.g. {"/path/to/usr/lib/swift/host/plugins",
401- // / "/path/to/usr/bin/plugin-server"}
402- std::vector<ExternalPluginSearchPathAndServerPath> ExternalPluginSearchPaths;
385+ // / Plugin search path options.
386+ std::vector<PluginSearchOption::Value> PluginSearchOpts;
403387
404388 // / Don't look in for compiler-provided modules.
405389 bool SkipRuntimeLibraryImportPaths = false ;
0 commit comments