]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
Import DTS files from Linux 4.18
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Interpreter / OptionGroupPlatform.h
1 //===-- OptionGroupPlatform.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_OptionGroupPlatform_h_
11 #define liblldb_OptionGroupPlatform_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Interpreter/Options.h"
18 #include "lldb/Utility/ConstString.h"
19
20 namespace lldb_private {
21
22 //-------------------------------------------------------------------------
23 // PlatformOptionGroup
24 //
25 // Make platform options available to any commands that need the settings.
26 //-------------------------------------------------------------------------
27 class OptionGroupPlatform : public OptionGroup {
28 public:
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) {}
34
35   ~OptionGroupPlatform() override = default;
36
37   llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
38
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;
42
43   void OptionParsingStarting(ExecutionContext *execution_context) override;
44
45   lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
46                                              const ArchSpec &arch,
47                                              bool make_selected, Status &error,
48                                              ArchSpec &platform_arch) const;
49
50   bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
51
52   void SetPlatformName(const char *platform_name) {
53     if (platform_name && platform_name[0])
54       m_platform_name.assign(platform_name);
55     else
56       m_platform_name.clear();
57   }
58
59   const ConstString &GetSDKRootDirectory() const { return m_sdk_sysroot; }
60
61   void SetSDKRootDirectory(const ConstString &sdk_root_directory) {
62     m_sdk_sysroot = sdk_root_directory;
63   }
64
65   const ConstString &GetSDKBuild() const { return m_sdk_build; }
66
67   void SetSDKBuild(const ConstString &sdk_build) { m_sdk_build = sdk_build; }
68
69   bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
70
71 protected:
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;
79 };
80
81 } // namespace lldb_private
82
83 #endif // liblldb_OptionGroupPlatform_h_