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_
13 #include "lldb/Interpreter/Options.h"
14 #include "lldb/Utility/ConstString.h"
15 #include "llvm/Support/VersionTuple.h"
17 namespace lldb_private {
19 //-------------------------------------------------------------------------
20 // PlatformOptionGroup
22 // Make platform options available to any commands that need the settings.
23 //-------------------------------------------------------------------------
24 class OptionGroupPlatform : public OptionGroup {
26 OptionGroupPlatform(bool include_platform_option)
27 : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
28 m_include_platform_option(include_platform_option) {}
30 ~OptionGroupPlatform() override = default;
32 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
34 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
35 ExecutionContext *execution_context) override;
36 Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
38 void OptionParsingStarting(ExecutionContext *execution_context) override;
40 lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
42 bool make_selected, Status &error,
43 ArchSpec &platform_arch) const;
45 bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
47 void SetPlatformName(const char *platform_name) {
48 if (platform_name && platform_name[0])
49 m_platform_name.assign(platform_name);
51 m_platform_name.clear();
54 const ConstString &GetSDKRootDirectory() const { return m_sdk_sysroot; }
56 void SetSDKRootDirectory(const ConstString &sdk_root_directory) {
57 m_sdk_sysroot = sdk_root_directory;
60 const ConstString &GetSDKBuild() const { return m_sdk_build; }
62 void SetSDKBuild(const ConstString &sdk_build) { m_sdk_build = sdk_build; }
64 bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
67 std::string m_platform_name;
68 ConstString m_sdk_sysroot;
69 ConstString m_sdk_build;
70 llvm::VersionTuple m_os_version;
71 bool m_include_platform_option;
74 } // namespace lldb_private
76 #endif // liblldb_OptionGroupPlatform_h_