]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
MFV r304732.
[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/Core/ConstString.h"
18 #include "lldb/Interpreter/Options.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 {
29 public:
30     OptionGroupPlatform (bool include_platform_option) :
31         OptionGroup(),
32         m_platform_name (),
33         m_sdk_sysroot (),
34         m_os_version_major (UINT32_MAX),
35         m_os_version_minor (UINT32_MAX),
36         m_os_version_update (UINT32_MAX),
37         m_include_platform_option (include_platform_option)
38     {
39     }
40
41     ~OptionGroupPlatform() override = default;
42     
43     uint32_t
44     GetNumDefinitions() override;
45     
46     const OptionDefinition*
47     GetDefinitions() override;
48     
49     Error
50     SetOptionValue(CommandInterpreter &interpreter,
51                    uint32_t option_idx,
52                    const char *option_value) override;
53     
54     void
55     OptionParsingStarting(CommandInterpreter &interpreter) override;
56     
57     lldb::PlatformSP 
58     CreatePlatformWithOptions (CommandInterpreter &interpreter,
59                                const ArchSpec &arch,
60                                bool make_selected, 
61                                Error& error,
62                                ArchSpec &platform_arch) const;
63
64     bool
65     PlatformWasSpecified () const
66     {
67         return !m_platform_name.empty();
68     }
69     
70     void
71     SetPlatformName (const char *platform_name)
72     {
73         if (platform_name && platform_name[0])
74             m_platform_name.assign (platform_name);
75         else
76             m_platform_name.clear();
77     }
78     
79     const ConstString &
80     GetSDKRootDirectory () const
81     {
82         return m_sdk_sysroot;
83     }
84     
85     void
86     SetSDKRootDirectory (const ConstString &sdk_root_directory)
87     {
88         m_sdk_sysroot = sdk_root_directory;
89     }    
90
91     const ConstString &
92     GetSDKBuild () const
93     {
94         return m_sdk_build;
95     }
96     
97     void
98     SetSDKBuild (const ConstString &sdk_build)
99     {
100         m_sdk_build = sdk_build;
101     }
102
103     bool
104     PlatformMatches(const lldb::PlatformSP &platform_sp) const;
105
106 protected:
107     std::string m_platform_name;
108     ConstString m_sdk_sysroot;
109     ConstString m_sdk_build;
110     uint32_t m_os_version_major;
111     uint32_t m_os_version_minor;
112     uint32_t m_os_version_update;
113     bool m_include_platform_option;
114 };
115
116 } // namespace lldb_private
117
118 #endif // liblldb_OptionGroupPlatform_h_