1 //===-- OptionGroupPlatform.h -----------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_OptionGroupPlatform_h_
10 #define liblldb_OptionGroupPlatform_h_
12 #include "lldb/Interpreter/Options.h"
13 #include "lldb/Utility/ConstString.h"
14 #include "llvm/Support/VersionTuple.h"
16 namespace lldb_private {
18 // PlatformOptionGroup
20 // Make platform options available to any commands that need the settings.
21 class OptionGroupPlatform : public OptionGroup {
23 OptionGroupPlatform(bool include_platform_option)
24 : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
25 m_include_platform_option(include_platform_option) {}
27 ~OptionGroupPlatform() override = default;
29 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
31 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
32 ExecutionContext *execution_context) override;
33 Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
35 void OptionParsingStarting(ExecutionContext *execution_context) override;
37 lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
39 bool make_selected, Status &error,
40 ArchSpec &platform_arch) const;
42 bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
44 void SetPlatformName(const char *platform_name) {
45 if (platform_name && platform_name[0])
46 m_platform_name.assign(platform_name);
48 m_platform_name.clear();
51 ConstString GetSDKRootDirectory() const { return m_sdk_sysroot; }
53 void SetSDKRootDirectory(ConstString sdk_root_directory) {
54 m_sdk_sysroot = sdk_root_directory;
57 ConstString GetSDKBuild() const { return m_sdk_build; }
59 void SetSDKBuild(ConstString sdk_build) { m_sdk_build = sdk_build; }
61 bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
64 std::string m_platform_name;
65 ConstString m_sdk_sysroot;
66 ConstString m_sdk_build;
67 llvm::VersionTuple m_os_version;
68 bool m_include_platform_option;
71 } // namespace lldb_private
73 #endif // liblldb_OptionGroupPlatform_h_