10b57cec5SDimitry Andric //===-- OptionGroupPlatform.h -----------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 95ffd83dbSDimitry Andric #ifndef LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H 105ffd83dbSDimitry Andric #define LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "lldb/Interpreter/Options.h" 130b57cec5SDimitry Andric #include "lldb/Utility/ConstString.h" 140b57cec5SDimitry Andric #include "llvm/Support/VersionTuple.h" 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric namespace lldb_private { 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric // PlatformOptionGroup 190b57cec5SDimitry Andric // 200b57cec5SDimitry Andric // Make platform options available to any commands that need the settings. 210b57cec5SDimitry Andric class OptionGroupPlatform : public OptionGroup { 220b57cec5SDimitry Andric public: OptionGroupPlatform(bool include_platform_option)230b57cec5SDimitry Andric OptionGroupPlatform(bool include_platform_option) 24fe6060f1SDimitry Andric : m_include_platform_option(include_platform_option) {} 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric ~OptionGroupPlatform() override = default; 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric llvm::ArrayRef<OptionDefinition> GetDefinitions() override; 290b57cec5SDimitry Andric 300b57cec5SDimitry Andric Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, 310b57cec5SDimitry Andric ExecutionContext *execution_context) override; 320b57cec5SDimitry Andric Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; 330b57cec5SDimitry Andric 340b57cec5SDimitry Andric void OptionParsingStarting(ExecutionContext *execution_context) override; 350b57cec5SDimitry Andric 360b57cec5SDimitry Andric lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter, 370b57cec5SDimitry Andric const ArchSpec &arch, 380b57cec5SDimitry Andric bool make_selected, Status &error, 390b57cec5SDimitry Andric ArchSpec &platform_arch) const; 400b57cec5SDimitry Andric PlatformWasSpecified()410b57cec5SDimitry Andric bool PlatformWasSpecified() const { return !m_platform_name.empty(); } 420b57cec5SDimitry Andric SetPlatformName(const char * platform_name)430b57cec5SDimitry Andric void SetPlatformName(const char *platform_name) { 440b57cec5SDimitry Andric if (platform_name && platform_name[0]) 450b57cec5SDimitry Andric m_platform_name.assign(platform_name); 460b57cec5SDimitry Andric else 470b57cec5SDimitry Andric m_platform_name.clear(); 480b57cec5SDimitry Andric } 490b57cec5SDimitry Andric GetSDKRootDirectory()50*06c3fb27SDimitry Andric const std::string &GetSDKRootDirectory() const { return m_sdk_sysroot; } 510b57cec5SDimitry Andric SetSDKRootDirectory(std::string sdk_root_directory)52*06c3fb27SDimitry Andric void SetSDKRootDirectory(std::string sdk_root_directory) { 53*06c3fb27SDimitry Andric m_sdk_sysroot = std::move(sdk_root_directory); 540b57cec5SDimitry Andric } 550b57cec5SDimitry Andric GetSDKBuild()56*06c3fb27SDimitry Andric const std::string &GetSDKBuild() const { return m_sdk_build; } 570b57cec5SDimitry Andric SetSDKBuild(std::string sdk_build)58*06c3fb27SDimitry Andric void SetSDKBuild(std::string sdk_build) { 59*06c3fb27SDimitry Andric m_sdk_build = std::move(sdk_build); 60*06c3fb27SDimitry Andric } 610b57cec5SDimitry Andric 620b57cec5SDimitry Andric bool PlatformMatches(const lldb::PlatformSP &platform_sp) const; 630b57cec5SDimitry Andric 640b57cec5SDimitry Andric protected: 650b57cec5SDimitry Andric std::string m_platform_name; 66*06c3fb27SDimitry Andric std::string m_sdk_sysroot; 67*06c3fb27SDimitry Andric std::string m_sdk_build; 680b57cec5SDimitry Andric llvm::VersionTuple m_os_version; 690b57cec5SDimitry Andric bool m_include_platform_option; 700b57cec5SDimitry Andric }; 710b57cec5SDimitry Andric 720b57cec5SDimitry Andric } // namespace lldb_private 730b57cec5SDimitry Andric 745ffd83dbSDimitry Andric #endif // LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H 75