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