@@ -2115,9 +2115,9 @@ ProcessModule(ModuleSP module_sp, std::string m_description,
2115
2115
2116
2116
const auto &opts = invocation.getSearchPathOptions ();
2117
2117
module_search_paths.insert (module_search_paths.end (),
2118
- opts.ImportSearchPaths .begin (),
2119
- opts.ImportSearchPaths .end ());
2120
- for (const auto &fwsp : opts.FrameworkSearchPaths )
2118
+ opts.getImportSearchPaths () .begin (),
2119
+ opts.getImportSearchPaths () .end ());
2120
+ for (const auto &fwsp : opts.getFrameworkSearchPaths () )
2121
2121
framework_search_paths.push_back ({fwsp.Path , fwsp.IsSystem });
2122
2122
auto &clang_opts = invocation.getClangImporterOptions ().ExtraArgs ;
2123
2123
for (const std::string &arg : clang_opts) {
@@ -2698,8 +2698,8 @@ void SwiftASTContext::InitializeSearchPathOptions(
2698
2698
}
2699
2699
2700
2700
llvm::StringMap<bool > processed;
2701
- std::vector<std::string> & invocation_import_paths =
2702
- invocation.getSearchPathOptions ().ImportSearchPaths ;
2701
+ std::vector<std::string> invocation_import_paths (
2702
+ invocation.getSearchPathOptions ().getImportSearchPaths ()) ;
2703
2703
// Add all deserialized paths to the map.
2704
2704
for (const auto &path : invocation_import_paths)
2705
2705
processed.insert ({path, false });
@@ -2710,11 +2710,14 @@ void SwiftASTContext::InitializeSearchPathOptions(
2710
2710
if (it_notseen.second )
2711
2711
invocation_import_paths.push_back (path);
2712
2712
}
2713
+ invocation.getSearchPathOptions ().setImportSearchPaths (
2714
+ invocation_import_paths);
2713
2715
2714
2716
// This preserves the IsSystem bit, but deduplicates entries ignoring it.
2715
2717
processed.clear ();
2716
- auto &invocation_framework_paths =
2717
- invocation.getSearchPathOptions ().FrameworkSearchPaths ;
2718
+ std::vector<swift::SearchPathOptions::FrameworkSearchPath>
2719
+ invocation_framework_paths (
2720
+ invocation.getSearchPathOptions ().getFrameworkSearchPaths ());
2718
2721
// Add all deserialized paths to the map.
2719
2722
for (const auto &path : invocation_framework_paths)
2720
2723
processed.insert ({path.Path , path.IsSystem });
@@ -2725,6 +2728,8 @@ void SwiftASTContext::InitializeSearchPathOptions(
2725
2728
if (it_notseen.second )
2726
2729
invocation_framework_paths.push_back ({path.first , path.second });
2727
2730
}
2731
+ invocation.getSearchPathOptions ().setFrameworkSearchPaths (
2732
+ invocation_framework_paths);
2728
2733
}
2729
2734
2730
2735
namespace lldb_private {
@@ -3384,7 +3389,8 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
3384
3389
std::string moduleCachePath = " " ;
3385
3390
std::unique_ptr<swift::ClangImporter> clang_importer_ap;
3386
3391
auto &clang_importer_options = GetClangImporterOptions ();
3387
- if (!m_ast_context_ap->SearchPathOpts .SDKPath .empty () || TargetHasNoSDK ()) {
3392
+ if (!m_ast_context_ap->SearchPathOpts .getSDKPath ().empty () ||
3393
+ TargetHasNoSDK ()) {
3388
3394
if (!clang_importer_options.OverrideResourceDir .empty ()) {
3389
3395
// Create the DWARFImporterDelegate.
3390
3396
const auto &props = ModuleList::GetGlobalModuleListProperties ();
@@ -3442,7 +3448,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
3442
3448
if (!sdk_version) {
3443
3449
auto SDKInfoOrErr = clang::parseDarwinSDKInfo (
3444
3450
*llvm::vfs::getRealFileSystem (),
3445
- m_ast_context_ap->SearchPathOpts .SDKPath );
3451
+ m_ast_context_ap->SearchPathOpts .getSDKPath () );
3446
3452
if (SDKInfoOrErr) {
3447
3453
if (auto SDKInfo = *SDKInfoOrErr)
3448
3454
sdk_version = swift::getTargetSDKVersion (*SDKInfo, triple);
@@ -3743,16 +3749,17 @@ swift::ModuleDecl *SwiftASTContext::GetModule(const FileSpec &module_spec,
3743
3749
3744
3750
std::string module_directory (module_spec.GetDirectory ().GetCString ());
3745
3751
bool add_search_path = true ;
3746
- for (auto path : ast->SearchPathOpts .ImportSearchPaths ) {
3752
+ for (auto path : ast->SearchPathOpts .getImportSearchPaths () ) {
3747
3753
if (path == module_directory) {
3748
3754
add_search_path = false ;
3749
3755
break ;
3750
3756
}
3751
3757
}
3752
3758
// Add the search path if needed so we can find the module by basename.
3753
- if (add_search_path)
3754
- ast->SearchPathOpts .ImportSearchPaths .push_back (
3755
- std::move (module_directory));
3759
+ if (add_search_path) {
3760
+ ast->addSearchPath (module_directory, /* isFramework=*/ false ,
3761
+ /* isSystem=*/ false );
3762
+ }
3756
3763
3757
3764
typedef swift::Located<swift::Identifier> ModuleNameSpec;
3758
3765
llvm::StringRef module_basename_sref (module_basename.GetCString ());
@@ -3950,7 +3957,8 @@ void SwiftASTContext::LoadModule(swift::ModuleDecl *swift_module,
3950
3957
std::vector<std::string> uniqued_paths;
3951
3958
3952
3959
for (const auto &framework_search_dir :
3953
- swift_module->getASTContext ().SearchPathOpts .FrameworkSearchPaths ) {
3960
+ swift_module->getASTContext ()
3961
+ .SearchPathOpts .getFrameworkSearchPaths ()) {
3954
3962
// The framework search dir as it comes from the AST context
3955
3963
// often has duplicate entries, don't try to load along the
3956
3964
// same path twice.
@@ -5145,8 +5153,9 @@ void SwiftASTContext::LogConfiguration() {
5145
5153
5146
5154
HEALTH_LOG_PRINTF (" Architecture : %s" ,
5147
5155
m_ast_context_ap->LangOpts .Target .getTriple ().c_str ());
5148
- HEALTH_LOG_PRINTF (" SDK path : %s" ,
5149
- m_ast_context_ap->SearchPathOpts .SDKPath .c_str ());
5156
+ HEALTH_LOG_PRINTF (
5157
+ " SDK path : %s" ,
5158
+ m_ast_context_ap->SearchPathOpts .getSDKPath ().str ().c_str ());
5150
5159
HEALTH_LOG_PRINTF (
5151
5160
" Runtime resource path : %s" ,
5152
5161
m_ast_context_ap->SearchPathOpts .RuntimeResourcePath .c_str ());
@@ -5161,26 +5170,29 @@ void SwiftASTContext::LogConfiguration() {
5161
5170
5162
5171
HEALTH_LOG_PRINTF (" Runtime library import paths : (%llu items)" ,
5163
5172
(unsigned long long )m_ast_context_ap->SearchPathOpts
5164
- .RuntimeLibraryImportPaths .size ());
5173
+ .getRuntimeLibraryImportPaths ()
5174
+ .size ());
5165
5175
5166
5176
for (const auto &runtime_import_path :
5167
- m_ast_context_ap->SearchPathOpts .RuntimeLibraryImportPaths ) {
5177
+ m_ast_context_ap->SearchPathOpts .getRuntimeLibraryImportPaths () ) {
5168
5178
HEALTH_LOG_PRINTF (" %s" , runtime_import_path.c_str ());
5169
5179
}
5170
5180
5171
5181
HEALTH_LOG_PRINTF (" Framework search paths : (%llu items)" ,
5172
5182
(unsigned long long )m_ast_context_ap->SearchPathOpts
5173
- .FrameworkSearchPaths .size ());
5183
+ .getFrameworkSearchPaths ()
5184
+ .size ());
5174
5185
for (const auto &framework_search_path :
5175
- m_ast_context_ap->SearchPathOpts .FrameworkSearchPaths ) {
5186
+ m_ast_context_ap->SearchPathOpts .getFrameworkSearchPaths () ) {
5176
5187
HEALTH_LOG_PRINTF (" %s" , framework_search_path.Path .c_str ());
5177
5188
}
5178
5189
5179
5190
HEALTH_LOG_PRINTF (" Import search paths : (%llu items)" ,
5180
5191
(unsigned long long )m_ast_context_ap->SearchPathOpts
5181
- .ImportSearchPaths .size ());
5182
- for (std::string &import_search_path :
5183
- m_ast_context_ap->SearchPathOpts .ImportSearchPaths ) {
5192
+ .getImportSearchPaths ()
5193
+ .size ());
5194
+ for (const std::string &import_search_path :
5195
+ m_ast_context_ap->SearchPathOpts .getImportSearchPaths ()) {
5184
5196
HEALTH_LOG_PRINTF (" %s" , import_search_path.c_str ());
5185
5197
}
5186
5198
0 commit comments