1 //===-- OptionGroupPlatform.h -----------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_OptionGroupPlatform_h_
11 #define liblldb_OptionGroupPlatform_h_
15 // Other libraries and framework includes
17 #include "lldb/Interpreter/Options.h"
18 #include "lldb/Utility/ConstString.h"
20 namespace lldb_private {
22 //-------------------------------------------------------------------------
23 // PlatformOptionGroup
25 // Make platform options available to any commands that need the settings.
26 //-------------------------------------------------------------------------
27 class OptionGroupPlatform : public OptionGroup {
29 OptionGroupPlatform(bool include_platform_option)
30 : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
31 m_os_version_major(UINT32_MAX), m_os_version_minor(UINT32_MAX),
32 m_os_version_update(UINT32_MAX),
33 m_include_platform_option(include_platform_option) {}
35 ~OptionGroupPlatform() override = default;
37 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
39 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
40 ExecutionContext *execution_context) override;
41 Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
43 void OptionParsingStarting(ExecutionContext *execution_context) override;
45 lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
47 bool make_selected, Status &error,
48 ArchSpec &platform_arch) const;
50 bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
52 void SetPlatformName(const char *platform_name) {
53 if (platform_name && platform_name[0])
54 m_platform_name.assign(platform_name);
56 m_platform_name.clear();
59 const ConstString &GetSDKRootDirectory() const { return m_sdk_sysroot; }
61 void SetSDKRootDirectory(const ConstString &sdk_root_directory) {
62 m_sdk_sysroot = sdk_root_directory;
65 const ConstString &GetSDKBuild() const { return m_sdk_build; }
67 void SetSDKBuild(const ConstString &sdk_build) { m_sdk_build = sdk_build; }
69 bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
72 std::string m_platform_name;
73 ConstString m_sdk_sysroot;
74 ConstString m_sdk_build;
75 uint32_t m_os_version_major;
76 uint32_t m_os_version_minor;
77 uint32_t m_os_version_update;
78 bool m_include_platform_option;
81 } // namespace lldb_private
83 #endif // liblldb_OptionGroupPlatform_h_