-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Macros] Create plugin search lookup table. #66722
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
Conversation
@swift-ci Please smoke test |
lib/AST/PluginLoader.cpp
Outdated
const PluginLoader::PluginEntry & | ||
PluginLoader::lookupPluginByModuleName(Identifier moduleName) { | ||
auto &map = getPluginMap(); | ||
auto found = getPluginMap().find(moduleName); |
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.
auto found = getPluginMap().find(moduleName); | |
auto found = map.find(moduleName); |
5ba7f10
to
16386aa
Compare
@swift-ci Please smoke test |
include/swift/AST/PluginLoader.h
Outdated
@@ -28,6 +28,10 @@ class ASTContext; | |||
/// * Load plugins resolving VFS paths | |||
/// * Track plugin dependencies | |||
class PluginLoader { | |||
public: | |||
using PluginEntry = std::pair<StringRef, StringRef>; |
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.
Thought's on making this its own type?
struct PluginEntry {
StringRef libPath;
StringRef executablePath;
};
lib/AST/PluginLoader.cpp
Outdated
auto fs = Ctx.SourceMgr.getFileSystem(); | ||
|
||
// Look for 'lib${module name}(.dylib|.so)'. | ||
/// Get plug module name from \p path if the path looks like a shared library |
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.
/// Get plug module name from \p path if the path looks like a shared library | |
/// Get plugin module name from \p path if the path looks like a shared library |
lib/AST/PluginLoader.cpp
Outdated
// FIXME: layering violation / circular linkage. | ||
// libAST should not call libParse. |
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.
Can... we just not 😅?
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.
To expand on this - sure, we might have an identifier in the map that isn't a valid. But we wouldn't be able to look it up, so it seems harmless to me.
16386aa
to
4ca6bac
Compare
@swift-ci Please smoke test |
4ca6bac
to
a27646f
Compare
@swift-ci Please smoke test |
Iterating all options and potential file system access is not great for every plugin lookup request. Instead, lazily create a single lookup table keyed by module name.
a27646f
to
b8a073c
Compare
@swift-ci Please smoke test |
Iterating all options and potential file system access is not great for every plugin lookup request. Instead, lazily create a single lookup table keyed by module name.