@@ -2102,9 +2102,9 @@ ProcessModule(ModuleSP module_sp, std::string m_description,
2102
2102
2103
2103
const auto &opts = invocation.getSearchPathOptions ();
2104
2104
module_search_paths.insert (module_search_paths.end (),
2105
- opts.ImportSearchPaths .begin (),
2106
- opts.ImportSearchPaths .end ());
2107
- for (const auto &fwsp : opts.FrameworkSearchPaths )
2105
+ opts.getImportSearchPaths () .begin (),
2106
+ opts.getImportSearchPaths () .end ());
2107
+ for (const auto &fwsp : opts.getFrameworkSearchPaths () )
2108
2108
framework_search_paths.push_back ({fwsp.Path , fwsp.IsSystem });
2109
2109
auto &clang_opts = invocation.getClangImporterOptions ().ExtraArgs ;
2110
2110
for (const std::string &arg : clang_opts) {
@@ -2685,8 +2685,8 @@ void SwiftASTContext::InitializeSearchPathOptions(
2685
2685
}
2686
2686
2687
2687
llvm::StringMap<bool > processed;
2688
- std::vector<std::string> & invocation_import_paths =
2689
- invocation.getSearchPathOptions ().ImportSearchPaths ;
2688
+ std::vector<std::string> invocation_import_paths (
2689
+ invocation.getSearchPathOptions ().getImportSearchPaths ()) ;
2690
2690
// Add all deserialized paths to the map.
2691
2691
for (const auto &path : invocation_import_paths)
2692
2692
processed.insert ({path, false });
@@ -2697,11 +2697,14 @@ void SwiftASTContext::InitializeSearchPathOptions(
2697
2697
if (it_notseen.second )
2698
2698
invocation_import_paths.push_back (path);
2699
2699
}
2700
+ invocation.getSearchPathOptions ().setImportSearchPaths (
2701
+ invocation_import_paths);
2700
2702
2701
2703
// This preserves the IsSystem bit, but deduplicates entries ignoring it.
2702
2704
processed.clear ();
2703
- auto &invocation_framework_paths =
2704
- invocation.getSearchPathOptions ().FrameworkSearchPaths ;
2705
+ std::vector<swift::SearchPathOptions::FrameworkSearchPath>
2706
+ invocation_framework_paths (
2707
+ invocation.getSearchPathOptions ().getFrameworkSearchPaths ());
2705
2708
// Add all deserialized paths to the map.
2706
2709
for (const auto &path : invocation_framework_paths)
2707
2710
processed.insert ({path.Path , path.IsSystem });
@@ -2712,6 +2715,8 @@ void SwiftASTContext::InitializeSearchPathOptions(
2712
2715
if (it_notseen.second )
2713
2716
invocation_framework_paths.push_back ({path.first , path.second });
2714
2717
}
2718
+ invocation.getSearchPathOptions ().setFrameworkSearchPaths (
2719
+ invocation_framework_paths);
2715
2720
}
2716
2721
2717
2722
namespace lldb_private {
@@ -3373,7 +3378,8 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
3373
3378
std::string moduleCachePath = " " ;
3374
3379
std::unique_ptr<swift::ClangImporter> clang_importer_ap;
3375
3380
auto &clang_importer_options = GetClangImporterOptions ();
3376
- if (!m_ast_context_ap->SearchPathOpts .SDKPath .empty () || TargetHasNoSDK ()) {
3381
+ if (!m_ast_context_ap->SearchPathOpts .getSDKPath ().empty () ||
3382
+ TargetHasNoSDK ()) {
3377
3383
if (!clang_importer_options.OverrideResourceDir .empty ()) {
3378
3384
// Create the DWARFImporterDelegate.
3379
3385
const auto &props = ModuleList::GetGlobalModuleListProperties ();
@@ -3431,7 +3437,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
3431
3437
if (!sdk_version) {
3432
3438
auto SDKInfoOrErr = clang::parseDarwinSDKInfo (
3433
3439
*llvm::vfs::getRealFileSystem (),
3434
- m_ast_context_ap->SearchPathOpts .SDKPath );
3440
+ m_ast_context_ap->SearchPathOpts .getSDKPath () );
3435
3441
if (SDKInfoOrErr) {
3436
3442
if (auto SDKInfo = *SDKInfoOrErr)
3437
3443
sdk_version = swift::getTargetSDKVersion (*SDKInfo, triple);
@@ -3732,16 +3738,17 @@ swift::ModuleDecl *SwiftASTContext::GetModule(const FileSpec &module_spec,
3732
3738
3733
3739
std::string module_directory (module_spec.GetDirectory ().GetCString ());
3734
3740
bool add_search_path = true ;
3735
- for (auto path : ast->SearchPathOpts .ImportSearchPaths ) {
3741
+ for (auto path : ast->SearchPathOpts .getImportSearchPaths () ) {
3736
3742
if (path == module_directory) {
3737
3743
add_search_path = false ;
3738
3744
break ;
3739
3745
}
3740
3746
}
3741
3747
// Add the search path if needed so we can find the module by basename.
3742
- if (add_search_path)
3743
- ast->SearchPathOpts .ImportSearchPaths .push_back (
3744
- std::move (module_directory));
3748
+ if (add_search_path) {
3749
+ ast->addSearchPath (module_directory, /* isFramework=*/ false ,
3750
+ /* isSystem=*/ false );
3751
+ }
3745
3752
3746
3753
typedef swift::Located<swift::Identifier> ModuleNameSpec;
3747
3754
llvm::StringRef module_basename_sref (module_basename.GetCString ());
@@ -3940,7 +3947,8 @@ void SwiftASTContext::LoadModule(swift::ModuleDecl *swift_module,
3940
3947
std::vector<std::string> uniqued_paths;
3941
3948
3942
3949
for (const auto &framework_search_dir :
3943
- swift_module->getASTContext ().SearchPathOpts .FrameworkSearchPaths ) {
3950
+ swift_module->getASTContext ()
3951
+ .SearchPathOpts .getFrameworkSearchPaths ()) {
3944
3952
// The framework search dir as it comes from the AST context
3945
3953
// often has duplicate entries, don't try to load along the
3946
3954
// same path twice.
@@ -5138,8 +5146,9 @@ void SwiftASTContext::LogConfiguration() {
5138
5146
5139
5147
HEALTH_LOG_PRINTF (" Architecture : %s" ,
5140
5148
m_ast_context_ap->LangOpts .Target .getTriple ().c_str ());
5141
- HEALTH_LOG_PRINTF (" SDK path : %s" ,
5142
- m_ast_context_ap->SearchPathOpts .SDKPath .c_str ());
5149
+ HEALTH_LOG_PRINTF (
5150
+ " SDK path : %s" ,
5151
+ m_ast_context_ap->SearchPathOpts .getSDKPath ().str ().c_str ());
5143
5152
HEALTH_LOG_PRINTF (
5144
5153
" Runtime resource path : %s" ,
5145
5154
m_ast_context_ap->SearchPathOpts .RuntimeResourcePath .c_str ());
@@ -5154,26 +5163,29 @@ void SwiftASTContext::LogConfiguration() {
5154
5163
5155
5164
HEALTH_LOG_PRINTF (" Runtime library import paths : (%llu items)" ,
5156
5165
(unsigned long long )m_ast_context_ap->SearchPathOpts
5157
- .RuntimeLibraryImportPaths .size ());
5166
+ .getRuntimeLibraryImportPaths ()
5167
+ .size ());
5158
5168
5159
5169
for (const auto &runtime_import_path :
5160
- m_ast_context_ap->SearchPathOpts .RuntimeLibraryImportPaths ) {
5170
+ m_ast_context_ap->SearchPathOpts .getRuntimeLibraryImportPaths () ) {
5161
5171
HEALTH_LOG_PRINTF (" %s" , runtime_import_path.c_str ());
5162
5172
}
5163
5173
5164
5174
HEALTH_LOG_PRINTF (" Framework search paths : (%llu items)" ,
5165
5175
(unsigned long long )m_ast_context_ap->SearchPathOpts
5166
- .FrameworkSearchPaths .size ());
5176
+ .getFrameworkSearchPaths ()
5177
+ .size ());
5167
5178
for (const auto &framework_search_path :
5168
- m_ast_context_ap->SearchPathOpts .FrameworkSearchPaths ) {
5179
+ m_ast_context_ap->SearchPathOpts .getFrameworkSearchPaths () ) {
5169
5180
HEALTH_LOG_PRINTF (" %s" , framework_search_path.Path .c_str ());
5170
5181
}
5171
5182
5172
5183
HEALTH_LOG_PRINTF (" Import search paths : (%llu items)" ,
5173
5184
(unsigned long long )m_ast_context_ap->SearchPathOpts
5174
- .ImportSearchPaths .size ());
5175
- for (std::string &import_search_path :
5176
- m_ast_context_ap->SearchPathOpts .ImportSearchPaths ) {
5185
+ .getImportSearchPaths ()
5186
+ .size ());
5187
+ for (const std::string &import_search_path :
5188
+ m_ast_context_ap->SearchPathOpts .getImportSearchPaths ()) {
5177
5189
HEALTH_LOG_PRINTF (" %s" , import_search_path.c_str ());
5178
5190
}
5179
5191
0 commit comments