File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,11 @@ class HostInfoBase {
147
147
FileSpec &lldb_shlib_spec, FileSpec &file_spec, bool verify) {
148
148
return false ;
149
149
}
150
+
151
+ // / Return the default set of library paths to search in. This allows a
152
+ // / platform specific extension for system libraries that may need to be
153
+ // / resolved (e.g. `/usr/lib` on Unicies and `Path` on Windows).
154
+ static std::vector<std::string> GetSwiftLibrarySearchPaths () { return {}; }
150
155
#endif
151
156
152
157
protected:
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class HostInfoWindows : public HostInfoBase {
42
42
static bool ComputeSwiftResourceDirectory (FileSpec &lldb_shlib_spec,
43
43
FileSpec &file_spec, bool verify);
44
44
static llvm::Expected<llvm::StringRef> GetSDKRoot (SDKOptions options);
45
+ static std::vector<std::string> GetSwiftLibrarySearchPaths ();
45
46
#endif
46
47
47
48
private:
Original file line number Diff line number Diff line change 13
13
#include " lldb/Utility/FileSpec.h"
14
14
#include " lldb/Utility/LLDBLog.h"
15
15
#include " lldb/Utility/Log.h"
16
+
17
+ #include < llvm/ADT/STLExtras.h>
18
+ #include < llvm/ADT/StringExtras.h>
19
+ #include < llvm/ADT/StringRef.h>
16
20
#include < llvm/Support/ConvertUTF.h>
17
21
22
+ #include < cstdlib>
18
23
#include < string>
24
+ #include < vector>
19
25
20
26
using namespace lldb_private ;
21
27
@@ -60,3 +66,17 @@ llvm::Expected<llvm::StringRef> HostInfoWindows::GetSDKRoot(SDKOptions options)
60
66
return g_sdkroot;
61
67
return llvm::make_error<HostInfoError>(" `SDKROOT` is unset" );
62
68
}
69
+
70
+ std::vector<std::string> HostInfoWindows::GetSwiftLibrarySearchPaths () {
71
+ static std::once_flag g_flag;
72
+ static std::vector<std::string> g_library_paths;
73
+
74
+ std::call_once (g_flag, []() {
75
+ llvm::for_each (llvm::split (std::getenv (" Path" ), " ;" ),
76
+ [](llvm::StringRef path) {
77
+ g_library_paths.emplace_back (path);
78
+ });
79
+ });
80
+
81
+ return g_library_paths;
82
+ }
Original file line number Diff line number Diff line change @@ -3233,6 +3233,8 @@ GetLibrarySearchPaths(const swift::SearchPathOptions &search_path_opts) {
3233
3233
paths.push_back (path);
3234
3234
for (std::string path : search_path_opts.LibrarySearchPaths )
3235
3235
paths.push_back (path);
3236
+ for (const std::string &path : HostInfo::GetSwiftLibrarySearchPaths ())
3237
+ paths.emplace_back (path);
3236
3238
return paths;
3237
3239
}
3238
3240
You can’t perform that action at this time.
0 commit comments