@@ -2091,9 +2091,9 @@ ProcessModule(ModuleSP module_sp, std::string m_description,
2091
2091
2092
2092
const auto &opts = invocation.getSearchPathOptions ();
2093
2093
module_search_paths.insert (module_search_paths.end (),
2094
- opts.ImportSearchPaths .begin (),
2095
- opts.ImportSearchPaths .end ());
2096
- for (const auto &fwsp : opts.FrameworkSearchPaths )
2094
+ opts.getImportSearchPaths () .begin (),
2095
+ opts.getImportSearchPaths () .end ());
2096
+ for (const auto &fwsp : opts.getFrameworkSearchPaths () )
2097
2097
framework_search_paths.push_back ({fwsp.Path , fwsp.IsSystem });
2098
2098
auto &clang_opts = invocation.getClangImporterOptions ().ExtraArgs ;
2099
2099
for (const std::string &arg : clang_opts) {
@@ -2674,8 +2674,8 @@ void SwiftASTContext::InitializeSearchPathOptions(
2674
2674
}
2675
2675
2676
2676
llvm::StringMap<bool > processed;
2677
- std::vector<std::string> & invocation_import_paths =
2678
- invocation.getSearchPathOptions ().ImportSearchPaths ;
2677
+ std::vector<std::string> invocation_import_paths (
2678
+ invocation.getSearchPathOptions ().getImportSearchPaths ()) ;
2679
2679
// Add all deserialized paths to the map.
2680
2680
for (const auto &path : invocation_import_paths)
2681
2681
processed.insert ({path, false });
@@ -2686,11 +2686,14 @@ void SwiftASTContext::InitializeSearchPathOptions(
2686
2686
if (it_notseen.second )
2687
2687
invocation_import_paths.push_back (path);
2688
2688
}
2689
+ invocation.getSearchPathOptions ().setImportSearchPaths (
2690
+ invocation_import_paths);
2689
2691
2690
2692
// This preserves the IsSystem bit, but deduplicates entries ignoring it.
2691
2693
processed.clear ();
2692
- auto &invocation_framework_paths =
2693
- invocation.getSearchPathOptions ().FrameworkSearchPaths ;
2694
+ std::vector<swift::SearchPathOptions::FrameworkSearchPath>
2695
+ invocation_framework_paths (
2696
+ invocation.getSearchPathOptions ().getFrameworkSearchPaths ());
2694
2697
// Add all deserialized paths to the map.
2695
2698
for (const auto &path : invocation_framework_paths)
2696
2699
processed.insert ({path.Path , path.IsSystem });
@@ -2701,6 +2704,8 @@ void SwiftASTContext::InitializeSearchPathOptions(
2701
2704
if (it_notseen.second )
2702
2705
invocation_framework_paths.push_back ({path.first , path.second });
2703
2706
}
2707
+ invocation.getSearchPathOptions ().setFrameworkSearchPaths (
2708
+ invocation_framework_paths);
2704
2709
}
2705
2710
2706
2711
namespace lldb_private {
@@ -3362,7 +3367,8 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
3362
3367
std::string moduleCachePath = " " ;
3363
3368
std::unique_ptr<swift::ClangImporter> clang_importer_ap;
3364
3369
auto &clang_importer_options = GetClangImporterOptions ();
3365
- if (!m_ast_context_ap->SearchPathOpts .SDKPath .empty () || TargetHasNoSDK ()) {
3370
+ if (!m_ast_context_ap->SearchPathOpts .getSDKPath ().empty () ||
3371
+ TargetHasNoSDK ()) {
3366
3372
if (!clang_importer_options.OverrideResourceDir .empty ()) {
3367
3373
// Create the DWARFImporterDelegate.
3368
3374
const auto &props = ModuleList::GetGlobalModuleListProperties ();
@@ -3420,7 +3426,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
3420
3426
if (!sdk_version) {
3421
3427
auto SDKInfoOrErr = clang::parseDarwinSDKInfo (
3422
3428
*llvm::vfs::getRealFileSystem (),
3423
- m_ast_context_ap->SearchPathOpts .SDKPath );
3429
+ m_ast_context_ap->SearchPathOpts .getSDKPath () );
3424
3430
if (SDKInfoOrErr) {
3425
3431
if (auto SDKInfo = *SDKInfoOrErr)
3426
3432
sdk_version = swift::getTargetSDKVersion (*SDKInfo, triple);
@@ -3721,16 +3727,17 @@ swift::ModuleDecl *SwiftASTContext::GetModule(const FileSpec &module_spec,
3721
3727
3722
3728
std::string module_directory (module_spec.GetDirectory ().GetCString ());
3723
3729
bool add_search_path = true ;
3724
- for (auto path : ast->SearchPathOpts .ImportSearchPaths ) {
3730
+ for (auto path : ast->SearchPathOpts .getImportSearchPaths () ) {
3725
3731
if (path == module_directory) {
3726
3732
add_search_path = false ;
3727
3733
break ;
3728
3734
}
3729
3735
}
3730
3736
// Add the search path if needed so we can find the module by basename.
3731
- if (add_search_path)
3732
- ast->SearchPathOpts .ImportSearchPaths .push_back (
3733
- std::move (module_directory));
3737
+ if (add_search_path) {
3738
+ ast->addSearchPath (module_directory, /* isFramework=*/ false ,
3739
+ /* isSystem=*/ false );
3740
+ }
3734
3741
3735
3742
typedef swift::Located<swift::Identifier> ModuleNameSpec;
3736
3743
llvm::StringRef module_basename_sref (module_basename.GetCString ());
@@ -3929,7 +3936,8 @@ void SwiftASTContext::LoadModule(swift::ModuleDecl *swift_module,
3929
3936
std::vector<std::string> uniqued_paths;
3930
3937
3931
3938
for (const auto &framework_search_dir :
3932
- swift_module->getASTContext ().SearchPathOpts .FrameworkSearchPaths ) {
3939
+ swift_module->getASTContext ()
3940
+ .SearchPathOpts .getFrameworkSearchPaths ()) {
3933
3941
// The framework search dir as it comes from the AST context
3934
3942
// often has duplicate entries, don't try to load along the
3935
3943
// same path twice.
@@ -5127,8 +5135,9 @@ void SwiftASTContext::LogConfiguration() {
5127
5135
5128
5136
HEALTH_LOG_PRINTF (" Architecture : %s" ,
5129
5137
m_ast_context_ap->LangOpts .Target .getTriple ().c_str ());
5130
- HEALTH_LOG_PRINTF (" SDK path : %s" ,
5131
- m_ast_context_ap->SearchPathOpts .SDKPath .c_str ());
5138
+ HEALTH_LOG_PRINTF (
5139
+ " SDK path : %s" ,
5140
+ m_ast_context_ap->SearchPathOpts .getSDKPath ().str ().c_str ());
5132
5141
HEALTH_LOG_PRINTF (
5133
5142
" Runtime resource path : %s" ,
5134
5143
m_ast_context_ap->SearchPathOpts .RuntimeResourcePath .c_str ());
@@ -5143,26 +5152,29 @@ void SwiftASTContext::LogConfiguration() {
5143
5152
5144
5153
HEALTH_LOG_PRINTF (" Runtime library import paths : (%llu items)" ,
5145
5154
(unsigned long long )m_ast_context_ap->SearchPathOpts
5146
- .RuntimeLibraryImportPaths .size ());
5155
+ .getRuntimeLibraryImportPaths ()
5156
+ .size ());
5147
5157
5148
5158
for (const auto &runtime_import_path :
5149
- m_ast_context_ap->SearchPathOpts .RuntimeLibraryImportPaths ) {
5159
+ m_ast_context_ap->SearchPathOpts .getRuntimeLibraryImportPaths () ) {
5150
5160
HEALTH_LOG_PRINTF (" %s" , runtime_import_path.c_str ());
5151
5161
}
5152
5162
5153
5163
HEALTH_LOG_PRINTF (" Framework search paths : (%llu items)" ,
5154
5164
(unsigned long long )m_ast_context_ap->SearchPathOpts
5155
- .FrameworkSearchPaths .size ());
5165
+ .getFrameworkSearchPaths ()
5166
+ .size ());
5156
5167
for (const auto &framework_search_path :
5157
- m_ast_context_ap->SearchPathOpts .FrameworkSearchPaths ) {
5168
+ m_ast_context_ap->SearchPathOpts .getFrameworkSearchPaths () ) {
5158
5169
HEALTH_LOG_PRINTF (" %s" , framework_search_path.Path .c_str ());
5159
5170
}
5160
5171
5161
5172
HEALTH_LOG_PRINTF (" Import search paths : (%llu items)" ,
5162
5173
(unsigned long long )m_ast_context_ap->SearchPathOpts
5163
- .ImportSearchPaths .size ());
5164
- for (std::string &import_search_path :
5165
- m_ast_context_ap->SearchPathOpts .ImportSearchPaths ) {
5174
+ .getImportSearchPaths ()
5175
+ .size ());
5176
+ for (const std::string &import_search_path :
5177
+ m_ast_context_ap->SearchPathOpts .getImportSearchPaths ()) {
5166
5178
HEALTH_LOG_PRINTF (" %s" , import_search_path.c_str ());
5167
5179
}
5168
5180
0 commit comments