]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[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 #include "lldb/Interpreter/Options.h"
14 #include "lldb/Utility/ConstString.h"
15 #include "llvm/Support/VersionTuple.h"
16
17 namespace lldb_private {
18
19 //-------------------------------------------------------------------------
20 // PlatformOptionGroup
21 //
22 // Make platform options available to any commands that need the settings.
23 //-------------------------------------------------------------------------
24 class OptionGroupPlatform : public OptionGroup {
25 public:
26   OptionGroupPlatform(bool include_platform_option)
27       : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
28         m_include_platform_option(include_platform_option) {}
29
30   ~OptionGroupPlatform() override = default;
31
32   llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
33
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;
37
38   void OptionParsingStarting(ExecutionContext *execution_context) override;
39
40   lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
41                                              const ArchSpec &arch,
42                                              bool make_selected, Status &error,
43                                              ArchSpec &platform_arch) const;
44
45   bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
46
47   void SetPlatformName(const char *platform_name) {
48     if (platform_name && platform_name[0])
49       m_platform_name.assign(platform_name);
50     else
51       m_platform_name.clear();
52   }
53
54   const ConstString &GetSDKRootDirectory() const { return m_sdk_sysroot; }
55
56   void SetSDKRootDirectory(const ConstString &sdk_root_directory) {
57     m_sdk_sysroot = sdk_root_directory;
58   }
59
60   const ConstString &GetSDKBuild() const { return m_sdk_build; }
61
62   void SetSDKBuild(const ConstString &sdk_build) { m_sdk_build = sdk_build; }
63
64   bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
65
66 protected:
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;
72 };
73
74 } // namespace lldb_private
75
76 #endif // liblldb_OptionGroupPlatform_h_