18 PlatformSP OptionGroupPlatform::CreatePlatformWithOptions(
23 PlatformSP platform_sp;
25 if (!m_platform_name.empty()) {
26 platform_sp = platforms.
Create(m_platform_name);
28 error.SetErrorStringWithFormatv(
29 "unable to find a plug-in for the platform named \"{0}\"",
34 !platform_sp->IsCompatibleArchitecture(
35 arch, {}, ArchSpec::CompatibleMatch, &platform_arch)) {
36 error.SetErrorStringWithFormatv(
"platform '{0}' doesn't support '{1}'",
37 platform_sp->GetPluginName(),
50 if (!m_os_version.empty())
51 platform_sp->SetOSVersion(m_os_version);
54 platform_sp->SetSDKRootDirectory(m_sdk_sysroot);
57 platform_sp->SetSDKBuild(m_sdk_build);
63 void OptionGroupPlatform::OptionParsingStarting(
65 m_platform_name.clear();
66 m_sdk_sysroot.Clear();
68 m_os_version = llvm::VersionTuple();
74 "use for this target, creating the "
75 "platform if necessary."},
78 "Specify the initial SDK version to use prior to connecting."},
81 "Specify the initial SDK build number."},
84 "that contains a root of all "
85 "remote system files."}};
87 llvm::ArrayRef<OptionDefinition> OptionGroupPlatform::GetDefinitions() {
89 if (m_include_platform_option)
91 return result.drop_front();
95 OptionGroupPlatform::SetOptionValue(
uint32_t option_idx,
96 llvm::StringRef option_arg,
99 if (!m_include_platform_option)
104 switch (short_option) {
110 if (m_os_version.tryParse(option_arg))
111 error.SetErrorStringWithFormatv(
"invalid version string '{0}'",
116 m_sdk_build.SetString(option_arg);
120 m_sdk_sysroot.SetString(option_arg);
124 llvm_unreachable(
"Unimplemented option");
129 bool OptionGroupPlatform::PlatformMatches(
130 const lldb::PlatformSP &platform_sp)
const {
132 if (!m_platform_name.empty()) {
133 if (platform_sp->GetName() != m_platform_name)
137 if (m_sdk_build && m_sdk_build != platform_sp->GetSDKBuild())
140 if (m_sdk_sysroot && m_sdk_sysroot != platform_sp->GetSDKRootDirectory())
143 if (!m_os_version.empty() && m_os_version != platform_sp->GetOSVersion())