-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SourceKit] Use a single PluginRegistry in multiple ASTContexts #64655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -534,6 +534,8 @@ struct ASTContext::Implementation { | |
/// Map a module name to an executable plugin path that provides the module. | ||
llvm::DenseMap<Identifier, StringRef> ExecutablePluginPaths; | ||
|
||
llvm::StringSet<> LoadedPluginLibraryPaths; | ||
|
||
/// The permanent arena. | ||
Arena Permanent; | ||
|
||
|
@@ -6395,6 +6397,9 @@ LoadedExecutablePlugin *ASTContext::loadExecutablePlugin(StringRef path) { | |
} | ||
|
||
void *ASTContext::loadLibraryPlugin(StringRef path) { | ||
// Remember the path (even if it fails to load.) | ||
getImpl().LoadedPluginLibraryPaths.insert(path); | ||
Comment on lines
6399
to
+6401
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to track failed libraries? If not, I can just move this after Also, do we want the VFS path or the "real" path here? I guess it doesn't matter because we only use this to get the module name from the filename. cc: @rxwei |
||
|
||
SmallString<128> resolvedPath; | ||
auto fs = this->SourceMgr.getFileSystem(); | ||
if (auto err = fs->getRealPath(path, resolvedPath)) { | ||
|
@@ -6413,6 +6418,10 @@ void *ASTContext::loadLibraryPlugin(StringRef path) { | |
return plugin.get(); | ||
} | ||
|
||
const llvm::StringSet<> &ASTContext::getLoadedPluginLibraryPaths() const { | ||
return getImpl().LoadedPluginLibraryPaths; | ||
} | ||
|
||
bool ASTContext::supportsMoveOnlyTypes() const { | ||
// currently the only thing holding back whether the types can appear is this. | ||
return SILOpts.LexicalLifetimes != LexicalLifetimesOption::Off; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getLoadedLibraryPlugins()
needs to lock this, too.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to remove
getLoadedLibraryPlugins()
method in follow-ups soon.Currently only
swift::emitLoadedModuleTraceIfNeeded()
is using it for dependency tracking. However since PluginRegistry might be shared between different compilations,getLoadedLibraryPlugins()
may contain unrelated entries. Instead, each ASTContext should track loaded libraries separately.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a commit in this PR removing
PluginRegistry::getLoadedLibraryPlugins()
.