mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #64376 from rintaro/macros-plugin-server
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
@@ -6348,15 +6349,30 @@ Type ASTContext::getNamedSwiftType(ModuleDecl *module, StringRef name) {
|
||||
return decl->getDeclaredInterfaceType();
|
||||
}
|
||||
|
||||
LoadedExecutablePlugin *
|
||||
Optional<StringRef>
|
||||
ASTContext::lookupExecutablePluginByModuleName(Identifier moduleName) {
|
||||
auto &execPluginPaths = getImpl().ExecutablePluginPaths;
|
||||
auto found = execPluginPaths.find(moduleName);
|
||||
if (found == execPluginPaths.end())
|
||||
return nullptr;
|
||||
return None;
|
||||
return found->second;
|
||||
}
|
||||
|
||||
// Let the VFS to map the path.
|
||||
auto &path = found->second;
|
||||
Optional<std::pair<std::string, std::string>>
|
||||
ASTContext::lookupExternalLibraryPluginByModuleName(Identifier moduleName) {
|
||||
auto fs = this->SourceMgr.getFileSystem();
|
||||
for (auto &pair : SearchPathOpts.ExternalPluginSearchPaths) {
|
||||
SmallString<128> fullPath(pair.SearchPath);
|
||||
llvm::sys::path::append(fullPath, "lib" + moduleName.str() + LTDL_SHLIB_EXT);
|
||||
|
||||
if (fs->exists(fullPath)) {
|
||||
return {{std::string(fullPath), pair.ServerPath}};
|
||||
}
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
||||
LoadedExecutablePlugin *ASTContext::loadExecutablePlugin(StringRef path) {
|
||||
SmallString<128> resolvedPath;
|
||||
auto fs = this->SourceMgr.getFileSystem();
|
||||
if (auto err = fs->getRealPath(path, resolvedPath)) {
|
||||
|
||||
Reference in New Issue
Block a user