================ @@ -1130,14 +1130,33 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType( if (target) { if (ModuleSP exe_module_sp = target->GetExecutableModule()) { - auto path_or_err = ResolveSDKPathFromDebugInfo(*exe_module_sp); - if (path_or_err) { - sysroot_spec = FileSpec(*path_or_err); + SymbolFile *sym_file = exe_module_sp->GetSymbolFile(); + if (!sym_file) + return; + + XcodeSDK merged_sdk; + for (unsigned i = 0; i < sym_file->GetNumCompileUnits(); ++i) { + if (auto cu_sp = sym_file->GetCompileUnitAtIndex(i)) { + auto cu_sdk = sym_file->ParseXcodeSDK(*cu_sp); + merged_sdk.Merge(cu_sdk); + } + } + + if (FileSystem::Instance().Exists(merged_sdk.GetSysroot())) { + sysroot_spec = merged_sdk.GetSysroot(); } else { - LLDB_LOG_ERROR(GetLog(LLDBLog::Types | LLDBLog::Host), - path_or_err.takeError(), - "Failed to resolve SDK path: {0}"); + auto path_or_err = + HostInfo::GetSDKRoot(HostInfo::SDKOptions{merged_sdk}); + if (path_or_err) { + sysroot_spec = FileSpec(*path_or_err); + } else { + LLDB_LOG_ERROR(GetLog(LLDBLog::Types | LLDBLog::Host), + path_or_err.takeError(), + "Failed to resolve SDK path: {0}"); + } } + // getSDKfortriple() ---------------- charles-zablit wrote:
Initially, I did not intend to leave this here. I have now added the `TODO` comment you suggested. https://github.com/llvm/llvm-project/pull/145744 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits